From 886ae45e2736bf0406948c7302ae9a259ac43835 Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Mon, 28 Jul 2025 22:29:25 -0400 Subject: Handle semantic token for const global variables returned from functions --- src/server/semantic_tokens.odin | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/server') diff --git a/src/server/semantic_tokens.odin b/src/server/semantic_tokens.odin index ac1beed..1a5fcb6 100644 --- a/src/server/semantic_tokens.odin +++ b/src/server/semantic_tokens.odin @@ -390,9 +390,11 @@ visit_node :: proc(node: ^ast.Node, builder: ^SemanticTokenBuilder) { } } +// TODO: it seems the global symbols don't distinguish between a type decl and +// 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: + case ^ast.Comp_Lit, ^ast.Basic_Lit, ^ast.Type_Cast, ^ast.Call_Expr: return true case: return false -- cgit v1.2.3