Use the analysis server for semantic highlighting
See original GitHub issueOn the insiders channel, VS Code now provides apis for semantic token highlighting. This would allow Dart Code to enhance the static grammar-based highlighter with highlighting information from the analyzer.
In particular, the extension could use it to:
- be more accurate at semantic highlighting (members starting with an uppercase, named
get
/set
, complex string literals, …) - highlight non-Dart files via analysis server plugins
To my knowledge, LSP doesn’t support syntax highlighting (yet). So I think this would have to be implemented using the DAS protocol and a contributor for now. I’ve started some work on this and I hope I can open a PR next week.
Current issues
- Not available in a stable VS Code release
- The analysis server doesn’t highlight
null
andthrow
tokens, https://dart-review.googlesource.com/c/sdk/+/131071
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:15 (14 by maintainers)
Top Results From Across the Web
Semantic Highlight Guide | Visual Studio Code Extension API
Semantic highlighting is an addition to syntax highlighting as described in the Syntax Highlight guide. Visual Studio Code uses TextMate grammars as the ......
Read more >Neovim 101 — Semantic Highlighting | by alpha2phi - Medium
We briefly went through semantic highlighting using Tree-sitter previously. In this article, let's go through this feature using Tree-sitter and LSP.
Read more >How does Semantic Highlighting work in VS Code with ...
I wrote a tool that inputs an Antlr4 grammar and a list of XPaths that specify SH classes, and outputs an LSP server...
Read more >User Manual - rust-analyzer
At its core, rust-analyzer is a library for semantic analysis of Rust code as it changes over time. This manual focuses on a...
Read more >Analysis Services tools | Microsoft Learn
Tabular and multidimensional model projects are created by using project templates in Visual Studio with Analysis Services projects ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@simolus3 LSP v3.16 is due to be finalised imminently (hurrah!). I have started preparing to land changes in the server:
https://dart-review.googlesource.com/c/sdk/+/175722/
Once LSP 3.16 is final (and the next version of VS Code) I’ll make a new preview build of Dart-Code with the new client that will work with the server changes.
I’ve included a basic plugin test in that CL, though if there are cases you think it doesn’t cover, please let me know (or feel free to contribute changes).
@simolus3 still haven’t forgotten this, but it’s still unfinalized in LSP so I’ve been holding off merging or doing any more. There are also a few things I’ve asked about, like supporting multiline/nested tokens that haven’t really been resolved yet.