-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Auto completing deletes character cursor is currently on. #5761
Comments
Might be helpful to post a relevant snippet of your log with when running |
I think this could be resolved by #1819 |
Try setting idle-timeout to a low but more reasonable value like 100 (still way below human reaction time). An idle timeout of 0 is known to cause issues. Although I also think that #1819 might be the real fix to this problem |
2023-02-01.17-46-06.mp4
didn't help |
Thanks for testing. That's a bit odd I will try to reproduce this locally. These bugs are very hard to reproduce usually but given that you seem to be able to do it reliably (no matter the idle timeout) then maybe I can reproduce this |
empty log file. |
Did you try executing the auto-complete action with logs enabled? The log shouldn't be empty if the LSP is working. |
I have managed to confirm this is an upstream issue with rust-analyzer. RA seems to always send a range that starts one character too early when completing a macro arg when no text has been typed yet. Minimal reproducible example: macro_rules! foo {
($val:expr $(,)?) => {
$val
};
}
fn main(){
foo!(); // buggy
foo!(b); // ok
} Place the curosor between the brackets of the first Interestingly enough this bug is quite noticeable in helix because helix triggers completion on trigger chars (the |
Ah it seems that RA prevents showing many completions when the trigger character is a We currently don't send the trigger character. I think there is actually a lot of room to improve the way helix handles trigger characters. From the LSP spec it actually sounds like the client should treat any word character as a completion trigger too (which is what vscode does):
I know @archseer doesn't like completions popping up instantly so instead of changing the default here we could simply add a config option for that. I believe this is also the correct fix for #5054, #2027 and #2581. VSCode actually does no "on idle" completions at all, it just has these additional trigger chars. So for people that want fast completions that seems like a much better approach (especially because it requires one redraw less and doesn't break other idle timeout related things) . This bug is orthogonal to that and should be fixed upstream but these might be nice improvements for helix regardless. |
Upstream PR submitted: rust-lang/rust-analyzer#14247 |
This happened to me yesterday (for the first time), using the Hx 22.12 |
1 similar comment
This happened to me yesterday (for the first time), using the Hx 22.12 |
The upstream PR fixes this issue has been merged. To fix the issue you can build rust analyzer from source for now. The fix will be includes with the next RA release on Monday |
This is still happening to me on ra 1.68.1 2023-03-23.23-34-39.mp4 |
Moved my RA version to nightly. It works now. |
Summary
A video is better at explaining it:
2023-01-31.19-09-38.mp4
Reproduction Steps
Open a rust project.
In main create a local variable then do:
type:
dbg!(
Then try and autofill the local variable
The opening parenthesis should disappear.
Helix log
No log gets outputted when this issue occurs.
My config:
The text was updated successfully, but these errors were encountered: