aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-10-30 04:22:54 -0400
committerGitHub <noreply@github.com>2025-10-30 04:22:54 -0400
commit1b77a458f5bdfc4ec55fd2a8f23a117b484198b3 (patch)
treec2a353eb437528d0475fa040958187c0256ee549
parent7ee9a6fc9647adf493d7e95ac675c0094f11ee4d (diff)
parent09a400ca6c238eada7c101569764c5a475a375d6 (diff)
Merge pull request #1133 from BradLewis/fix/proc-default-value-selector
Correctly provide completions for proc default args that are a selector expr
-rw-r--r--src/server/completion.odin2
-rw-r--r--tests/completions_test.odin20
2 files changed, 22 insertions, 0 deletions
diff --git a/src/server/completion.odin b/src/server/completion.odin
index f1bd9a8..f3c0d56 100644
--- a/src/server/completion.odin
+++ b/src/server/completion.odin
@@ -1535,6 +1535,8 @@ get_implicit_completion :: proc(
if type == nil {
if comp_lit, ok := arg_type.default_value.derived.(^ast.Comp_Lit); ok {
type = comp_lit.type
+ } else if selector, ok := arg_type.default_value.derived.(^ast.Selector_Expr); ok {
+ type = selector.expr
}
}
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index 7b12828..a4e8ab0 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -4846,3 +4846,23 @@ ast_completion_fixed_array_enum :: proc(t: ^testing.T) {
}
test.expect_completion_docs(t, &source, "", {"A", "B", "C"})
}
+
+@(test)
+ast_completion_proc_enum_default_value :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo :: enum {
+ A,
+ B,
+ C,
+ }
+
+ bar :: proc(foo := Foo.A) {}
+
+ main :: proc() {
+ bar(.{*})
+ }
+ `,
+ }
+ test.expect_completion_docs(t, &source, "", {"A", "B", "C"})
+}