aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-27 14:59:02 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-27 14:59:02 -0400
commit5e3467dfd177531903cdd6b4b2d2fedc187e2b3d (patch)
tree410b9279d8bbe760306b7e18edb6a87b28501b84
parent710b9a8e0ef88f970bf67226dfc0b7d33b042a43 (diff)
Ensure ast_context is reset after attempt to handle an implicit selector completion in a function call
-rw-r--r--src/server/completion.odin2
-rw-r--r--tests/completions_test.odin21
2 files changed, 23 insertions, 0 deletions
diff --git a/src/server/completion.odin b/src/server/completion.odin
index e04963f..8e62e15 100644
--- a/src/server/completion.odin
+++ b/src/server/completion.odin
@@ -1222,6 +1222,8 @@ get_implicit_completion :: proc(
}
}
}
+
+ reset_ast_context(ast_context)
}
if position_context.index != nil {
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index f8b55f1..1389550 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -4052,3 +4052,24 @@ ast_completion_enum_global_array :: proc(t: ^testing.T) {
test.expect_completion_details(t, &source, "", {"A", "B"})
}
+
+@(test)
+ast_completion_enum_array_in_proc_param :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo :: enum {
+ A,
+ B,
+ }
+
+ bar :: proc(v: i32) {}
+
+ main :: proc() {
+ foos: [Foo]i32
+ bar(foos[.{*}])
+ }
+ `,
+ }
+
+ test.expect_completion_details(t, &source, "", {"A", "B"})
+}