From ee22998e6e8beec8e3926c9c6b1a0dbd99b3d6db Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Sun, 21 Sep 2025 09:08:31 -0400 Subject: Improve hover for global constant variables --- src/server/ast.odin | 2 +- src/server/documentation.odin | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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) -- cgit v1.2.3