Neovim, vim-rescript, LSP, semantic tokens issue and maintenance

Hello,

I’m using neovim and the official vim-rescript plugin as my IDE.
Unfortunately it seems noone is maintaining the project anymore. So I forked it and replaced the lsp server from time to time by extracting it from the latest vscode plugin.

Yesterday I installed some updates and now I have an issue with the rescript lsp.
I get this error: “E5248: Invalid character in group name”.

I broke down the problem and came to the conclusion that it is due to the semantic tokens. Until the updates, I was able to use the latest server versions, but now I have to go back to version 1.2.1 (the semantic token feature was introduced in v. 1.3.0).

After some trial and error, I managed to use the newest version (1.16.0) by removing theses tokens:
support-type-primitive" and jsx-tag`. As I don’t have any idea which components are causing this error, I just wanted to ask you for some hints.

Is it a combination of the tokens and the syntax highlighting? Or a combination of the tokens and treesitter? I assume that there is no problem in the vscode plugin?!

1 Like

I got this error, it’s related to the tokens that are received from the LSP.

Probably Neovim doesn’t correctly map the tokens or the server is sending tokens that are not in the LSP spec.

You can disable it, TreeSitter applies a better highlight.

Great, then I will disable it in my lsp config, so I don’t have to alter the server code.

Thank you :slight_smile:

Btw. there are some open issues, forks with improvements and updates, etc. but noone is replying to anything. @ryyppy is there a way to push the project forward?

Yeah I am aware that we are badly out of date in the official vim extension.

I had some previous discussions with @zth and @amiralies if it would be for the better if we’d publish an actual @rescript/language-server package on npm to decouple the vim extension from the actual LSP release cycle, even though I am not a huge fun to give up the builtin functionality of vim-rescript tbh.

Anyways, for the sake of simplicity, the way forward that I’d / we’d propose is:

  1. Check what builtin vim-rescript functions still make sense (some are subtly broken due to some changes in the internal compiler binary flags and / or actual compiler output) and remove any irrelevant ones. If the extension is only about the syntax, so shall be it.
  2. Create a new tagged commit that marks the breaking version for vim-rescript and have a proper migration path for existing users (if they are using vim based functions, might be that they will loose access to some functions unfortunately)
  3. Release the LSP as a separate package (will discuss with @zth, @cknitt, @fham)
  4. Make sure we have sensible setup instructions on the vim repo / website to integrate with the LSP. This will require some research on different LSP integration scenarios with VIM / NeoVim (coc, builtin nvim LSP, etc.)
  5. Lastly, as demonstrated by the actual topic intro, having a client / server architecture opens possibilities for subtle but fatal issues, so I’d like to find a way where vim and vscode users can co-exist without introducing too much maintenance overhead. Maybe have some agreed on interfaces / supported sets of LSP clients that always need to work and have some automated tests for that at some point.

I asked @amiralies to take charge of this initiative, so I’d like to grant him all access rights to lead this. @dkirchhof if you could support this initiative, that would be great.

If you need anything from my side I am happy to help / have a call or chat about it. I am sure @zth will also help with the LSP integration needs.

PS: I once played with the thought of actually committing on a nvim exclusive extension, just for the sake of maintaining the vim-related code in LUA (discussion here). I’d still be keen on this idea in case you feel adventurous.

2 Likes

I can remember these discussions. A lot of decisions you have to make.

I don’t know if I would split it. While regulary updating my neovim plugins, I often forget to update for example the LSP server for typescript. If it would simplify the release cycle… go for it.

Actually I don’t use many of the functions of the rescript plugin. Treesitter produces the syntax highlighting and functions like “create interface files” etc. don’t exist so I added them myself.

Unfortunately I don’t have much experience with all of the LSP stuff. But I would try to help you as much as I can. And if the plugin would be rewritten in lua (neovim only) I would probably be a greater help. But what about the vim users? :thinking:

For those using Neovim, I have a plugin for some features that exist in VSCode client.

  1. Create Interface file .resi
  2. Open Compiled JavaScript file
  3. Switch between implementation and interface file
4 Likes

This has been fixed.

2 Likes