diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2025-06-10 20:41:37 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2025-06-10 20:41:37 +0200 |
| commit | 376af34687f14a371cb27cbfb20c8a973cf4dce2 (patch) | |
| tree | 2f81a5aab774c9f56442552cbb5664224e735a74 /src/server/hover.odin | |
| parent | 33a69987c62e75c6c83757b08bc56654384e8cd5 (diff) | |
| parent | 6a9cef08d2fb8fba3edda47e57a82c2444516bf7 (diff) | |
Merge branch 'fix/overloaded-procedures' of https://github.com/BradLewis/ols into BradLewis-fix/overloaded-procedures
Diffstat (limited to 'src/server/hover.odin')
| -rw-r--r-- | src/server/hover.odin | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/server/hover.odin b/src/server/hover.odin index f9f2613..ab142dc 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) @@ -251,9 +257,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 { - symbol.signature = get_signature(&ast_context, ident, symbol) - 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 } } |