diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-28 18:15:47 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-28 18:15:47 -0400 |
| commit | ff7f24adedf39fbd69a68a7bf691277d34d1e638 (patch) | |
| tree | a56915f8fc0a253cc562e5b7b5acbe629a72445a /src/server/symbol.odin | |
| parent | 95adee92d78ba24478ed4be2c7b6e5b4212c7581 (diff) | |
Process defer statements and correct hover info for anonymous types
Diffstat (limited to 'src/server/symbol.odin')
| -rw-r--r-- | src/server/symbol.odin | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/server/symbol.odin b/src/server/symbol.odin index e87cb70..3384d3b 100644 --- a/src/server/symbol.odin +++ b/src/server/symbol.odin @@ -873,3 +873,20 @@ construct_enum_field_symbol :: proc(symbol: ^Symbol, value: SymbolEnumValue, ind symbol.comment = get_comment(value.comments[index]) symbol.signature = get_enum_field_signature(value, index) } + +// Adds name and type information to the symbol when it's for an identifier +construct_ident_symbol_info :: proc(symbol: ^Symbol, ident: ^ast.Ident, document_pkg: string) { + symbol.type_name = symbol.name + symbol.type_pkg = symbol.pkg + symbol.name = clean_ident(ident.name) + if symbol.type == .Variable { + symbol.pkg = document_pkg + } + + // If the pkg + name is the same as the type pkg + name, we use the underlying type instead + // This is used for things like anonymous structs + if symbol.name == symbol.type_name && symbol.pkg == symbol.type_pkg { + symbol.type_name = "" + symbol.type_pkg = "" + } +} |