Toggle case of the selected string:
- Ctrl+; Linux
- ⌘+; MacOS
in the following order:
- nocase -> camelCase
- camelCase -> snake_case
- snake_case -> kebab-case
- kebab-case -> camelCase
If you wish to overwrite the default shortcut, search for editor.togglecase
.
- Works with multi-select and multiple carets
- Per
languageId
customization
Only setting present (and configurable for different languages) is regexp of characters that can occur as second and second last in the variable name.
togglecase.pattern
:"[0-9]|[a-z]|[A-Z]|_|-"
with the following defaults:
- lowercase
a-z
letters - uppercase
A-Z
letters - digits
0-9
- hyphen
-
- underscore
_
Letters come from the english alphabet.
Custom per-language configuration - let's assume that you're crazy enough to
use $
inside your variable names, for example btc_$_price
(please don't).
In that case, you could extend the default RegExp with an additional |\$
:
"configurationDefaults": {
"[javascript]": {
"togglecase.pattern": "[0-9]|[a-z]|[A-Z]|_|-|\$"
}
It might be useful for some other languages, hence it's configurable.
Toggle works only when caret is at least on the third-last character of the targeted variable.
In the examples below, the |
represents current carret(s).
{
"first_nam|e": "Jon",
"last_nam|e": "Doe",
"user_nam|e": "jondoe",
"phone_numbe|r": "555666777"
}
{
"first_na|me": "Jon",
"last_na|me": "Doe",
"user_na|me": "jondoe",
"phone_numb|er": "555666777"
}
Fix for this behavior is welcome.