diff options
| author | Damian Tarnawski <gthetarnav@gmail.com> | 2024-05-04 17:13:12 +0200 |
|---|---|---|
| committer | Damian Tarnawski <gthetarnav@gmail.com> | 2024-05-05 23:37:24 +0200 |
| commit | d8a37f7cf6875cc0e6eba74368541840e0bfd227 (patch) | |
| tree | 7a051d56471f1fd6233a034ccdaec7b883e11a4f /src | |
| parent | 33a6d8c802f8e1147838f97bd52839b6414a2d5c (diff) | |
Don't make a symbol for `nil`
Don't make a symbol for `nil` and enable semantic tokens for `SymbolBasicValue`
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/analysis.odin | 14 | ||||
| -rw-r--r-- | src/server/semantic_tokens.odin | 7 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 09a0d3e..122a1e7 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -1304,27 +1304,25 @@ internal_resolve_type_identifier :: proc( ident := new_type(Ident, node.pos, node.end, ast_context.allocator) ident.name = node.name - symbol: Symbol - switch ident.name { + case "nil": + return {}, false case "true", "false": - symbol = Symbol { + return { type = .Keyword, signature = node.name, pkg = ast_context.current_package, value = SymbolUntypedValue{type = .Bool}, - } + }, true case: - symbol = Symbol { + return { type = .Keyword, signature = node.name, name = ident.name, pkg = ast_context.current_package, value = SymbolBasicValue{ident = ident}, - } + }, true } - - return symbol, true } if local, ok := get_local(ast_context, node.pos.offset, node.name); diff --git a/src/server/semantic_tokens.odin b/src/server/semantic_tokens.odin index f0fa465..eb5dde2 100644 --- a/src/server/semantic_tokens.odin +++ b/src/server/semantic_tokens.odin @@ -609,10 +609,11 @@ visit_ident :: proc( SymbolFixedArrayValue, SymbolSliceValue, SymbolMapValue, - SymbolMultiPointer: + SymbolMultiPointer, + SymbolBasicValue: write_semantic_node(builder, ident, .Type, modifiers) - case SymbolBasicValue, SymbolUntypedValue: - // handled by static syntax analysis + case SymbolUntypedValue: + // handled by static syntax highlighting case SymbolGenericValue: // unused case: |