Do i have to add an Language server as a Git submodule?

Hello Everyone,

i want to create a Nova extension for Lexical, wich is an language server for the Elixir programming language.

I’ve already created and account, logged into my account via Nova and also created a Language Server Extension template.

For preperation i looked into another GitHub repo for an Elixir language server and the language server was added as a submodule. So, when installing the - sometime in the future - ready extension, it pulls the as a submodule added code automatically and installs it somewhere on the users harddrive, like i would run the install manually on my local machine?

Is there another way of adding the language server to my extension? I wasn’t able to find the needed answers within the documentation and will be super happy if someone can help me out :slight_smile:

Kind regards, Sebastian

Hi Sebastian,

I am not LSP expert by any means, in fact couldn’t get it working with the LSP I was playing around. But in terms of extension structure I might be able to help. So definitely have a look at the repos for other LSPs.

If the executable file from the build folder works without any problem, you are better off using a submodule? It would make your life easier in terms of updating the LSP as it is released however not your only option. Below I explain the best way to maybe organise submodules based on other extensions I browsed.

1. Submodule

I initially made this mistake but do not put your submodule in your .novaextension folder. The LSP I was playing around was pretty much like yours. I found it easier to have a super project like the one for the Typescript LSP for Nova.

Basically having yourExtension.novaextension as one of the folders. All the submodules residing in the root.
Now every time there is an update, you can pull the updates, then build and copy into the appropriate folder in your extension. I just automated the entire process using scripts to make my life easier whenever I was building a new LSP exec.

By the way I did not know this myself until recently, but Nova is clever. If you open a project that contains the .novaextension folder inside it, it still recognises it as an extension. So when you submit, it will only submit that folder. You do not have to necessarily open another workspace with .novaextension folder as a root.

Benefit:
  • Your extension will be very light, as you are only including the build/dev/rel/lexical not the entire submodules!
    • Not to mention there is a size limit when you are submitting an extension (I am not sure what is the upper limit). Which is a good thing, otherwise the extensions become like the ones in VSCode taking up 1gb space each :sweat_smile:
  • Easier updating and keeping everything separated.
  • When you install npm packages etc, they would also not be included in your extension as the package.json resides in your root. That is if you are developing in typescript instead of the javascript or have some dev dependency with your package managers.

One thing I should mention is that I don’t think Nova respects your .gitignore

So if you have the package.json in the .novaextension folder instead of the root and install packages in your node_module, It is a good idea to delete the node_module folder before submitting, otherwise Nova uploads the folder to the “Extension Library” as is.

2. Other Options

  • I realised that one of the Intelephense LSPs does install the LSP fresh and updates it automatically when loaded. This one runs a process basically rather than including the executable
  • I actually think, most of the LSP projects in the extension library dont include the sub-module at all. So you can just go ahead and include the executable if you want and dont even worry about messing around submodules, or build before submitting.