Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Improve neovim support #550

Open
1 of 8 tasks
TungstnBallon opened this issue Apr 17, 2024 · 4 comments
Open
1 of 8 tasks

[FEATURE] Improve neovim support #550

TungstnBallon opened this issue Apr 17, 2024 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@TungstnBallon
Copy link
Contributor

TungstnBallon commented Apr 17, 2024

User Story

  1. As a neovim user
  2. I want to integrate jayve into the neovim ecosystem
  3. 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:

  1. File recognition
    All this requires is getting the .jv extension added to this file (example pr).

  2. 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.

  3. 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
  • 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
@TungstnBallon TungstnBallon added enhancement New feature or request help wanted Extra attention is needed labels Apr 17, 2024
@rhazn
Copy link
Contributor

rhazn commented Apr 17, 2024

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.

@TungstnBallon
Copy link
Contributor Author

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.

@rhazn
Copy link
Contributor

rhazn commented Apr 17, 2024

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?

@TungstnBallon
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants