Skip to content

Commit 708dca6

Browse files
authored
Merge pull request #368 from thetarnav/semantic-tokens-improvements
Multiple improvements to semantic tokens feature
2 parents 1f33639 + 4c84a87 commit 708dca6

File tree

3 files changed

+284
-508
lines changed

3 files changed

+284
-508
lines changed

src/server/requests.odin

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -793,32 +793,6 @@ request_initialize :: proc(
793793
signatureTriggerCharacters := []string{"(", ","}
794794
signatureRetriggerCharacters := []string{","}
795795

796-
token_type := type_info_of(SemanticTokenTypes).variant.(runtime.Type_Info_Named).base.variant.(runtime.Type_Info_Enum)
797-
token_modifier := type_info_of(SemanticTokenModifiers).variant.(runtime.Type_Info_Named).base.variant.(runtime.Type_Info_Enum)
798-
799-
token_types := make(
800-
[]string,
801-
len(token_type.names),
802-
context.temp_allocator,
803-
)
804-
token_modifiers := make(
805-
[]string,
806-
len(token_modifier.names),
807-
context.temp_allocator,
808-
)
809-
810-
for name, i in token_type.names {
811-
if name == "EnumMember" {
812-
token_types[i] = "enumMember"
813-
} else {
814-
token_types[i] = strings.to_lower(name, context.temp_allocator)
815-
}
816-
}
817-
818-
for name, i in token_modifier.names {
819-
token_modifiers[i] = strings.to_lower(name, context.temp_allocator)
820-
}
821-
822796
response := make_response_message(
823797
params = ResponseInitializeParams {
824798
capabilities = ServerCapabilities {
@@ -844,8 +818,8 @@ request_initialize :: proc(
844818
range = config.enable_semantic_tokens,
845819
full = config.enable_semantic_tokens,
846820
legend = SemanticTokensLegend {
847-
tokenTypes = token_types,
848-
tokenModifiers = token_modifiers,
821+
tokenTypes = semantic_token_type_names,
822+
tokenModifiers = semantic_token_modifier_names,
849823
},
850824
},
851825
inlayHintProvider = config.enable_inlay_hints,

0 commit comments

Comments
 (0)