• Sign In



  • Categories

    Extension Details



    Readme

    Groovy is (at the current time) a rough and ready Nova extension for the Groovy programming language. It basically does nothing beyond package up other people's good work into a Nova extension.

    Groovy Nova screenshot

    Requirements

    Groovy requires some additional tools to be installed on your Mac:

    • Java (However that maybe: Homebrew, or Adoptium, or other)

    Usage

    Groovy runs automatically (syntax highlighting and a language server) on any file identified as Groovy. The language server will report errors and warnings in Nova's Issues sidebar and the editor gutter.

    Configuration

    There is minimal configuration at the moment. You can set the path the the java binary by opening Extensions → Extension Library... then selecting Groovy's Preferences tab.

    Developing

    This extension bundles in the Groovy Language Server. That will need updating periodically. Follow their README instructions to update the jar.

    It's using tree-sitter since that is the preferred approach in Nova now. There look to be a few options now (although very recently weren't any):

    I've tried all of these in order and so am currently using evolighting/tree-sitter-groovy.

    The dylib will have to be re-built periodically per the Nova docs, e.g:

    cd /path/to/groovy-tree-sitter
    # Copy in the example compile_parser.sh and Makefile provided by Panic
    tree-sitter generate
    ./compile_parser.sh ./ /Applications/Nova.app/
    cp libtree-sitter-groovy.dylib /path/to/this/Groovy.novaextension/Syntaxes/libtree-sitter-groovy.dylib
    cd /path/to/this/Groovy.novaextension/Syntaxes/libtree-sitter-groovy.dylib
    codesign -s - Syntaxes/libtree-sitter-groovy.dylib
    

    Todo

    Asides from actually finding time to work on this...

    1. Understand Tree-sitter and highlights.scm. Try as I might I just don't get them yet.
    2. Maybe tweak whichever tree-sitter-groovy is currently being used, if needed
    3. Tweak highlights.scm so it's better
    4. Goto 2, repeat, etc

    Motivation

    I wanted syntax highlighting for working on Jenkins Groovy files. In my naïvety I didn't realise the Language Server Protocol stuff didn't include syntax highlighting so implemented that needlessly really.

    Credits

    Release Notes

    Version 1.1.0

    Makes enabling the language server optional

    • Bug fix: Changing the Java binary path didn't work due to variable name mismatch
    • Add setting for toggling the language server on/off. I.e. if you just want syntax highlighting
    • Improve the development/debug logging

    Version 1.0.1

    • Enable syntax highlighting for Jenkinsfile and JobDSL (which was the whole point of this extension)
    • Don't enable the LSP for those though. Let's keep that to just *.groovy files for now.

    Version 1.0

    Initial release.

    Very rough and ready. Syntax highlighting is not quite right, but is "better than nothing".

    License

    MIT License

    Copyright (c) 2023 atomicules

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.