diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-15 13:30:03 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-15 13:30:03 -0400 |
| commit | 428b54c588ba00c84b60ed5d24cec1b264fa5589 (patch) | |
| tree | 5c346c925af49394590f191f8b1c58a167971205 /src/server/analysis.odin | |
| parent | 156d75278e86764f3754c68121f4ed347e167a8b (diff) | |
Correctly resolve references of proc parameter names
Diffstat (limited to 'src/server/analysis.odin')
| -rw-r--r-- | src/server/analysis.odin | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 182aed2..e3e1f6d 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -2213,6 +2213,25 @@ resolve_location_identifier :: proc(ast_context: ^AstContext, node: ast.Ident) - return {}, false } +resolve_location_proc_param_name :: proc( + ast_context: ^AstContext, + position_context: ^DocumentPositionContext, +) -> ( + symbol: Symbol, + ok: bool, +) { + ident := position_context.field_value.field.derived.(^ast.Ident) or_return + call := position_context.call.derived.(^ast.Call_Expr) or_return + symbol = resolve_type_expression(ast_context, call) or_return + + if value, ok := symbol.value.(SymbolProcedureValue); ok { + if arg_name, ok := get_proc_arg_name_from_name(value, ident.name); ok { + symbol.range = common.get_token_range(arg_name, ast_context.file.src) + } + } + return symbol, true +} + resolve_location_comp_lit_field :: proc( ast_context: ^AstContext, position_context: ^DocumentPositionContext, |