diff options
Diffstat (limited to 'src/server/documentation.odin')
| -rw-r--r-- | src/server/documentation.odin | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/server/documentation.odin b/src/server/documentation.odin index 3c75ae3..7979e5a 100644 --- a/src/server/documentation.odin +++ b/src/server/documentation.odin @@ -430,16 +430,7 @@ write_short_signature :: proc(sb: ^strings.Builder, ast_context: ^AstContext, sy strings.write_string(sb, "package") return case SymbolUntypedValue: - switch v.type { - case .Float: - strings.write_string(sb, "float") - case .String: - strings.write_string(sb, "string") - case .Bool: - strings.write_string(sb, "bool") - case .Integer: - strings.write_string(sb, "int") - } + strings.write_string(sb, v.tok.text) return case SymbolGenericValue: build_string_node(v.expr, sb, false) @@ -798,6 +789,18 @@ construct_symbol_information :: proc(ast_context: ^AstContext, symbol: Symbol) - sb := strings.builder_make(ast_context.allocator) write_symbol_attributes(&sb, symbol) write_symbol_name(&sb, symbol) + if .Mutable not_in symbol.flags { + if symbol.type_expr != nil && symbol.value_expr != nil { + strings.write_string(&sb, " : ") + build_string_node(symbol.type_expr, &sb, false) + strings.write_string(&sb, " : ") + build_string_node(symbol.value_expr, &sb, false) + return strings.to_string(sb) + } + strings.write_string(&sb, " :: ") + } else { + strings.write_string(&sb, ": ") + } if symbol.type == .Package { return strings.to_string(sb) @@ -867,7 +870,6 @@ write_symbol_name :: proc(sb: ^strings.Builder, symbol: Symbol) { fmt.sbprintf(sb, "%v.", pkg) } strings.write_string(sb, symbol.name) - strings.write_string(sb, ": ") } write_symbol_type_information :: proc(sb: ^strings.Builder, ast_context: ^AstContext, symbol: Symbol) -> bool { |