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

Semantic code highlighting via Language Server Protocol #109

Open
mosra opened this issue Aug 10, 2019 · 1 comment
Open

Semantic code highlighting via Language Server Protocol #109

mosra opened this issue Aug 10, 2019 · 1 comment

Comments

@mosra
Copy link
Owner

mosra commented Aug 10, 2019

Pygments is great and all, but it can only do so much to highlight the code -- and especially in typeless languages (Python) or insanely hard to parse languages (C++) it can't provide type links, "go to definition" or anything like that. For C++ there's Clang-based and Pygments-compatible https://github.com/Oberon00/synth, but it seems abandoned. For reference, this is how a code file highlighted using it looks like, with references to documentation (although using outdated links in certain cases) and variable and function declaration cross-linking:

I think Language Server Protocol could help in this area -- it could be enough for m.css to pretend it's an editor and ask the server what each and every token is.

Existing implementations:

There's also Stack Graphs by GitHub, especially of note is the "Why aren’t we using the Language Server Protocol (LSP) or Language Server Index Format (LSIF)?" question at the end, which isn't really answered in the slides. I suppose the answer is because they need it to be incremental. LSP is anything but incremental.

Referenced from there is LSIF but as far as I can see, it's currently implemented as a Node.js tool. Thus unwanted, I'd rather call into a random language-specific server directly than to have to create a server and then in addition call this Node.js tool to give me a JSON dump to further process. Or it's possibly even worse according to microsoft/lsif-node#134, with LSIF being tied to particular server implementations!? As far as I can tell, there's currently no way to make an arbitrary server create some kind of a dump on its own, so querying directly it is.

Related project (although in TS): https://shikijs.github.io/twoslash/

@mosra mosra added this to TODO in XMLDoc theme via automation Aug 10, 2019
@mosra mosra added this to TODO in Doxygen theme via automation Aug 10, 2019
@mosra mosra added this to TODO in Python theme via automation Aug 10, 2019
@marzer
Copy link
Contributor

marzer commented Oct 17, 2022

CC @marzer (just tagging myself here for future reference)

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

No branches or pull requests

2 participants