aboutsummaryrefslogtreecommitdiff
path: root/src/server/analysis.odin
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2025-08-03 22:36:44 +0200
committerGitHub <noreply@github.com>2025-08-03 22:36:44 +0200
commitb7ff730cc0225297f5cd8f854972a372a27e2e28 (patch)
treed80a8c078885ca1d21e119101bb69819bdb461ba /src/server/analysis.odin
parent70cbd4bc6dc638b0b783f4f33ebddb0f7c66591a (diff)
parent662e8358b79de212a3a2b39d077fd7407a850058 (diff)
Merge pull request #822 from BradLewis/feat/add-docs-for-enums-unions
Adds hover documentation for enums and unions
Diffstat (limited to 'src/server/analysis.odin')
-rw-r--r--src/server/analysis.odin22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 581a326..ab2efd7 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -1274,11 +1274,8 @@ resolve_type_assertion_expr :: proc(ast_context: ^AstContext, v: ^ast.Type_Asser
return {}, false
}
- if ok := internal_resolve_type_expression(
- ast_context,
- proc_value.return_types[0].type,
- &symbol,
- ); ok {
+ if ok := internal_resolve_type_expression(ast_context, proc_value.return_types[0].type, &symbol);
+ ok {
if union_value, ok := symbol.value.(SymbolUnionValue); ok {
if len(union_value.types) != 1 {
return {}, false
@@ -1711,8 +1708,7 @@ resolve_local_identifier :: proc(ast_context: ^AstContext, node: ast.Ident, loca
if !ok && !ast_context.overloading {
return_symbol, ok =
- make_symbol_procedure_from_ast(ast_context, local.rhs, v.type^, node, {}, false, v.inlining),
- true
+ make_symbol_procedure_from_ast(ast_context, local.rhs, v.type^, node, {}, false, v.inlining), true
}
} else {
return_symbol, ok =
@@ -3129,9 +3125,13 @@ make_symbol_union_from_ast :: proc(
}
}
+ docs, comments := get_field_docs_and_comments(ast_context.file, v.variants, ast_context.allocator)
+
symbol.value = SymbolUnionValue {
- types = types[:],
- poly = v.poly_params,
+ types = types[:],
+ poly = v.poly_params,
+ docs = docs[:],
+ comments = comments[:],
}
if v.poly_params != nil {
@@ -3172,11 +3172,15 @@ make_symbol_enum_from_ast :: proc(
append(&values, value)
}
+ docs, comments := get_field_docs_and_comments(ast_context.file, v.fields, ast_context.allocator)
+
symbol.value = SymbolEnumValue {
names = names[:],
ranges = ranges[:],
base_type = v.base_type,
values = values[:],
+ docs = docs[:],
+ comments = comments[:],
}
return symbol