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
LSP semantic tokens offer a predefined set of semantic token types and semantic token modifiers. ZLS is currently emitting mostly standard token types with relatively few exceptions. The problem is that the existing token types are not able to accurately represent the language features of Zig which hurts the advantages that semantic highlighting can offer over syntactic highlighting.
Custom semantic tokens could enable ZLS to eventually explore new features like the following:
highlight code that may invoke safety-protected Undefined Behavior (e.g. highlight @enumFromInt for non-exhaustive enums but not for exhaustive enums, @intCast but not @truncate, + but not +|, etc.)
highlight inline functions at the callsite
highlight escape sequences inside string literals
highlight format specifiers like "{s}"
This issue encompasses two important tasks:
specify a set of token types and token modifiers that are tailored to Zig
investigate how various editors deal with custom semantic tokens
As far as I can tell, rust-analyzer uses a lot of non standard tokens. Their approach may serve as good source of inspiration.
The text was updated successfully, but these errors were encountered:
investigate how various editors deal with custom semantic tokens
Regarding this part, I have experience using @kakoune-lsp, which provides a straightforward approach. Here's my configuration, where face fields are faces defined in the Kakoune editor, which can be set to any combination of color/bold/italic/underline/double underline/curly underline, as shown here.
LSP semantic tokens offer a predefined set of semantic token types and semantic token modifiers. ZLS is currently emitting mostly standard token types with relatively few exceptions. The problem is that the existing token types are not able to accurately represent the language features of Zig which hurts the advantages that semantic highlighting can offer over syntactic highlighting.
Custom semantic tokens could enable ZLS to eventually explore new features like the following:
@enumFromInt
for non-exhaustive enums but not for exhaustive enums,@intCast
but not@truncate
,+
but not+|
, etc.)"{s}"
This issue encompasses two important tasks:
As far as I can tell, rust-analyzer uses a lot of non standard tokens. Their approach may serve as good source of inspiration.
The text was updated successfully, but these errors were encountered: