-
Notifications
You must be signed in to change notification settings - Fork 196
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
Go to Definition/Find References functionality doesn't work when cursor is at end of symbol #1038
Comments
@jaminthorns The issue is with elixir standard library. Since v0.15.0 we use
|
Ah yeah, I see that it's very explicitly documented here: I think this makes intuitive sense when we think of the current position as being at a column (as If we think of the position as being at a column (denoted by a cell):
Then it doesn't really make sense to consider either of the neighboring tokens as "at the current position", since there's a token on either side of that column. But, if we think of the current position as between 2 columns (denoted by a cursor):
Then I would argue that we should should consider the left-neighboring symbol as "at the current position". In Elixir, you can't ever have 2 tokens directly next to each other, so there will never be any ambiguity as to which symbol is "under the cursor". Other language servers take this view, and so did ElixirLS until v0.15.0. So, I don't think there's necessarily an issue with I haven't actually looked at the current code, but if it's something like this: %{context: context} = Code.Fragment.surround_context(code, {line, column}) Then maybe it should be changed to something like this: %{context: context} =
with :none <- Code.Fragment.surround_context(code, {line, column}) do
Code.Fragment.surround_context(line, {line, column - 1})
end |
Fixed upstream elixir-lang/elixir@a65dae9 and released in elixir 1.15.1. I don't plan to workaround that for lower versions |
Elixir fix has been reverted. See elixir-lang/elixir#13150 for details. We would need a workaround similar to what is proposed in #1038 to make it more sane. But it needs to be more robust and handle cases from #1027 |
…end of symbol (elixir-lsp#1038) Co-authored-by: Cocoa <[email protected]>
…end of symbol (elixir-lsp#1038) Co-authored-by: Cocoa <[email protected]>
…end of symbol (elixir-lsp#1038) Co-authored-by: Cocoa <[email protected]>
I'm not sure if this is an issue with the VS Code extension or core ElixirLS, but since it's related to cursor positioning, I opted to report it here.
The issue is that when the cursor is positioned at the very end of a symbol, Go to Definition/Find References functionality doesn't work. Here's a video illustrating the issue:
Screen.Recording.2023-06-28.at.3.15.22.PM.mov
Environment
Elixir & Erlang versions (elixir --version):
VSCode ElixirLS version:
0.15.1
Operating System Version:
darwin 22.5.0
The text was updated successfully, but these errors were encountered: