diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-06-09 15:47:48 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-06-09 15:56:50 -0400 |
| commit | d375ab72e557552223d248bd30966732c4eb8166 (patch) | |
| tree | 78f9f76215911e4f51edf3cee24c03367f0a4f19 /src | |
| parent | a42400e0c9f1471ec27454476f6fe6c19dc95242 (diff) | |
Fix issue where hover inside struct construction would resolve to the field rather than the assigning value
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/hover.odin | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/server/hover.odin b/src/server/hover.odin index cc3c5b2..d1e861a 100644 --- a/src/server/hover.odin +++ b/src/server/hover.odin @@ -111,15 +111,17 @@ get_hover_information :: proc(document: ^Document, position: common.Position) -> if position_context.field_value != nil && position_context.comp_lit != nil { if comp_symbol, ok := resolve_comp_literal(&ast_context, &position_context); ok { if field, ok := position_context.field_value.field.derived.(^ast.Ident); ok { - if v, ok := comp_symbol.value.(SymbolStructValue); ok { - for name, i in v.names { - if name == field.name { - if symbol, ok := resolve_type_expression(&ast_context, v.types[i]); ok { - symbol.name = name - symbol.pkg = comp_symbol.name - symbol.signature = common.node_to_string(v.types[i]) - hover.contents = write_hover_content(&ast_context, symbol) - return hover, true, true + if position_in_node(field, position_context.position) { + if v, ok := comp_symbol.value.(SymbolStructValue); ok { + for name, i in v.names { + if name == field.name { + if symbol, ok := resolve_type_expression(&ast_context, v.types[i]); ok { + symbol.name = name + symbol.pkg = comp_symbol.name + symbol.signature = common.node_to_string(v.types[i]) + hover.contents = write_hover_content(&ast_context, symbol) + return hover, true, true + } } } } |