From ad98039d3ef45c962eb07e814785f4fb4c03a444 Mon Sep 17 00:00:00 2001 From: Artem Kalytiuk Date: Sun, 28 Jun 2026 22:42:33 +0200 Subject: [PATCH] Add semantic token rules for C# (Roslyn) token types Roslyn reports an extended token-type legend (field, controlKeyword, recordClass, extensionMethod, ...) beyond the standard LSP set. Without matching rules these tokens are dropped and fall back to tree-sitter-only highlighting. Map the C#-specific types to theme styles; standard types are still covered by Zed's built-in defaults. Co-Authored-By: Claude Opus 4.8 (1M context) --- languages/csharp/semantic_token_rules.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 languages/csharp/semantic_token_rules.json diff --git a/languages/csharp/semantic_token_rules.json b/languages/csharp/semantic_token_rules.json new file mode 100644 index 0000000..f890051 --- /dev/null +++ b/languages/csharp/semantic_token_rules.json @@ -0,0 +1,16 @@ +[ + { "token_type": "field", "style": ["property", "variable.member", "variable"] }, + { "token_type": "constant", "style": ["constant"] }, + { "token_type": "controlKeyword", "style": ["keyword.control", "keyword"] }, + { "token_type": "delegate", "style": ["type.delegate", "type"] }, + { "token_type": "extensionMethod", "style": ["function.method", "function"] }, + { "token_type": "operatorOverloaded", "style": ["operator"] }, + { "token_type": "recordClass", "style": ["type.class", "class", "type"] }, + { "token_type": "recordStruct", "style": ["type.struct", "struct", "type"] }, + { "token_type": "module", "style": ["namespace", "module"] }, + { "token_type": "functionPointer", "style": ["function", "type"] }, + { "token_type": "pointer", "style": ["type"] }, + { "token_type": "excludedCode", "style": ["comment"] }, + { "token_type": "stringVerbatim", "style": ["string"] }, + { "token_type": "stringEscapeCharacter", "style": ["string.escape", "string.special", "string"] } +]