Can I make a multi-line selection of text all capitals in Visual Studio Code?
In Visual Studio it's Ctrl+Shift+U to do this.
The desire here is to have the same key binding that works in Visual Studio, also be the same in Visual Studio Code.
Note: When originally asked this question was really about finding the way to open the preferences for Visual Studio Code and to edit its shortcut key bindings, the answer below has an update showing the modern way its done in Visual Studio Code with a full graphical user interface for assigning a desired shortcut that the user is familiar with to an operation, like making text uppercase .
The question is about how to make CTRL+SHIFT+U work in Visual Studio Code. To open the Visual Studio Code Preferences UI to see and update keyboard shortcuts, hit Control+Shift+P and type Keyboard Shortcuts to search for the keyboard shortcuts preferences, or find it in the pulldown menus:
File-> Preferences -> Keyboard Shortcuts.
Once keyboard shortcuts are open, proceed as follows:
Find "Transform to Uppercase":
Click the +
icon.
In the popup, press the desired key combination and hit enter:
Do the same for lower case, if desired.
If the keybinding is already assigned, you will see what ever keyboard shortcut is assigned in the Keyboard Shortcuts when they are open:
----
Original answer for Versions of Visual Studio Code from about 2016-2017:
Open Visual Studio Code.
Press CTRL+SHIFT+P.
Type
open keyboard shortcuts
Select
Open keyboard shortcuts (json)
An editor will appear with keybindings.json file. Place the following JSON in there and save:
[
{
"key": "ctrl+shift+u",
"command": "editor.action.transformToUppercase",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+l",
"command": "editor.action.transformToLowercase",
"when": "editorTextFocus"
}
]
Now CTRL+SHIFT+U will capitalise selected text, even if multi line. In the same way, CTRL+SHIFT+L will make selected text lowercase.
These commands are built into VS Code and no extensions are required to make them work.
In the new versions (eg 1.57.x) of VS Code, Ctrl+Shift+L is a shortcut for bulk selecting all selected text occurrences. So you can use another combination, like Ctrl+Shift+/ etc.