aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-12-23 12:52:34 +1100
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-12-23 12:52:34 +1100
commit65ccfcfb613513e404f37d344943a0b4e1bbe66d (patch)
tree6da0f246d060d31aecbb61945db8d0e614cc503d
parent3fae1fa52ceee347940eabd8cbca0e2c7edec036 (diff)
Fix completions for implicit selector proc args with default values
-rw-r--r--src/server/completion.odin2
-rw-r--r--tests/completions_test.odin22
2 files changed, 24 insertions, 0 deletions
diff --git a/src/server/completion.odin b/src/server/completion.odin
index 282b7d7..d80e451 100644
--- a/src/server/completion.odin
+++ b/src/server/completion.odin
@@ -1435,6 +1435,8 @@ get_implicit_completion :: proc(
type = comp_lit.type
} else if selector, ok := arg_type.default_value.derived.(^ast.Selector_Expr); ok {
type = selector.expr
+ } else {
+ type = arg_type.default_value
}
}
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index 1883032..3c34603 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -5216,3 +5216,25 @@ ast_completion_implicit_selector_binary_expr_proc_call :: proc(t: ^testing.T) {
}
test.expect_completion_labels(t, &source, "", {"A", "B", "C"}, {"X", "Y"})
}
+
+@(test)
+ast_completion_proc_arg_default_enum_alias :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo :: enum {
+ A,
+ B,
+ }
+
+ Bar :: Foo.A
+
+ foo :: proc(f := Bar) {}
+
+ main :: proc() {
+ foo(.{*})
+ }
+
+ `,
+ }
+ test.expect_completion_docs(t, &source, "", {"A", "B"})
+}