diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2025-05-17 18:13:34 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2025-05-17 18:13:34 +0200 |
| commit | 07ea39ecdcf02dba84c82d90b028055463f6562c (patch) | |
| tree | 871c9659513cc053108b453411af421666b033f7 /src/server/completion.odin | |
| parent | 89f83305019a70d714af015aec734700dfee967c (diff) | |
Fixed issue with magic completion in call expressions.
Diffstat (limited to 'src/server/completion.odin')
| -rw-r--r-- | src/server/completion.odin | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/server/completion.odin b/src/server/completion.odin index 7383785..8d61e3e 100644 --- a/src/server/completion.odin +++ b/src/server/completion.odin @@ -1831,12 +1831,22 @@ append_magic_map_completion :: proc( get_expression_string_from_position_context :: proc(position_context: ^DocumentPositionContext) -> string { src := position_context.file.src if position_context.call != nil { - return src[position_context.call.pos.offset:position_context.call.end.offset] - } else if position_context.field != nil { + if call_expr, ok := position_context.call.derived.(^ast.Call_Expr); ok { + if position_in_node(call_expr.expr, position_context.position) { + return src[position_context.call.pos.offset:position_context.call.end.offset] + } + } + + } + + if position_context.field != nil { return src[position_context.field.pos.offset:position_context.field.end.offset] - } else if position_context.selector != nil { + } + + if position_context.selector != nil { return src[position_context.selector.pos.offset:position_context.selector.end.offset] } + return "" } |