Make selected block of text uppercase

Warren  P picture Warren P · Feb 3, 2016 · Viewed 165.8k times · Source

Can I make a multi-line selection of text all capitals in Visual Studio Code?

In full Visual Studio it's CTRL+SHIFT+U to do this.

The extension that exists that I have seen only do non-multi-line blocks.

Answer

Sunil Purushothaman picture Sunil Purushothaman · Jan 17, 2017

The question is about how to make CTRL+SHIFT+U work in Visual Studio Code. Here is how to do it. (Version 1.8.1 or above).

File-> Preferences -> Keyboard Shortcuts.

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.