Is it possible to create generate tooltips for specific text in the editor?

Hi all,

Can anyone confirm whether or not it is possible to create tooltips for specific text in an editor window? If not, would it be possible to add a feature request @logan?

Specifically, I would like to create an extension for Nova that provides the same functionality as gem lens (GitHub - ninoseki/vscode-gem-lens: A VS Code extension to show the latest version of each gem in a gemspec), which provides information about gems included in a gemfile.

Thanks!

Jason

1 Like

You could do this with a custom language server - https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover. It’s a lot of overhead, but would definitely be a viable path.

Thanks for the suggestion Cameron!

I actually have another use case for a custom language server as well, so it might be worth investing the time to research how to do this. In addition to the gem extension, I would like to create an extension for Stimulus JS.

Do you know of any simple examples of a custom language server (preferably vanilla JS) and how to go about integrating that into Nova? Perhaps, another Nova extension doing something similar? I could use some pointers where to start :D.

Thanks again.
Jason

The best looking thing I’ve found is VSCode’s language server extension guide, which looks like it’s got a fairly detailed implementation guide and is Node.js/TypeScript. It shows how to set up a server connection with a client and handle protocol messages. It uses vscode-languageserver-protocol, which despite it’s name seems to not be too VSCode specific (I use it in the nova TypeScript extension). It also uses vscode-languageserver and vscode-languageserver-textdocument; I don’t know how VSCode specific they are, but I kind of expect they’d work for Nova since they’re below the LSP.

1 Like

Great. I’ll look into it. Thanks again Cameron!

We have definitely had more than one request to support Hover extensions that do not use the language server protocol (in an API similar to completions and issues). It’s on our list of feature requests!

2 Likes

Thanks @logan! Sorry if one of those previous requests was mine :smiley: I couldn’t remember if I mentioned it before. Looking forward to the feature!