You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The textmate grammar does its own parsing (with regex) and attempts to detect codeblocks (I don't think it's 100% reliable, although its results are also replaced with semantic tokens a lot of the time so issues might not be obvious).
Server (AFAIK) doesn't currently parse the markdown, and the markdown package doesn't provide offsets/lengths to know where each kind of node is.
That said, if the package:markdown work is non-trivial, triple backtick start/ends might be easier to detect than other blocks in the comment, so maybe we could do some basic parsing in the server for that (cc @bwilkerson for his opinion).
Oh, you're right - it appears that Comment already contains codeBlocks alongside the references, so maybe everything we need is already there (for code blocks as described here at least, just not the backtick-quoted identifiers in the other issue linked above). I'll see if it's an easy fix.
The changes I made were specifically only to LSP Semantic Tokens, since we'd need to add a new HighlightRegionType to support this for the legacy protocol, and that would then also need changes in IntelliJ (I'm assuming IntelliJ uses syntax highlighting from the server, but I'm not certain). Given the goal to move to IntelliJ to LSP, I doubt that's worthwhile.
That said, I'm not sure whether IntelliJ also has some client-side syntax highlighting, equivalent to the textmate grammar in VS Code, and it might make sense to map some of the servers custom modifiers so they are coloured (for example there is a Dart-Code change at Dart-Code/Dart-Code@9fb785b that goes with this server change, mapping the new custom modifier onto the same textmate scope that the textmate grammar uses for code blocks).
(@pq@helin24 if anything here isn't clear, I can provide more details when it's appropriate)
Taking a quick look at the Dart grammar in IntelliJ, I don't see comments being parsed so I think this is all server (see e.g., : HighlightRegion.java and HighlightRegionType.java). @helin24: maybe this is something to keep on the radar as we tackle migrating semantic highlighting to LSP?
Activity
DanTup commentedon Jul 2, 2026
I think this is similar to Dart-Code/Dart-Code#3330 and blocked on dart-lang/tools#1287.
The textmate grammar does its own parsing (with regex) and attempts to detect codeblocks (I don't think it's 100% reliable, although its results are also replaced with semantic tokens a lot of the time so issues might not be obvious).
Server (AFAIK) doesn't currently parse the markdown, and the markdown package doesn't provide offsets/lengths to know where each kind of node is.
That said, if the
package:markdownwork is non-trivial, triple backtick start/ends might be easier to detect than other blocks in the comment, so maybe we could do some basic parsing in the server for that (cc @bwilkerson for his opinion).FMorschel commentedon Jul 2, 2026
This parsing (or at least part of it) is already done, see this for a case concerning a code block:
@docImportignored in analyzer (but notdart doc) if a previous code block is unclosed #63598DanTup commentedon Jul 2, 2026
Oh, you're right - it appears that
Commentalready containscodeBlocksalongside the references, so maybe everything we need is already there (for code blocks as described here at least, just not the backtick-quoted identifiers in the other issue linked above). I'll see if it's an easy fix.DanTup commentedon Jul 2, 2026
https://dart-review.googlesource.com/c/sdk/+/520100
FMorschel commentedon Jul 2, 2026
@pq just in case the Dart IJ plugin needs to update anything to make this work.
DanTup commentedon Jul 2, 2026
The changes I made were specifically only to LSP Semantic Tokens, since we'd need to add a new
HighlightRegionTypeto support this for the legacy protocol, and that would then also need changes in IntelliJ (I'm assuming IntelliJ uses syntax highlighting from the server, but I'm not certain). Given the goal to move to IntelliJ to LSP, I doubt that's worthwhile.That said, I'm not sure whether IntelliJ also has some client-side syntax highlighting, equivalent to the textmate grammar in VS Code, and it might make sense to map some of the servers custom modifiers so they are coloured (for example there is a Dart-Code change at Dart-Code/Dart-Code@9fb785b that goes with this server change, mapping the new custom modifier onto the same textmate scope that the textmate grammar uses for code blocks).
(@pq @helin24 if anything here isn't clear, I can provide more details when it's appropriate)
pq commentedon Jul 6, 2026
Taking a quick look at the Dart grammar in IntelliJ, I don't see comments being parsed so I think this is all server (see e.g., :
HighlightRegion.javaandHighlightRegionType.java). @helin24: maybe this is something to keep on the radar as we tackle migrating semantic highlighting to LSP?[analysis_server] Add a custom modifier to dartdoc lines that are cod…