Open YaLTeR opened 3 years ago
Hmm, why don't I have this Extend selection command?
Try alt+shift+left/right arrow.
Oh, that's my cursorColumnSelectRight
. Do you know why it doesn't show up in the command list?
I think its not a rust-analyzer only command, but a generic one?
but the multi-line one didn't.
I believe this is sadly vs-codes build-in extend selection logic kicking in :( They produce a union of semantic selections from server and naive selections from the editor. would be good to prepare a minimal repro here, and open an issuer at the vscode repo.
Interestingly enough, I wrote a small test for this and this is the output that passes.
#[test]
fn extend_selection_call_multiline() {
do_check(
r#"
fn main() {
f$0.call(
);
}"#,
&["f", "f.call(\n \n )", "f.call(\n \n );"],
);
}
But if I expand cursor through vscode multiple times myself for the given snippet I get this additional f.call(
selection after the f
selection 🤔
Ah that would explain it if vscode does some stuff as well 😕
Filed #7454 for the feature name.
I think setting the VSCode option editor.smartSelect.selectLeadingAndTrailingWhitespace
to false fixes this.
That indeed fixes it. At this point we should keep a list of VSCode settings that cause issues with user experience 😅
We could at least note it in the manual section for the feature.
Say I have code like this:
I'd like to wrap all calls in some other call. I set up multiple cursors like so:
Then I hit extend selection:
Note how single-line statements got fully selected up to
;
, but the multi-line one didn't. In fact, it requires one more extend selection:But now the single-line statements have
;
selected, too. All this means I have to first deal with single-line statements, and then, separately, with multi-line statements. It would be nice if the behavior was unified.