diff options
| author | Bradley Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-11-02 17:06:09 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-02 17:06:09 -0500 |
| commit | ff012d06212e524aee21933b484df1d3c4e5e1e2 (patch) | |
| tree | 526a94de83489d353ef5de63d1493558975fcfcd /src/server/completion.odin | |
| parent | 5163a1a307b920b5ba4bc26131536f97546c7052 (diff) | |
| parent | 04647bdf1f7fc80b0f2ccdc36a171c1dadb16a7e (diff) | |
Merge pull request #1146 from BradLewis/feat/selector-completion-improvements
Feat/selector completion improvements
Diffstat (limited to 'src/server/completion.odin')
| -rw-r--r-- | src/server/completion.odin | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/server/completion.odin b/src/server/completion.odin index f3c0d56..ae14d4e 100644 --- a/src/server/completion.odin +++ b/src/server/completion.odin @@ -98,6 +98,8 @@ get_completion_list :: proc( if !position_in_node(selector_call.call, position_context.position) { completion_type = .Selector } + } else if selector, ok := position_context.selector_expr.derived.(^ast.Selector_Expr); ok { + completion_type = .Selector } } else if _, ok := position_context.selector.derived.(^ast.Implicit_Selector_Expr); !ok { // variadic args seem to work by setting it as an implicit selector expr, in that case @@ -1017,23 +1019,18 @@ get_selector_completion :: proc( if symbol, ok := resolve_type_expression(ast_context, v.types[i]); ok { if expr, ok := position_context.selector.derived.(^ast.Selector_Expr); ok { - if expr.op.text == "->" && symbol.type != .Function { - continue - } - } - - if position_context.arrow { - if symbol.type != .Function && symbol.type != .Type_Function { - continue - } - if .ObjCIsClassMethod in symbol.flags { - assert(.ObjC in symbol.flags) + if expr.op.kind == .Arrow_Right { + if symbol.type != .Function && symbol.type != .Type_Function { + continue + } + if .ObjCIsClassMethod in symbol.flags { + assert(.ObjC in symbol.flags) + continue + } + } else if .ObjC in selector.flags { continue } } - if !position_context.arrow && .ObjC in selector.flags { - continue - } construct_struct_field_symbol(&symbol, selector.name, v, i) append(results, CompletionResult{symbol = symbol}) |