Nova

Extensions


Readme

Go-Bee™ - Go Extension for Nova

Go-Bee (think the "goby" salt-water fish) provides rich support for the Go programming language in Nova.

Functionality is provided via the gopls language server, fast syntactic analysis thanks to Tree-sitter, and debugging support via the dlv (aka Delve) debugger.

This extension requires Nova 10.0 or better, and because of at least one fixed bug, we highly recommend updating to Nova 10.4 or better.

✨ Features ✨

  • Syntax Highlighting
  • Indentation
  • Symbols
  • Code Folding
  • Format File, including On Save
  • Jump to Definition, Implementation, Type Definition
  • Find References
  • Find Symbol
  • Rename Symbol
  • Hover Tooltips
  • Signature Assistance
  • Code Quality Hints
  • Code Actions
  • Debugging (local, remote, and post-mortem)

📸 Screenshots 📸

🐞 Debugging 🐞

This extension also supports source code level debugging of both local and remote programs.

Quick access (default) tasks are created to debug the current package or test suites in the current package. The former will only work if workspace directory contains a "main" package.

Much more flexible configuration of debugging targets can be accessed using the Tasks feature in the Project Settings dialog.

In this dialog you can create debug tasks which support both local and remote debugging, as well as post-mortem debugging using core files, adjusting the arguments and environment used when starting the debug target, as well as other options related to debugging.

Debugging support is a new feature, and should be considered experimental. Feedback is appreciated!

🛡️ Security Considerations 🛡️

This extension uses the network to check for the latest version of gopls (the language server) and dlv (the debugger) using the GitHub releases API. It also will indirectly use the network when it tries to install these using the go install command. (The binaries will be installed in the extension's private directory.)

The gopls and dlv programs will be installed in a private directory by default, but it is possible to configure a different location. In any event, we do execute that command for the language server, and the language server may itself perform additional actions -- see the source code for gopls or dlv if you want to know more.

It is possible to disable the use of gopls and dlv, and instead rely only on the syntax features from Tree-sitter. That will disable much of the useful functionality, but enough remains (highlighting, local symbol resolution, folds, and indentation) to still be worthwhile.

🔮 Future Directions 🔮

Tasks to build using go.

Support for larger refactoring - such as package renaming.

Template support. The LSP already provides support for this, but syntax highlighting will require another grammar, or for Nova to learn about LSP style syntax highlighting.

🐜 Bugs 🐜

  • Symbol renames can mess up highlighting. Make a subsequent change to refresh the tree-sitter grammar's view of things. This appears to be a Nova defect.

  • Some things that should be code actions are not. Sometimes gopls will give a "hint" about a quick-fix, but as Nova lack's support for codeLens (as of 10.6 at least), these aren't actually available.

  • Symbol queries can wind up returning some rather specious results as a result of gopls' use of fuzzy matching. The best (accurate) matches should be listed first. Note that some control over the fuzzy queries is available.

🌐 Localizations 🌐

If you'd like to help with localizing this extension, please submit an issue or contact us directly. We have designed the extension to make this a very easy task for anyone able to perform the actual translations.

❓ Why Another Go Extension? ❓

There are at least three other extensions providing support for Go for Nova.

Our intention in this extension is to provider faster and more accurate syntax highlighting by using the Tree-Sitter support in Nova 10 and later.

Furthermore, we believe we can leverage the work we have done for other C family languages in our C-Dragon and D-Velop extensions to quickly bring a richer set of capabilities to Nova than the other extensions currently offer.

We think this is probably easier than submitting PRs to those other extensions, especially as our use of Tree-sitter is a fairly big departure from the way the other ones work.

At this point we believe this extension represents the most complete support for Go language development in Nova. (We're not finished yet, though!)

⚖️ Legal Notices ⚖️

Go-Bee™ and the Goby mascot are trademarks of Staysail Systems, Inc.

Copyright © 2022 Staysail Systems, Inc.

This extension is made available under the terms of the MIT License.

Some of the code in this extension was adapted from Cameron Little's excellent TypeScript extension for Nova. That extension is also licensed under the MIT license and carries the following copyright notice:

Copyright (c) 2020 Cameron Little

This work includes code from Ben Beshara's original C++ ClangD extension. That extension carried the following license declaration in its manifest (which we have preserved):

"license": "MIT",

The goby mascot was created as a modification of Renee French's gopher mascot for Go. The original work was licensed under Creative Commons Attribution 4.0. Thanks, Renee!

The Go logo is also used under the Creative Commons Attribution 4.0 license.


Changelog

Version 0.9.1

Fix for debugger environment variables (contributed by Maximilian Gaß mxey@mxey.net).

Version 0.9.0

Updated Tree Sitter grammars for Go and Go Mod.

Add recognition of bool and comparable as a built in (core) types.

Add recognition of clear, min, and max as built in functions.

Note that very few themes seem to handle the identifier.core property specially, so you might not notice a difference.

Use identifier.core instead of keyword.construct for built in times.

Interface names marked as identifier.type.protocol at declaration point

Struct names marked as identifier.type.struct at declaration point

Version 0.8.0

Improved display names for method symbols. This includes the receiver type name as part of the symbol's display name.

Version 0.7.0

Fix to correctly honor the configured path to the dlv debugger.

Fix for potentially catastrophic bug when formatting a file that is missing a trailing newline. (Contributed by John Fieber, @jfieber).

Version 0.6.0

Support for go mod init, and go mod tidy.

Only create default debug builds if go.mod is present.

Fix error dialog when manually checking for updates.

Version 0.5.1

Improved indentation support.

Version 0.5.0

Initial support for debugging(!) with Delve. This includes both local and remote debugging over Delve's DAP support.

Version 0.1.0

Syntax support for go.mod (highlighting only)

Activate if workspace contains go.mod.

Better configuration support for finding go executable. (Contributed by John Fieber, @jfieber).

Version 0.0.2

Add tunables for gofumpt and local package formatting, as well as build flags.

Version 0.0.1

This is our first "pre"-release. It supports a lot of functionality, although there is quite a lot more to do. Syntax with Tree-sitter should work quite well for most things, but the gopls LSP integration still could do with a lot more enhancement. (Nonetheless this is likely more functional than some of the other extensions available for Nova.)


License

The MIT License

Copyright 2022 Staysail Systems, Inc. info@staysail.tech

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.