Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
shinohara-rin wants to merge 4 commits into elixir-lsp:master
base: master
Choose a base branch
Loading
from shinohara-rin:sr/fix-def-refs-1038

Conversation

Copy link

@shinohara-rin shinohara-rin commented May 7, 2024

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

Copy link
Collaborator

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?

shinohara-rin reacted with thumbs up emoji

Copy link

cocoa-xu commented May 7, 2024
edited
Loading

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 😃

megalithic reacted with thumbs up emoji

Copy link
Collaborator

How about CodeFragmentUtils?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /