Skip to content

Commit

Permalink
Filter out namespace entries from method completion
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock committed Nov 28, 2023
1 parent a91b600 commit 5672fe1
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/ruby_lsp/requests/completion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,11 @@ def on_call_node_enter(node)

receiver = T.must(receiver_entries.first)

candidates = T.cast(
@index.prefix_search(name),
T::Array[T::Array[RubyIndexer::Entry::Member]],
)
candidates.each do |entries|
entry = entries.find { |e| e.owner&.name == receiver.name }
@index.prefix_search(name).each do |entries|
entry = entries.find { |e| e.is_a?(RubyIndexer::Entry::Member) && e.owner&.name == receiver.name }
next unless entry

@_response << build_method_completion(entry, node)
@_response << build_method_completion(T.cast(entry, RubyIndexer::Entry::Member), node)
end
end

Expand Down

0 comments on commit 5672fe1

Please sign in to comment.