diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-06-15 08:56:52 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-06-24 20:35:20 -0400 |
| commit | e4804807bb7c7a26b2bff10919d719a1a430870f (patch) | |
| tree | 116985fc1454378d4a5f01fc7859043a69336ab5 /src/server/hover.odin | |
| parent | be08855c0a96ffff4f577fa5ac703853422ca153 (diff) | |
Introduce a builder for `SymbolStructValue` and add docs and comments to
struct hover
Diffstat (limited to 'src/server/hover.odin')
| -rw-r--r-- | src/server/hover.odin | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/server/hover.odin b/src/server/hover.odin index afeab99..dd4af97 100644 --- a/src/server/hover.odin +++ b/src/server/hover.odin @@ -125,10 +125,27 @@ get_hover_information :: proc(document: ^Document, position: common.Position) -> &ast_context, position_context.value_decl.names[0], ); ok { + symbol.type = .Field + symbol.range = common.get_token_range(field.node, ast_context.file.src) symbol.type_name = symbol.name symbol.type_pkg = symbol.pkg symbol.pkg = struct_symbol.name symbol.name = identifier.name + + // Get the inline comment from the field definition if it exists + if value, ok := struct_symbol.value.(SymbolStructValue); ok { + index := -1 + for n, i in value.names { + if n == symbol.name { + index = i + break + } + } + if index != -1 && value.comments[index] != nil && len(value.comments[index].list) > 0 { + symbol.comment = value.comments[index].list[0].text + } + } + symbol.signature = get_signature(&ast_context, symbol) hover.contents = write_hover_content(&ast_context, symbol) return hover, true, true |