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

Support for semantic highlighting #47

Open
alaviss opened this issue May 13, 2020 · 6 comments
Open

Support for semantic highlighting #47

alaviss opened this issue May 13, 2020 · 6 comments

Comments

@alaviss
Copy link

alaviss commented May 13, 2020

nimsuggest already has powerful highlighting capability via the highlight command. I'd like to see this exposed via the LSP interface.

The current proposal for semantic highlighting in LSP (microsoft/language-server-protocol#18) doesn't seem to reach a conclusion yet, so I'd propose that we implement a server-specific method for this (maybe nimlsp/semanticHighlight?, I'm not sure how vendor-specific methods are done).

For simplicity we just need an array containing these information for a given file:

  • Token type (we can just emit the native SymbolKind here)
  • Line, col
  • Length of token

The upcoming major version of neovim will feature a scriptable LSP interface that I can use to do custom queries like this, allowing me to deprecate the current nimsuggest processing code in nim.nvim.

@PMunch
Copy link
Owner

PMunch commented May 13, 2020

I have already started implementing the proposal. Building our own version is directly against the entire purpose of LSP as it would only work with Nim-aware LSP clients. I know that at least the Vim language server has implemented the proposed version.

@alaviss
Copy link
Author

alaviss commented May 13, 2020

The community seems to still be debating whether that's the right way to implement semantic highlighting. So I'm just proposing a way for us to have this function before the semantic highlighting extension for LSP is finalized.

@ghost
Copy link

ghost commented May 14, 2020

I think the only thing possibly up for discussion (might be in part my fault 😱 ) is the token edits part, which is optional and skipped by various real-world LSP servers anyway. If any of you got input on this though, head over and jump in: microsoft/language-server-protocol#18

@PMunch
Copy link
Owner

PMunch commented May 14, 2020

I figured the basics were already fairly agreed upon as editors like Vim have already started adding support for it. This is the PR I'm using as my reference for what I'm implementing, which should be the same as what is supported in Vim: https://github.com/microsoft/vscode-languageserver-node/pull/367/files

@blakat360
Copy link

@PMunch are you still working on this?

@PMunch
Copy link
Owner

PMunch commented Jan 28, 2022

I haven't abandoned it if that is what you're asking. But I haven't actively worked on it for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants