diff options
| author | Bradley Lewis <22850972+BradLewis@users.noreply.github.com> | 2026-02-10 21:40:49 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-10 21:40:49 +1100 |
| commit | 693394edfb73d9b3151432926a25970e07d8f4ed (patch) | |
| tree | f125c1b0e6b6f7a699127cc7388289773a9eb23b /src/server/analysis.odin | |
| parent | bdb8de855fe54090a388a25c03ef19f279b13b19 (diff) | |
| parent | cb8f89b821b19021d018366c04c5f2f837b9d0d0 (diff) | |
Merge pull request #1292 from BradLewis/feat/add-docs-to-package-hover
Add documentation to package hover info
Diffstat (limited to 'src/server/analysis.odin')
| -rw-r--r-- | src/server/analysis.odin | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 6d0cf09..67d7ef3 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -1812,7 +1812,7 @@ internal_resolve_type_identifier :: proc(ast_context: ^AstContext, node: ast.Ide try_build_package(symbol.pkg) - return symbol, true + return resolve_symbol_return(ast_context, symbol) } } @@ -1823,8 +1823,9 @@ internal_resolve_type_identifier :: proc(ast_context: ^AstContext, node: ast.Ide pkg = indexer.runtime_package, value = SymbolPackageValue{}, } + try_build_package(symbol.pkg) - return symbol, true + return resolve_symbol_return(ast_context, symbol) } if global, ok := ast_context.globals[node.name]; @@ -1853,7 +1854,7 @@ internal_resolve_type_identifier :: proc(ast_context: ^AstContext, node: ast.Ide try_build_package(symbol.pkg) - return symbol, true + return resolve_symbol_return(ast_context, symbol) } is_runtime := strings.contains(ast_context.current_package, "base/runtime") @@ -1896,7 +1897,7 @@ resolve_local_identifier :: proc(ast_context: ^AstContext, node: ast.Ident, loca value = SymbolPackageValue{}, } - return symbol, true + return resolve_symbol_return(ast_context, symbol) } } } @@ -2639,6 +2640,16 @@ resolve_symbol_return :: proc(ast_context: ^AstContext, symbol: Symbol, ok := tr } #partial switch &v in symbol.value { + case SymbolPackageValue: + if pkg, ok := indexer.index.collection.packages[symbol.pkg]; ok { + if symbol.doc == "" { + symbol.doc = strings.to_string(pkg.doc) + } + if symbol.comment == "" { + symbol.comment = strings.to_string(pkg.comment) + } + } + return symbol, true case SymbolProcedureGroupValue: if s, ok := resolve_function_overload(ast_context, v.group.derived.(^ast.Proc_Group)); ok { if s.doc == "" { |