-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
feat: add onBackspace listener #16694
Conversation
{ | ||
"command": "rust-analyzer.onBackspace", | ||
"key": "backspace", | ||
"when": "config.rust-analyzer.enableBackspaceListener && editorTextFocus && editorLangId == rust" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, so we could have made onEnter
configurable? 🤯.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe 😄
CI / TypeScript failed at Run npm run format:check, but it passed in my local, am I missing something? |
This seems in no way Rust-specific? 😕 I.e. it could just be its own extension (maybe it even already exists)? |
yeah it's not rust-specific, much more a editor level feature. |
There's also an open issue in VSCode for this: microsoft/vscode#42785 which links an extension that seems to do what you want: https://marketplace.visualstudio.com/items?itemName=jasonlhy.hungry-delete |
I agree with flodiebold here, we shouldn't add non specific rust things to r-a. Our extension isn't meant to be a general purpose extension. |
Explain
This is one of my favorite IntelliJ detailed feature. When the user is on a line with only characters for indentation (spaces or tabs) , pressing the Backspace key deletes the entire line(and if user select a range and press Backspace, it just delete the selected range) and comes to the end of the previous line, user don't need to press Backspace many times to delete all the indentation, which improve development experience a lot.
Implementation
It's relatively simple, implemented only in client's TS code, I also expose a config("rust-analyzer.enableBackspaceListener") to turn off it in case someone don't like it.
Demo