PMunch / nimlsp

Language Server Protocol implementation for Nim
MIT License
419 stars 51 forks source link

Support for semantic highlighting #47

Open alaviss opened 4 years ago

alaviss commented 4 years ago

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 (https://github.com/microsoft/language-server-protocol/issues/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:

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

I think the only thing possibly up for discussion (might be in part my fault :scream: ) 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: https://github.com/microsoft/language-server-protocol/issues/18

PMunch commented 4 years ago

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 commented 2 years ago

@PMunch are you still working on this?

PMunch commented 2 years ago

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