diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-04 20:20:14 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-04 20:39:32 -0400 |
| commit | 067efb7e8e3901eb9eaf0de8050997d4d4d07498 (patch) | |
| tree | 78960751e7082cdde5a39f1527193c4f271c1281 /src/server/documentation.odin | |
| parent | 5227e9ff89b0290eefcec945867fa216aca7f51e (diff) | |
Improve bit_field field and variable hover information
Diffstat (limited to 'src/server/documentation.odin')
| -rw-r--r-- | src/server/documentation.odin | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/server/documentation.odin b/src/server/documentation.odin index be54b40..b7196e5 100644 --- a/src/server/documentation.odin +++ b/src/server/documentation.odin @@ -228,11 +228,20 @@ get_short_signature :: proc(ast_context: ^AstContext, symbol: Symbol) -> string } return strings.to_string(sb) case SymbolBitFieldValue: + sb := strings.builder_make(ast_context.allocator) if is_variable { - return strings.concatenate({pointer_prefix, symbol.name}, ast_context.allocator) + append_variable_full_name(&sb, ast_context, symbol, pointer_prefix) + } else if symbol.type_name != "" { + write_symbol_type_information(ast_context, &sb, symbol, pointer_prefix) } else { - return "bit_field" + strings.write_string(&sb, "bit_field ") + build_string_node(v.backing_type, &sb, false) + } + if symbol.comment != "" { + fmt.sbprintf(&sb, " %s", symbol.comment) } + return strings.to_string(sb) + case SymbolMultiPointerValue: return strings.concatenate( a = {pointer_prefix, "[^]", node_to_string(v.expr)}, @@ -295,6 +304,15 @@ get_enum_field_signature :: proc(value: SymbolEnumValue, index: int, allocator : return strings.to_string(sb) } +get_bit_field_field_signature :: proc(value: SymbolBitFieldValue, index: int, allocator := context.temp_allocator) -> string { + sb := strings.builder_make(allocator) + build_string_node(value.types[index], &sb, false) + strings.write_string(&sb, " | ") + build_string_node(value.bit_sizes[index], &sb, false) + append_comments(&sb, value.comments, index) + return strings.to_string(sb) +} + write_symbol_type_information :: proc(ast_context: ^AstContext, sb: ^strings.Builder, symbol: Symbol, pointer_prefix: string) { append_type_pkg := false pkg_name := get_pkg_name(ast_context, symbol.type_pkg) |