How to switch text case in visual studio code
How does one switch the case of highlighted text in Visual Studio Code? VS allows this via CTRL+SHIFT+U and CTRL+U.
Is there a command binding that I can set up to do this, or is it by default some other key combination?
Echoing justanotherdev's comment:
Mind-blowing and useful:
- Command Palette:
CTRL
+SHIFT
+p
(Mac:CMD
+SHIFT
+p
) - type
>transform
pick upper/lower case and press enter
I've written a Visual Studio Code extension for changing case (not only upper case, many other options): https://github.com/wmaurer/vscode-change-case
To map the upper case command to a keybinding (e.g. Ctrl+T U), click File -> Preferences -> Keyboard shortcuts, and insert the following into the json config:
{
"key": "ctrl+t u",
"command": "extension.changeCase.upper",
"when": "editorTextFocus"
}
EDIT:
With the November 2016 (release notes) update of VSCode, there is built-in support for converting to upper case and lower case via the commands editor.action.transformToUppercase
and editor.action.transformToLowercase
. These don't have default keybindings.
The change-case extension is still useful for other text transformations, e.g. camelCase, PascalCase, snake-case, etc.