-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Code.Fragment.surround_context does not match when cursor is on end of alias #13150
Comments
The question is: when the alias finishes and when the dot starts? I am pretty sure I checked how intellisense/mouse over works in editors at the time and, if you had the cursor just before the dot (which is after the alias), then it was considered part of the dot. The commit you linked has a comment about this. So I think we can improve the last two cases. I am not sure that's true for the dot ones. |
I know that it's blurry. I'd say if the cursor is on the left side of the dot then the left side should get the focus. Especially if calling Alternatively, I can workaround this issue by calling |
When I checked, if we adopt the behavior you propose, then midway through the dot is still going to show the alias, and I don’t think that’s accurate. The word Test has four columns, 1 2 3 and 4. I am ok with adding a fifth column if there is nothing meaningful after but I don’t think it should glob the dot. I am almost thinking that reverting the earlier commit may even be better. |
Agreed. Either we make it consistent or bring back the previous behavior. |
The counter argument to reverting is that we should consider opening parens or brackets part of the identifier. So we either revert the behavior for spaces and commas or make aliases consistent in behavior and commas and brackets. |
Elixir and Erlang/OTP versions
Erlang/OTP 26 [erts-14.1.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]
Elixir 1.16.0-rc.0 (d716bc2) (compiled with Erlang/OTP 26)
also on 1.15.7
Operating system
any
Current behavior
When
Code.Fragment.surround_context
is called on elixir alias and the cursor is on the last position it returns inconsistent results leading to confusing behaviour. See original report in elixir-lsp/elixir-ls#1027Here are all cases found by @jaminthorns
Naked alias: all good
Remote call - inconsistent
Capture - inconsistent
Followed by comma - inconsistent
Followed by ) - inconsistent
It seems a65dae9 released in 1.15.1 fixed the problem only in a few cases
Expected behavior
Consistently returning module on last character position
The text was updated successfully, but these errors were encountered: