microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.73k stars 29.09k forks source link

New "Smart Selection" keybindings seem to conflict with older existing bindings #74938

Closed ZaLiTHkA closed 5 years ago

ZaLiTHkA commented 5 years ago

Issue Type: Bug

Note: I'm on Windows 10, not sure if this behaviour is the same on other platforms.

I noticed the new "smart selection" feature while looking through the release notes for 1.35.0. Every time I tried Alt + Shift + LeftArrow or Alt + Shift + RightArrow, I got the exact same behaviour as using Ctrl in place of Alt. The new Ctrl + Shift + Space shortcut does indeed work as described.

Looking through my keyboard shortcuts list, I noticed that the cursorWordStartSelect and cursorWordEndSelect commands were assigned twice, once each with the Ctrl + Shift and Alt + Shift combination.

In order to get the new Shrink Selection and Grow Selection commands to actuall work was to manually remove the duplicate bindings.


I haven't tried this with a fresh install of VSCode, so is this something that comes from the internal default keybindings, or could it be something that was added at some point either manually or by an extension?

VS Code version: Code 1.35.0 (553cfb2c2205db5f15f3ee8395bbd5cf066d357d, 2019-06-04T01:17:12.481Z) OS version: Windows_NT x64 10.0.17134

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 x 3592)| |GPU Status|2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.90GB (10.19GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
Extensions (21) Extension|Author (truncated)|Version ---|---|--- better-toml|bun|0.3.2 npm-intellisense|chr|1.3.0 bracket-pair-colorizer|Coe|1.0.61 jshint|dba|0.10.20 vscode-eslint|dba|1.9.0 gitlens|eam|9.8.1 EditorConfig|Edi|0.13.0 vsc-material-theme|Equ|2.9.0 auto-rename-tag|for|0.1.0 gc-excelviewer|Gra|2.1.32 Angular-BeastCode|Mik|8.0.7 sublime-keybindings|ms-|4.0.0 vscode-typescript-tslint-plugin|ms-|1.1.0 vscode-jsp|pth|0.0.2 code-settings-sync|Sha|3.2.9 vscode-autohotkey|sle|0.2.2 code-spell-checker|str|1.7.16 nativescript|Tel|0.10.1 vscode-icons|vsc|8.7.0 vscode-todo-highlight|way|1.0.4 markdown-all-in-one|yzh|2.3.1
vscodebot[bot] commented 5 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

ZaLiTHkA commented 5 years ago

With regards to the bot's question: for me, Ctrl + Alt + UpArrow / DownArrow and Shift + Alt + UpArrow / DownArrow both simply add a new cursor in the chosen direction. So while that's not the same issue as what I'm experiencing, it is another set of duplicated keyboard shortcut bindings.

ZaLiTHkA commented 5 years ago

Apologies for the comment spamming, but looking through my keyboard shortcut bindings, I actually have tons of duplicate bindings in the list...

I could uninstall, remove user configuration files and start from a completely fresh installation, but since that's only a potential one-time fix, surely it would make more sense to cater for this during the upgrade process?

egamma commented 5 years ago

Not clear what you are asking for? Since you customized the keybindings it is on you to manage your customizations when VS Code introduces new key bindings.

ZaLiTHkA commented 5 years ago

Since you customized the keybindings it is on you to manage your customizations when VS Code introduces new key bindings.

That's completely fair and I completely agree with that.. Except for one small point, other than removing the "incorrect" or "old" bindings that prevented these smart selection bindings from working, I've never changed any of the others myself.

It is possible that plugins I've installed and then removed in the past might have added or changed some of these bindings, but I honestly can't tell if that is the case.

At the end of the day, I suppose this is probably just another "let's find a way to handle duplicate keybindings" threads, of which there are so many already.


Is there a way to clear out my current keybindings and have VSCode regenerate the list from it's internal defaults? Then at least I could work out if this is actually a problem that exists in the IDE or something from my current environment configuration.

ZaLiTHkA commented 5 years ago

Ok, I just found %APPDATA%\Code\User\keybindings.json, which included entries for the cursorWordEndRightSelect and cursorWordStartLeftSelect, but after removing this file and restarting VSCode, I still have the following two entries in my keyboard shortcuts list:

..and the smart selection shortcut is again not working.

edit: scratch that, the entries I found in that file contained the commands "-cursorWordEndRightSelect" and "-cursorWordStartLeftSelect", which were from my removing the unwanted internal keyboard bindings. the remainder of this comment is still applicable.


With regards to the following screenshot:

image

Is there any special need for the Alt variations of these entries? By the "Source" column on the right, I'm assuming these come from VSCode's own settings. Am I understanding this correctly?

egamma commented 5 years ago

Is there a way to clear out my current keybindings and have VSCode regenerate the list from it's internal defaults?

ZaLiTHkA commented 5 years ago

Thanks @egamma, that's effectively what I found in my %APPDATA%\Code\User\keybindings.json file.

I did a bit more digging this morning though, in which I discovered that the shortcuts I found to conflict with the VSCode defaults actually come from the "Sublime Text Keymap and Settings Importer" plugin.


When I switched over from Sublime to VSCode, I thought that plugin would help ease the transition, and perhaps it has, but now it's just more trouble than it's worth. Removing that has resolved all the issues I was talking about here.

egamma commented 5 years ago

@ZaLiTHkA this is a good finding, please report an issue against the Sublime Keybinding extension.