[FEATURE] Improve neovim support
User Story
- As a neovim user
- I want to integrate jayve into the neovim ecosystem
- So that comfortably edit jayvee files in neovim
User Acceptance Criteria
- [ ] Neovim automatically recognizes jayvee files
- [ ] The language server's features are available in neovim
Notes
All languages with good neovim support share these features:
-
File recognition All this requires is getting the
.jvextension added to this file (example pr). -
Language server This is also easily accomplished by adding the jayvee language server to mason-registry (auto-install) and nvim-lspconfig (auto-configure). Until now, I've extracted the language server executable from the vscode extension. This is tedious though and it also makes automatic installation hard. I propse that we publish the lsp executable as a separate package.
-
Syntax highlighting? Most big languages have a treesitter grammar which, among other things, provides syntax highlighting. However, I did not find a way to convert a langium grammar to a treesitter grammar and writing one from scratch seems very difficult. This will probably have to wait.
While the PRs necessary for 1. and 2. are waiting to be merged, they can be replicated with a plugin.
Definitions of Done
- [ ] A filetype PR has been opened in the vim repository
- [ ] The language server executable is available as a package
- [ ] A PR has been opened in the mason-registry and nvim-lspconfig repos so that the language server can be auto installed and configured
- [x] A jayvee neovim plugin is available until these PRs are closed: https://github.com/jvalue/jayvee.nvim
- [ ] All user acceptance criteria are met
- [ ] All tests are passing
This sounds like a really nice extension, even though most of it is in projects we have no control over (e.g. vim)? From what I see, for us this would mean:
- Automatically build a standalone language server executable (stretch goal of publishing it as well)
- Provide syntax highlighting. Langium generates TextMate and Monarch grammars, would any of these work? I am unfamiliar with how they relate to treesitter but Monarch is used for VSCode syntax highlighting for example.
most of it is in projects we have no control over (e.g. vim)?
Yes, but in case of vim and nvim-lspconfig a plugin can accomplish the same without a noticeable difference. So we are not dependent on our changes getting merged there.
Langium generates TextMate and Monarch grammars, would any of these work?
I found this plugin. It looks into the VSCode extension directory and uses the textmate grammars there to highlight the file in neovim. This means that both VSCode and our extension for it need to be installed in order for syntax highlighting in neovim to work. It's a little janky but it does work.
I think we'd have an okay time setting up a buildstep that exports textmate grammars and the lsp executable on their own. That would free these files up from the VSCode extension. I think that would be a step that would make integration into neovim more elegant, right?
The problem is that nvim-textmate doesn't support loading the grammar from a specific file. It only supports VSCode extensions. It may be possible to create a hacky solution where vscode doesn't have to be installed, but I can't say how much effort that would be.
What's the progress here? It's almost done right?