python-lsp / python-lsp-server

Fork of the python-language-server project, maintained by the Spyder IDE team and the community
MIT License
1.92k stars 194 forks source link

feature request: semantic highlighting (textDocument_semanticTokens) #33

Open smemsh opened 3 years ago

smemsh commented 3 years ago

Feature request to support textDocument_semanticTokens, now part of official LSP standard:

https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens

Personally I would use this with vim-lsp which has implemented support for it.

reach-satori commented 1 year ago

Neovim recently merged support for this as well: neovim/neovim#21100

stalkerg commented 1 year ago

Kate also supports it.

ccordoba12 commented 1 year ago

Unfortunately we don't have the bandwidth to work on this at the moment. But pull requests are always welcomed.

stalkerg commented 1 year ago

Okey, a simple way seems like not work https://github.com/python-rope/rope/discussions/659

ccordoba12 commented 1 year ago

I think your best bet would be using Treesiter, which has the right infrastructure for that.

stalkerg commented 1 year ago

Yeah, I am looking into it, but it's little bit overkill. It will be perfect for finding a native python solution.

lkhphuc commented 1 year ago

Yeah, I am looking into it, but it's little bit overkill. It will be perfect for finding a native python solution.

There is a plugin for neovim that is based on python and is very reliable and fast imo: https://github.com/numirias/semshi . This could be a starting point to port over the functionality to python-lsp

Akselmo commented 1 year ago

Hi, has anyone investigated this further? Semantic highlighting makes programming much easier for me so I'm interested in this. I wouldn't mind helping out implementing it either!

Just wondering if there's any up-to-date info regarding this, if anyone else has tried but got stuck or something like that?

stalkerg commented 1 year ago

I just estimated the time and technology. It will be good to work on but I am not sure about the time next few months.

stalkerg commented 1 year ago

As I know @asahilina also uses Kate for Python, maybe she can help us with motivation?

krassowski commented 1 year ago

It looks like there is a draft PR for the jedi-lsp for it: https://github.com/pappasam/jedi-language-server/pull/231 so I guess it would be possible to do so with jedi alone.

But one would need to look into how it behaves when there is syntax error etc.

oakmegaeddie commented 10 months ago

We need this feature, too.

Doekeb commented 7 months ago

Hi! I'm interested in implementing this. I've made a fork here and added the boilerplate setup by copying from some the other capabilities like hover. However I can't seem to get the plugin system to call the main entrypoint. Hoping one of the core maintainers can help me finish hooking this up so I can get to the actual implementation! Can you offer any guidance @ccordoba12? Happy to provide any more details. Here's the commit with the hookups I could figure out so far.

Doekeb commented 7 months ago

Hi! I'm interested in implementing this. I've made a fork here and added the boilerplate setup by copying from some the other capabilities like hover. However I can't seem to get the plugin system to call the main entrypoint. Hoping one of the core maintainers can help me finish hooking this up so I can get to the actual implementation! Can you offer any guidance @ccordoba12? Happy to provide any more details. Here's the commit with the hookups I could figure out so far.

Nevermind I figured it out—just had to reinstall the project into the virtual environment to register the new plugin.

Doekeb commented 7 months ago

I have a fairly basic starting point here: https://github.com/python-lsp/python-lsp-server/pull/533. Surely some improvements can be made, but this already improves my syntax highlighting experience significantly!