From aa435ccf75aff11f4bc3d54fb16ecf3a3991f79b Mon Sep 17 00:00:00 2001 From: lujaire Date: Wed, 3 Jul 2024 15:50:56 -0300 Subject: Fix extraneous .Type semantic tokens --- src/server/semantic_tokens.odin | 48 ++++++++++++++++++++--------------------- tests/semantic_tokens_test.odin | 11 +++++----- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/server/semantic_tokens.odin b/src/server/semantic_tokens.odin index 8ace068..4edb6ea 100644 --- a/src/server/semantic_tokens.odin +++ b/src/server/semantic_tokens.odin @@ -602,30 +602,30 @@ visit_ident :: proc( } case .EnumMember: write_semantic_node(builder, ident, .EnumMember, modifiers) - } - - /* type idents */ - switch v in symbol.value { - case SymbolPackageValue: - write_semantic_node(builder, ident, .Namespace, modifiers) - case SymbolStructValue, SymbolBitFieldValue: - write_semantic_node(builder, ident, .Struct, modifiers) - case SymbolEnumValue, SymbolUnionValue: - write_semantic_node(builder, ident, .Enum, modifiers) - case SymbolProcedureValue, - SymbolMatrixValue, - SymbolBitSetValue, - SymbolDynamicArrayValue, - SymbolFixedArrayValue, - SymbolSliceValue, - SymbolMapValue, - SymbolMultiPointer, - SymbolBasicValue: - write_semantic_node(builder, ident, .Type, modifiers) - case SymbolUntypedValue: - // handled by static syntax highlighting - case SymbolGenericValue, SymbolProcedureGroupValue, SymbolAggregateValue: - // unused case: + /* type idents */ + switch v in symbol.value { + case SymbolPackageValue: + write_semantic_node(builder, ident, .Namespace, modifiers) + case SymbolStructValue, SymbolBitFieldValue: + write_semantic_node(builder, ident, .Struct, modifiers) + case SymbolEnumValue, SymbolUnionValue: + write_semantic_node(builder, ident, .Enum, modifiers) + case SymbolProcedureValue, + SymbolMatrixValue, + SymbolBitSetValue, + SymbolDynamicArrayValue, + SymbolFixedArrayValue, + SymbolSliceValue, + SymbolMapValue, + SymbolMultiPointer, + SymbolBasicValue: + write_semantic_node(builder, ident, .Type, modifiers) + case SymbolUntypedValue: + // handled by static syntax highlighting + case SymbolGenericValue, SymbolProcedureGroupValue, SymbolAggregateValue: + // unused + case: + } } } diff --git a/tests/semantic_tokens_test.odin b/tests/semantic_tokens_test.odin index aff7788..21115de 100644 --- a/tests/semantic_tokens_test.odin +++ b/tests/semantic_tokens_test.odin @@ -26,11 +26,10 @@ my_function :: proc() { {0, 3, 6, .Type, {.ReadOnly}}, // [2] string {0, 11, 3, .Type, {.ReadOnly}}, // [3] int {1, 0, 11, .Function, {.ReadOnly}}, // [4] my_function - {0, 0, 11, .Type, {.ReadOnly}}, // [5] !!! WRONG !!! - {1, 1, 1, .Variable, {}}, // [6] a - {1, 1, 1, .Variable, {}}, // [7] b - {0, 5, 1, .Variable, {}}, // [8] a - {1, 1, 1, .Variable, {}}, // [9] c - {0, 9, 1, .Variable, {}}, // [10] b + {1, 1, 1, .Variable, {}}, // [5] a + {1, 1, 1, .Variable, {}}, // [6] b + {0, 5, 1, .Variable, {}}, // [7] a + {1, 1, 1, .Variable, {}}, // [8] c + {0, 9, 1, .Variable, {}}, // [9] b }) } -- cgit v1.2.3