-
Notifications
You must be signed in to change notification settings - Fork 221
fix: make goto def/refs work when cursor is at end of symbol (#1038) #1087
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
fix: make goto def/refs work when cursor is at end of symbol (#1038) #1087
Conversation
...end of symbol (elixir-lsp#1038) Co-authored-by: Cocoa <i@uwucocoa.moe>
There are other places where NormalizedCode.Fragment.surround_context
is used (hover provider, implementations provider) that would require a similar change. How about wrapping that function and applying the fallback logic once instead of in each provider?
Hi @lukaszsamson, we've wrapped NormalizedCode.Fragment.surround_context
but not quite sure which module would be the best one to accommodate it...
We temporarily placed it in ElixirLS.LanguageServer.AstUtils.surround_context_with_fallback
. Could you advise where would be the most appropriate module for it? Also we're happy to change its name if surround_context_with_fallback
doesn't sound good to describe this behaviour.
Other than that, we were also writing some tests for this PR but we had some issue when testing it using mix test
. It works as intended in vscode but not in the unit test. We'll be looking into this later today or tomorrow but please let us know if you happen to have any idea why it works in vscode but not in the tests 😃
How about CodeFragmentUtils
?
This PR addresses issue #1038.
This pull request presents a fairly basic approach that relies on retrying with the character to the left of the original one if the first attempt to retrieve definitions/references fails.
Additionally, this PR considers the scenario highlighted in issue #1027, where if the cursor is positioned on the
.
right to a symbol, it references the function instead of the module. With the changes in this PR, it will reference the module instead.Below is a video demonstrating the resolution of the issues specified in issue #1027.
output.mp4