diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-19 20:10:50 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-22 18:48:36 -0400 |
| commit | dc8fdcb3d55d613dc71044e7a549b15b00e12cc7 (patch) | |
| tree | 952fa71105631f61758072c96a03873d578403ba /src/server/documentation.odin | |
| parent | ddd6485f6ea68e445ee893721b2696aa2ab91bc4 (diff) | |
Add proc attribute to hover information
Diffstat (limited to 'src/server/documentation.odin')
| -rw-r--r-- | src/server/documentation.odin | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/server/documentation.odin b/src/server/documentation.odin index 1698d61..301d7e1 100644 --- a/src/server/documentation.odin +++ b/src/server/documentation.odin @@ -643,6 +643,41 @@ concatenate_symbol_information :: proc { } concatenate_raw_symbol_information :: proc(ast_context: ^AstContext, symbol: Symbol) -> string { + if v, ok := symbol.value.(SymbolProcedureValue); ok { + pkg := path.base(symbol.pkg, false, context.temp_allocator) + sb := strings.builder_make(context.temp_allocator) + if symbol.comment != "" { + fmt.sbprintf(&sb, "%s\n", symbol.comment) + } + for attribute in v.attributes { + if len(attribute.elems) == 0 { + strings.write_string(&sb, "@()\n") + continue + } + strings.write_string(&sb, "@(") + for elem, i in attribute.elems { + if directive, ok := elem.derived.(^ast.Field_Value); ok { + build_string_node(directive.field, &sb, false) + strings.write_string(&sb, "=") + build_string_node(directive.value, &sb, false) + } else { + build_string_node(elem, &sb, false) + } + if i != len(attribute.elems) - 1 { + strings.write_string(&sb, ", ") + } + + } + strings.write_string(&sb, ")\n") + } + + fmt.sbprintf(&sb, "%v.%v", pkg, symbol.name) + if symbol.signature != "" { + fmt.sbprintf(&sb, ": %v", symbol.signature) + } + return strings.to_string(sb) + } + return concatenate_raw_string_information( ast_context, symbol.pkg, |