Skip to content
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

Closed
wants to merge 5 commits into from

Conversation

Young-Flash
Copy link
Member

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

onBackspace-20240226105423-tm39yns

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 27, 2024
editors/code/package.json Outdated Show resolved Hide resolved
{
"command": "rust-analyzer.onBackspace",
"key": "backspace",
"when": "config.rust-analyzer.enableBackspaceListener && editorTextFocus && editorLangId == rust"
Copy link
Member

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? 🤯.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe 😄

editors/code/package.json Outdated Show resolved Hide resolved
@Young-Flash
Copy link
Member Author

CI / TypeScript failed at Run npm run format:check, but it passed in my local, am I missing something?

image

@lnicola
Copy link
Member

lnicola commented Feb 27, 2024

Dunno, works for me:

image

There's also this:

NOTE: run cargo test locally and commit the updated files

@flodiebold
Copy link
Member

flodiebold commented Feb 27, 2024

This seems in no way Rust-specific? 😕 I.e. it could just be its own extension (maybe it even already exists)?

@Young-Flash
Copy link
Member Author

This seems in no way Rust-specific?

yeah it's not rust-specific, much more a editor level feature.

@flodiebold
Copy link
Member

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

@Veykril
Copy link
Member

Veykril commented Mar 5, 2024

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.

@Veykril Veykril closed this Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants