castwide/solargraph

String inference not working sporadically

alexrecuenco opened this issue · 1 comments

I was trying solargraph, and although on hover it tells me that x is a string, it is not providing method inference, however if I do b.x it does provide it

I tried in https://solargraph.org/demo

# This editor uses solargraph-rails to provide Ruby code completion.
# Code suggestions include the core Ruby library, local class and variable
# definitions, and hints from YARD documentation.
# Hit ctrl+space anywhere in code to get context-aware suggestions.

# Try entering `str.` and hitting ctrl+space to see String instance methods.

class A
  def x
    "-> { 3 }"
  end
end

b = A.new
x = b.x
b.x.ascii_only? # <-- provides type inference for b.x
x.#<ctrl+space> #... <-- doesn't provide inference of possible options for x (

Thank you for your time, I couldn't find any similar issue.

I tried later to change the x variable name to d and the inference was working again... I don't know what is going on