aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-17 12:49:43 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-17 12:49:43 -0400
commit6e0968d764f4913521c6ceaa23d95ea64e18bf04 (patch)
tree1e509f6db6429998552a2dd6fbeeaa160c4ba9a1 /src
parent87693f65296e7e947d530e3274148753603434cc (diff)
Improvements with hover info and distinct symbols
Diffstat (limited to 'src')
-rw-r--r--src/server/collector.odin5
-rw-r--r--src/server/documentation.odin16
2 files changed, 9 insertions, 12 deletions
diff --git a/src/server/collector.odin b/src/server/collector.odin
index 4af9d7c..7f345c9 100644
--- a/src/server/collector.odin
+++ b/src/server/collector.odin
@@ -650,7 +650,6 @@ collect_symbols :: proc(collection: ^SymbolCollection, file: ast.File, uri: stri
symbol.uri = get_index_unique_string(collection, uri)
comment, _ := get_file_comment(file, symbol.range.start.line + 1)
symbol.comment = strings.clone(get_comment(comment), collection.allocator)
- symbol.flags |= {.Distinct}
if expr.builtin || strings.contains(uri, "builtin.odin") {
symbol.pkg = "$builtin"
@@ -667,6 +666,10 @@ collect_symbols :: proc(collection: ^SymbolCollection, file: ast.File, uri: stri
symbol.pkg = get_index_unique_string(collection, directory)
}
+ if is_distinct {
+ symbol.flags |= {.Distinct}
+ }
+
if expr.deprecated {
symbol.flags |= {.Deprecated}
}
diff --git a/src/server/documentation.odin b/src/server/documentation.odin
index c076008..081ccf3 100644
--- a/src/server/documentation.odin
+++ b/src/server/documentation.odin
@@ -290,19 +290,13 @@ get_short_signature :: proc(ast_context: ^AstContext, symbol: Symbol) -> string
write_short_signature :: proc(sb: ^strings.Builder, ast_context: ^AstContext, symbol: Symbol) {
pointer_prefix := repeat("^", symbol.pointers, ast_context.allocator)
+ if .Distinct in symbol.flags {
+ strings.write_string(sb, "distinct ")
+ }
#partial switch v in symbol.value {
case SymbolBasicValue:
- if .Distinct in symbol.flags {
- if symbol.type == .Keyword {
- strings.write_string(sb, "distinct ")
- build_string_node(v.ident, sb, false)
- } else {
- fmt.sbprintf(sb, "%s%s", pointer_prefix, symbol.name)
- }
- } else {
- strings.write_string(sb, pointer_prefix)
- build_string_node(v.ident, sb, false)
- }
+ strings.write_string(sb, pointer_prefix)
+ build_string_node(v.ident, sb, false)
return
case SymbolPolyTypeValue:
fmt.sbprintf(sb, "%s$", pointer_prefix)