aboutsummaryrefslogtreecommitdiff
path: root/src/server/hover.odin
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-06-08 16:01:23 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-06-08 16:01:23 -0400
commit6a9cef08d2fb8fba3edda47e57a82c2444516bf7 (patch)
treeabee1316f04ec89495672bf2d4d9d923324f4126 /src/server/hover.odin
parenta42400e0c9f1471ec27454476f6fe6c19dc95242 (diff)
Resolve procedure overloading from external packages and improve resolution
Diffstat (limited to 'src/server/hover.odin')
-rw-r--r--src/server/hover.odin26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/server/hover.odin b/src/server/hover.odin
index cc3c5b2..9c4d33a 100644
--- a/src/server/hover.odin
+++ b/src/server/hover.odin
@@ -71,6 +71,12 @@ get_hover_information :: proc(document: ^Document, position: common.Position) ->
)
position_context, ok := get_document_position_context(document, position, .Hover)
+ if !ok {
+ log.warn("Failed to get position context")
+ return hover, false, false
+ }
+
+ ast_context.position_hint = position_context.hint
get_globals(document.ast, &ast_context)
@@ -227,8 +233,24 @@ 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 {
- if symbol, ok := resolve_type_identifier(&ast_context, ident^); ok {
- hover.contents = write_hover_content(&ast_context, symbol)
+ // check to see if we are in a position call context
+ if position_context.call != nil && ast_context.call == nil {
+ if call, ok := position_context.call.derived.(^ast.Call_Expr); ok {
+ if !position_in_exprs(call.args, position_context.position) {
+ ast_context.call = call
+ }
+ }
+ }
+ if resolved, ok := resolve_type_identifier(&ast_context, ident^); ok {
+ resolved.signature = get_signature(&ast_context, ident^, resolved)
+ resolved.name = ident.name
+
+ if resolved.type == .Variable {
+ resolved.pkg = ast_context.document_package
+ }
+
+
+ hover.contents = write_hover_content(&ast_context, resolved)
return hover, true, true
}
}