aboutsummaryrefslogtreecommitdiff
path: root/src/server/methods.odin
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-12 19:21:26 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-12 19:21:26 -0400
commit8f626259507c4f6534dba4bc863dabbe30cee440 (patch)
tree4381f610bfcf16f965c353e1a7f325a83008cbd2 /src/server/methods.odin
parent5b380814bda90377c003b0174b7ae1dbe5da9f14 (diff)
Add methods for untyped symbols the same as their typed variants
Diffstat (limited to 'src/server/methods.odin')
-rw-r--r--src/server/methods.odin46
1 files changed, 43 insertions, 3 deletions
diff --git a/src/server/methods.odin b/src/server/methods.odin
index 1826ef6..e60b84e 100644
--- a/src/server/methods.odin
+++ b/src/server/methods.odin
@@ -54,16 +54,56 @@ append_method_completion :: proc(
}
remove_edit, ok := create_remove_edit(position_context)
-
if !ok {
return
}
- for k, v in indexer.index.collection.packages {
+ if value, ok := selector_symbol.value.(SymbolUntypedValue); ok {
+ cases := untyped_map[value.type]
+ for c in cases {
+ method := Method {
+ name = c,
+ pkg = selector_symbol.pkg,
+ }
+ collect_methods(
+ ast_context,
+ position_context,
+ method,
+ selector_symbol.pointers,
+ receiver,
+ remove_edit,
+ results,
+ )
+ }
+ } else {
method := Method {
name = selector_symbol.name,
pkg = selector_symbol.pkg,
}
+ collect_methods(
+ ast_context,
+ position_context,
+ method,
+ selector_symbol.pointers,
+ receiver,
+ remove_edit,
+ results,
+ )
+ }
+
+}
+
+@(private = "file")
+collect_methods :: proc(
+ ast_context: ^AstContext,
+ position_context: ^DocumentPositionContext,
+ method: Method,
+ pointers: int,
+ receiver: string,
+ remove_edit: []TextEdit,
+ results: ^[dynamic]CompletionResult,
+) {
+ for k, v in indexer.index.collection.packages {
if symbols, ok := &v.methods[method]; ok {
for &symbol in symbols {
resolve_unresolved_symbol(ast_context, &symbol)
@@ -92,7 +132,7 @@ append_method_completion :: proc(
continue
}
- pointers_to_add := first_arg.pointers - selector_symbol.pointers
+ pointers_to_add := first_arg.pointers - pointers
references := ""
dereferences := ""