diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/analysis.odin | 15 | ||||
| -rw-r--r-- | src/server/completion.odin | 5 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 170bf37..0c3178a 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -659,6 +659,21 @@ get_procedure_arg_count :: proc(v: SymbolProcedureValue) -> int { return total } +// Gets the call argument type at the specified index +get_proc_call_argument_type :: proc(value: SymbolProcedureValue, parameter_index: int) -> (^ast.Field, bool) { + index := 0 + for arg in value.arg_types { + for name in arg.names { + if index == parameter_index { + return arg, true + } + index += 1 + } + } + + return nil, false +} + /* Figure out which function the call expression is using out of the list from proc group */ diff --git a/src/server/completion.odin b/src/server/completion.odin index 2abf3b2..1381967 100644 --- a/src/server/completion.odin +++ b/src/server/completion.odin @@ -1171,11 +1171,12 @@ get_implicit_completion :: proc( } if proc_value, ok := symbol.value.(SymbolProcedureValue); ok { - if len(proc_value.arg_types) <= parameter_index { + arg_type, arg_type_ok := get_proc_call_argument_type(proc_value, parameter_index) + if !arg_type_ok { return } - if enum_value, ok := unwrap_enum(ast_context, proc_value.arg_types[parameter_index].type); ok { + if enum_value, ok := unwrap_enum(ast_context, arg_type.type); ok { for name in enum_value.names { item := CompletionItem { label = name, |