aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-11-13 15:54:54 -0500
committerGitHub <noreply@github.com>2025-11-13 15:54:54 -0500
commit18f4b195d9c29f17c65aba34e1e1d1058b0e364b (patch)
tree12f43e94d47f43ad9cfbd73aec30c6f4aa5f8f23
parent2b776a5d94b5c11fd2998e07a3d294f506ad094d (diff)
parent72cdc7e38a57782209148a6dbf6f6e1aa2598916 (diff)
Merge pull request #1180 from BradLewis/fix/named-call-arg-types
Fix/named call arg types
-rw-r--r--src/server/analysis.odin26
-rw-r--r--tests/hover_test.odin14
2 files changed, 33 insertions, 7 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index aa19e56..f724345 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -2744,13 +2744,25 @@ resolve_type_location_proc_param_name :: proc(
reset_ast_context(ast_context)
if value, ok := call_symbol.value.(SymbolProcedureValue); ok {
- if symbol, ok := resolve_type_expression(ast_context, position_context.field_value.value); ok {
- symbol.type_pkg = symbol.pkg
- symbol.type_name = symbol.name
- symbol.pkg = call_symbol.name
- symbol.name = ident.name
- symbol.type = .Field
- return symbol, true
+ for arg in value.arg_types {
+ for name_expr in arg.names {
+ if name, ok := name_expr.derived.(^ast.Ident); ok {
+ if name.name == ident.name {
+ type := arg.type
+ if type == nil {
+ type = arg.default_value
+ }
+ if symbol, ok := resolve_type_expression(ast_context, type); ok {
+ symbol.type_pkg = symbol.pkg
+ symbol.type_name = symbol.name
+ symbol.pkg = call_symbol.name
+ symbol.name = ident.name
+ symbol.type = .Field
+ return symbol, true
+ }
+ }
+ }
+ }
}
}
return call_symbol, false
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index a24f448..52dca76 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -5628,6 +5628,20 @@ ast_hover_struct_using_with_parentheses :: proc(t: ^testing.T) {
}
test.expect_hover(t, &source, "Foo.a: int")
}
+
+@(test)
+ast_hover_named_proc_arg_hover :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ foo :: proc(bar: f32) {}
+
+ main :: proc() {
+ foo(b{*}ar=42)
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "foo.bar: f32")
+}
/*
Waiting for odin fix