diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-10-30 04:16:39 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-10-30 04:16:39 -0400 |
| commit | 09a400ca6c238eada7c101569764c5a475a375d6 (patch) | |
| tree | c2a353eb437528d0475fa040958187c0256ee549 | |
| parent | 7ee9a6fc9647adf493d7e95ac675c0094f11ee4d (diff) | |
Correctly provide completions for proc default args that are a selector expr
| -rw-r--r-- | src/server/completion.odin | 2 | ||||
| -rw-r--r-- | tests/completions_test.odin | 20 |
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"}) +} |