aboutsummaryrefslogtreecommitdiff
path: root/src/server/hover.odin
diff options
context:
space:
mode:
authorDaniel Gavin <danielgavin5@hotmail.com>2022-08-15 13:31:13 +0200
committerDaniel Gavin <danielgavin5@hotmail.com>2022-08-15 13:31:13 +0200
commit440af34d87e4e92bd9968f677c1fd552054f476e (patch)
treecd3df39e0db3510ef70c07845fbca6d5a33a6e3d /src/server/hover.odin
parent1063fa3a6556bc15f374318d901e68e16526a14f (diff)
Fix hover and go to issue where selector base was the same name as field.
Diffstat (limited to 'src/server/hover.odin')
-rw-r--r--src/server/hover.odin11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/server/hover.odin b/src/server/hover.odin
index 0a419dd..0e00fa0 100644
--- a/src/server/hover.odin
+++ b/src/server/hover.odin
@@ -98,11 +98,10 @@ get_hover_information :: proc(document: ^Document, position: common.Position) ->
ast_context.current_package = ast_context.document_package
//if the base selector is the client wants to go to.
- if base, ok := position_context.selector.derived.(^ast.Ident); ok && position_context.identifier != nil && position_in_node(position_context.selector, position_context.position) {
+ if base, ok := position_context.selector.derived.(^ast.Ident); ok && position_context.identifier != nil {
ident := position_context.identifier.derived.(^ast.Ident)^
- if ident.name == base.name {
-
+ if position_in_node(base, position_context.position) {
if resolved, ok := resolve_type_identifier(&ast_context, ident); ok {
resolved.signature = get_signature(&ast_context, ident, resolved)
resolved.name = ident.name
@@ -133,11 +132,12 @@ get_hover_information :: proc(document: ^Document, position: common.Position) ->
}
}
-
+ ast_context.current_package = selector.pkg
+
#partial switch v in selector.value {
case SymbolStructValue:
for name, i in v.names {
- if strings.compare(name, field) == 0 {
+ if name == field {
if symbol, ok := resolve_type_expression(&ast_context, v.types[i]); ok {
symbol.name = name //TODO refractor - never set symbol name after creation - change writer_hover_content
symbol.pkg = selector.name
@@ -150,7 +150,6 @@ get_hover_information :: proc(document: ^Document, position: common.Position) ->
case SymbolPackageValue:
if position_context.field != nil {
if ident, ok := position_context.field.derived.(^ast.Ident); ok {
- ast_context.current_package = selector.pkg
if symbol, ok := resolve_type_identifier(&ast_context, ident^); ok {
hover.contents = write_hover_content(&ast_context, symbol)
return hover, true, true