rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

feat: add onBackspace listener

Open Young-Flash opened this issue 1 year ago • 5 comments

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

Young-Flash avatar Feb 27 '24 10:02 Young-Flash

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

image

Young-Flash avatar Feb 27 '24 11:02 Young-Flash

Dunno, works for me:

image

There's also this:

NOTE: run cargo test locally and commit the updated files

lnicola avatar Feb 27 '24 11:02 lnicola

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

flodiebold avatar Feb 27 '24 12:02 flodiebold

This seems in no way Rust-specific?

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

Young-Flash avatar Feb 27 '24 12:02 Young-Flash

There's also an open issue in VSCode for this: https://github.com/microsoft/vscode/issues/42785 which links an extension that seems to do what you want: https://marketplace.visualstudio.com/items?itemName=jasonlhy.hungry-delete

flodiebold avatar Feb 27 '24 15:02 flodiebold

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 avatar Mar 05 '24 08:03 Veykril