asciidoctor / asciidoctor-vscode

AsciiDoc support for Visual Studio Code using Asciidoctor
Other
321 stars 97 forks source link

Improve syntax highlighting using a Language Server Protocol implementation #686

Open ggrossetie opened 1 year ago

ggrossetie commented 1 year ago

We currently rely on a TextMate grammar but it cannot properly parse AsciiDoc.

I think we should migrate to semantic highlighting: code.visualstudio.com/api/language-extensions/semantic-highlight-guide or LSP: code.visualstudio.com/api/language-extensions/language-server-extension-guide

If someone wants to give it a try, please feel free to do so!

Related issues:

ggrossetie commented 8 months ago

It's worth noting that semantic tokens do not support embedded languages:

https://github.com/microsoft/vscode/issues/163292

In other words, source blocks won't be properly highlighted in AsciiDoc.

I don't think we should adopt the semantic tokens feature until embedded languages are supported.

I guess our only solution right now is to use LSP.

ViToni commented 3 months ago

Is this basically the same issue as #625 ?

ggrossetie commented 3 months ago

Initially, I thought it would be possible to implement a syntax highlighter using semantic token provider, that's why I've created a new issue.

Since we need to use LSP, it's indeed a duplicate of https://github.com/asciidoctor/asciidoctor-vscode/issues/625. I think we should close #625 in favor of this one.

ViToni commented 3 months ago

Looking into LSP has been on my ToDo list for a long time. This issue might be somethIng to get this action item checked off. Wondering though if it might be better to have a dedicated project for that as a LSP implementation (e.g. asciidoctor-lsp) could be used independently of this extension.

ggrossetie commented 3 months ago

@ViToni If you want to work on it that would be awesome! Yes, we should create a dedicated project! In case you've missed it, the AsciiDoc specification is under way:

The current syntax highlighter is broken and we could do so much more with a proper LSP (suggestion, lint, reformat and so on)

ViToni commented 3 months ago

@ggrossetie I'd try to get my feets wet. Not sure how far I get, but at least I'd like to give it a try. I'll join the chat in the next days.

ViToni commented 3 months ago

Related to: https://github.com/asciidoctor/asciidoctor/issues/3630