summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-21 09:08:31 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-21 09:08:31 -0400
commitee22998e6e8beec8e3926c9c6b1a0dbd99b3d6db (patch)
tree6c894a1f39ec66c631d67b4f8519e620c06638bd /src
parent5bdd01db885abb3df58a2ed9501f418fc58e7ee8 (diff)
Improve hover for global constant variables
Diffstat (limited to 'src')
-rw-r--r--src/server/ast.odin2
-rw-r--r--src/server/documentation.odin2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/server/ast.odin b/src/server/ast.odin
index 386d051..edb9007 100644
--- a/src/server/ast.odin
+++ b/src/server/ast.odin
@@ -375,7 +375,7 @@ merge_attributes :: proc(attrs: []^ast.Attribute, foreign_attrs: []^ast.Attribut
// a const variable declaration, so we do a quick check here to distinguish the cases.
is_variable_declaration :: proc(expr: ^ast.Expr) -> bool {
#partial switch v in expr.derived {
- case ^ast.Comp_Lit, ^ast.Basic_Lit, ^ast.Type_Cast, ^ast.Call_Expr:
+ case ^ast.Comp_Lit, ^ast.Basic_Lit, ^ast.Type_Cast, ^ast.Call_Expr, ^ast.Binary_Expr:
return true
case:
return false
diff --git a/src/server/documentation.odin b/src/server/documentation.odin
index fda1050..47c6d7e 100644
--- a/src/server/documentation.odin
+++ b/src/server/documentation.odin
@@ -853,7 +853,7 @@ construct_symbol_information :: proc(ast_context: ^AstContext, symbol: Symbol) -
strings.write_string(&sb, " : ")
write_node(&sb, ast_context, symbol.value_expr, "", 1, false)
return strings.to_string(sb)
- } else if _, ok := symbol.value_expr.derived.(^ast.Comp_Lit); ok {
+ } else if .Variable in symbol.flags {
strings.write_string(&sb, " :: ")
write_node(&sb, ast_context, symbol.value_expr, "", 1, false)
return strings.to_string(sb)