aboutsummaryrefslogtreecommitdiff
path: root/src/server/documentation.odin
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-18 08:43:09 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-21 08:55:43 -0400
commit035a0db206ae1651b8e853b5aff5c1562fc7715e (patch)
treebc7fb35673d5eae1747a650b980db18350b8612b /src/server/documentation.odin
parenta498379ca16e1e0fc344c654a7e24710f8be77b6 (diff)
Rework how hover info is displayed for constants and types
Diffstat (limited to 'src/server/documentation.odin')
-rw-r--r--src/server/documentation.odin23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/server/documentation.odin b/src/server/documentation.odin
index 7979e5a..53c9c36 100644
--- a/src/server/documentation.odin
+++ b/src/server/documentation.odin
@@ -430,6 +430,19 @@ write_short_signature :: proc(sb: ^strings.Builder, ast_context: ^AstContext, sy
strings.write_string(sb, "package")
return
case SymbolUntypedValue:
+ if .Mutable in symbol.flags || symbol.type == .Field {
+ 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")
+ }
+ return
+ }
strings.write_string(sb, v.tok.text)
return
case SymbolGenericValue:
@@ -789,7 +802,12 @@ 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 == .Package {
+ return strings.to_string(sb)
+ }
+
+ if symbol.type != .Field && .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)
@@ -802,9 +820,6 @@ construct_symbol_information :: proc(ast_context: ^AstContext, symbol: Symbol) -
strings.write_string(&sb, ": ")
}
- if symbol.type == .Package {
- return strings.to_string(sb)
- }
if write_symbol_type_information(&sb, ast_context, symbol) {
return strings.to_string(sb)