From 29ccf52e9cef7dc77f0b42f58669eb7e539cd12f Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Sun, 14 Dec 2025 04:21:30 -0500 Subject: Handle global call directives --- src/server/analysis.odin | 7 ++++--- tests/hover_test.odin | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/server/analysis.odin b/src/server/analysis.odin index ccaefbf..4fc69c4 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -1388,7 +1388,7 @@ resolve_call_directive :: proc(ast_context: ^AstContext, call: ^ast.Call_Expr) - value := SymbolSliceValue{ expr = ident } - symbol := Symbol{name = "#load", value = value} + symbol := Symbol{name = "#load", pkg = ast_context.current_package, value = value} return symbol, true } else if len(call.args) == 2 { return resolve_type_expression(ast_context, call.args[1]) @@ -1977,8 +1977,9 @@ resolve_global_identifier :: proc(ast_context: ^AstContext, node: ast.Ident, glo defer { ast_context.call = old_call } - - if ok = internal_resolve_type_expression(ast_context, v.expr, &return_symbol); ok { + if _, ok = v.expr.derived.(^ast.Basic_Directive); ok { + return_symbol, ok = resolve_call_directive(ast_context, v) + } else if ok = internal_resolve_type_expression(ast_context, v.expr, &return_symbol); ok { return_types := get_proc_return_types(ast_context, return_symbol, v, .Mutable in global.flags) if len(return_types) > 0 { ok = internal_resolve_type_expression(ast_context, return_types[0], &return_symbol) diff --git a/tests/hover_test.odin b/tests/hover_test.odin index 51a2edc..81a26ce 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -5930,6 +5930,26 @@ ast_hover_directives_load_hash_local :: proc(t: ^testing.T) { } test.expect_hover(t, &source, "test.bar: int") } + +@(test) +ast_hover_directives_config :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + b{*}ar :: #config(TEST, false) + `, + } + test.expect_hover(t, &source, "test.bar :: #config(TEST, false)") +} + +@(test) +ast_hover_directives_load :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + b{*}ar :: #load("foo.txt") + `, + } + test.expect_hover(t, &source, "test.bar :: #load(\"foo.txt\")") +} /* Waiting for odin fix -- cgit v1.2.3