Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String inference not working sporadically #679

Open
alexrecuenco opened this issue Aug 24, 2023 · 1 comment
Open

String inference not working sporadically #679

alexrecuenco opened this issue Aug 24, 2023 · 1 comment

Comments

@alexrecuenco
Copy link

alexrecuenco commented Aug 24, 2023

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.

@alexrecuenco
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant