diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2026-02-10 21:28:41 +1100 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2026-02-10 21:28:41 +1100 |
| commit | b7756c1f9297c6f5b8bc57725a47f5496e91bbeb (patch) | |
| tree | d0f4932366480875644c9303ff7cee48ae2db841 /src/server/hover.odin | |
| parent | 12264e54a18c9b73708cdd11a54ecc06e64e5229 (diff) | |
Add hover info when hovering over package declaration
Diffstat (limited to 'src/server/hover.odin')
| -rw-r--r-- | src/server/hover.odin | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/server/hover.odin b/src/server/hover.odin index 9b42f7e..9453139 100644 --- a/src/server/hover.odin +++ b/src/server/hover.odin @@ -59,6 +59,22 @@ get_hover_information :: proc(document: ^Document, position: common.Position) -> return {}, false, true } + if document.ast.pkg_decl != nil && position_in_node(document.ast.pkg_decl, position_context.position) { + symbol := Symbol { + name = document.ast.pkg_name, + type = .Package, + pkg = ast_context.document_package, + value = SymbolPackageValue{}, + } + try_build_package(symbol.pkg) + if symbol, ok = resolve_symbol_return(&ast_context, symbol); ok { + hover.range = common.get_token_range(document.ast.pkg_decl, ast_context.file.src) + hover.contents = write_hover_content(&ast_context, symbol) + return hover, true, true + } + + } + if position_context.type_cast != nil && !position_in_node(position_context.type_cast.type, position_context.position) && !position_in_node(position_context.type_cast.expr, position_context.position) { // check that we're actually on the 'cast' word |