summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/collector.odin4
-rw-r--r--tests/completions_test.odin32
2 files changed, 32 insertions, 4 deletions
diff --git a/src/server/collector.odin b/src/server/collector.odin
index dc7e052..37d3cd8 100644
--- a/src/server/collector.odin
+++ b/src/server/collector.odin
@@ -486,7 +486,6 @@ get_or_create_package :: proc(collection: ^SymbolCollection, pkg_name: string) -
collect_method :: proc(collection: ^SymbolCollection, symbol: Symbol) {
pkg := &collection.packages[symbol.pkg]
- // Skip procedures that are part of proc groups
if symbol.name in pkg.proc_group_members {
return
}
@@ -549,7 +548,6 @@ collect_proc_group_method :: proc(collection: ^SymbolCollection, symbol: Symbol)
continue
}
- // Only add once per distinct method key
if method not_in registered_methods {
registered_methods[method] = true
add_symbol_to_method(collection, pkg, method, symbol)
@@ -580,7 +578,6 @@ get_method_from_first_arg :: proc(
method.pkg = get_index_unique_string(collection, ident.name)
method.name = get_index_unique_string(collection, v.field.name)
case ^ast.Ident:
- // Check if this is a builtin type
if is_builtin_type_name(v.name) {
method.pkg = "$builtin"
} else {
@@ -595,7 +592,6 @@ get_method_from_first_arg :: proc(
}
is_builtin_type_name :: proc(name: string) -> bool {
- // Check all builtin type names from untyped_map
for names in untyped_map {
for builtin_name in names {
if name == builtin_name {
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index f0fa8c1..56553c3 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -5411,6 +5411,38 @@ ast_completion_fake_method_proc_group_only_shows_group :: proc(t: ^testing.T) {
}
@(test)
+ast_completion_fake_method_proc_group_with_only_one_proc :: proc(t: ^testing.T) {
+ // This is to verify that even if a proc group has only one member,
+ // it still shows up as a group and does not show the individual proc.
+ source := test.Source {
+ main = `package test
+ import "methods"
+ main :: proc() {
+ s: methods.My_Struct
+ s.{*}
+ }
+ `,
+ packages = {
+ {
+ pkg = "methods",
+ source = `package methods
+ My_Struct :: struct { x: int }
+
+ do_thing_int :: proc(s: My_Struct, v: int) {}
+ do_thing :: proc { do_thing_int }
+
+ // standalone proc not in a group
+ standalone_method :: proc(s: My_Struct) {}
+ `,
+ },
+ },
+ config = {enable_fake_method = true},
+ }
+
+ test.expect_completion_labels(t, &source, ".", {"do_thing", "standalone_method"}, {"do_thing_int" })
+}
+
+@(test)
ast_completion_fake_method_builtin_type_uses_builtin_pkg :: proc(t: ^testing.T) {
// This test verifies that fake methods for builtin types (int, f32, string, etc.)
// are correctly looked up using "$builtin" as the package, not the package where