How to create a Language Server Extension for Nova?

I want to make an extension to support the Vala Language Server (GitHub - vala-lang/vala-language-server: Code Intelligence for Vala & Genie). How can I do that? This is my first time doing anything like this.

Are there any tutorials or docs I can follow? Any help is appreciated.

Thanks a lot!! :relaxed:

To get started, in Nova Preferences → General, select the last checkbox for Extension Development. You’ll then see more options in the Extensions menu in the menu bar. Select Extensions → Create New Extension…, and one of the options is for a Language Server Extension. That will give you a template for setting up a language server with Nova’s LanguageClient. To get started, you should only need to adjust a few settings, like the path/command for the server executable.

Here’s the documentation on Nova’s LanguageClient:

https://docs.nova.app/api-reference/language-client/

2 Likes

Thanks a lot. This was very helpful.

2 Likes

So I just started with the default LSP template. I specified my install path of the Language Server and installed the extension. Is it just supposed to run now? I can’t get it to work.

So, in your Vala extension project, you selected Extensions → Activate Project as Extension from the menu bar? While leaving the extension project open, you can open a Vala project, and then select Extensions → Show Extension Console. You may see errors in this console. If not, you can use console.log in your extension to log things like whether LanguageClient.running is true after the start() method runs.

You can use the drop-down in the upper left of the console to switch from “All Sources” to just your extension so you only see messages for your extension. This console is the best tool for trying to debug your extension.

As a final tip, make sure you configure activationEvents in your extension.json so that it only tries to run your extension for a Vala project. Some language servers crash/exit when they don’t find files they expect for their language.

1 Like

Hey thanks a lot for the help. I noticed that my path for the language server installation has some problem. I need to fix that, and everything should work. Sorry for the late reply, I was busy with college and designing, so I didn’t have time for personal projects.