Open RobbyCBennett opened 6 months ago
In clangd, we initially implemented highlighting of inactive code as a custom semantic token type, but we found this approach to be limiting in a couple of ways:
"editor.semanticTokenColorCustomizations"
did not allow specifying a style like "opacity"
which combines with foreground colors.)We ended up using a custom protocol extension for the server to tell the client about inactive code regions. A standard version would definitely be nice (but I'm not sure that semantic tokens are the best thing to build on).
Dart uses a Diagnostic with the DiagnosticTag.Unnecessary
tag to grey the text out:
I don't know if you can do this without a visible diagnostic though (in VS Code you might be able to use the "Hint" diagnostic which I think creates a much smaller squiggle, but I'm not sure if you can avoid it entirely).
Currently, extensions have an odd way of dimming or coloring inactive code. They add non-standard a CSS class and the class dims the code. The opacity and colors are configured in the extension settings instead of in the standard place for colors in VS Code:
tokenColorCustomizations
:textMateRules
.Here are some example of how this works already.