castwide / solargraph

A Ruby language server.
https://solargraph.org
MIT License
1.87k stars 154 forks source link

Complete global methods from a file inside modules/classes #714

Open lekemula opened 1 month ago

lekemula commented 1 month ago

Hi,

I noticed this issue while trying to make the "normal ruby" method completion work for RSpec context blocks initially in https://github.com/lekemula/solargraph-rspec. Even though I ultimately ended up with a different solution, I thought to still port this change as it's still a valid ruby code, albeit a rare case in real life (?).

# thing.rb
def some_method;end

class Thing
  def foo
    some_
    #   ^ this does not work
  end
end