aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-11 15:17:14 -0400
committerGitHub <noreply@github.com>2025-08-11 15:17:14 -0400
commit3d1b2d482f9c1e0ddb0c3acf2890724f36b51643 (patch)
tree6a00446bb53532ddc93c743d3245a51caabd2397 /src/server
parent90a41ff247b050228e1a6e1a9fe0486948ca6b9e (diff)
parent005d12ec46a5b3e2574133eb913bacd7b34e7383 (diff)
Merge pull request #845 from BradLewis/feat/add-completion-default-value-proc-params
Add completions for proc params with default values
Diffstat (limited to 'src/server')
-rw-r--r--src/server/completion.odin25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/server/completion.odin b/src/server/completion.odin
index 25018df..9430235 100644
--- a/src/server/completion.odin
+++ b/src/server/completion.odin
@@ -1335,6 +1335,31 @@ get_identifier_completion :: proc(
matcher := common.make_fuzzy_matcher(lookup_name)
+ if position_context.call != nil {
+ if call_symbol, ok := resolve_type_expression(ast_context, position_context.call); ok {
+ if value, ok := call_symbol.value.(SymbolProcedureValue); ok {
+ for arg in value.orig_arg_types {
+ // For now we just add params with default values, could add everything we more logic in the future
+ if arg.default_value != nil {
+ for name in arg.names {
+ if ident, ok := name.derived.(^ast.Ident); ok {
+ if symbol, ok := resolve_type_expression(ast_context, arg.default_value); ok {
+ if score, ok := common.fuzzy_match(matcher, ident.name); ok == 1 {
+ symbol.type_name = symbol.name
+ symbol.type_pkg = symbol.pkg
+ symbol.name = clean_ident(ident.name)
+ symbol.type = .Field
+ append(results, CompletionResult{score = score * 1.1, symbol = symbol})
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
global: for k, v in ast_context.globals {
if position_context.global_lhs_stmt {
break