Convert symbol names between different naming conventions.
This is a port of string-inflection for Emacs.
- Visual Studio Marketplace: https://marketplace.visualstudio.com/items?itemName=knu.word-inflection
- Open VSX: https://open-vsx.org/extension/knu/word-inflection
Convert the word at cursor (or selected text) between the following naming conventions:
snake_caseSCREAMING_SNAKE_CASE(a.k.a.UPPER_SNAKE_CASE)PascalCase(a.k.a.UpperCamelCase)camelCase(a.k.a.lowerCamelCase)kebab-case(a.k.a.lisp-case)Capital_Snake_Case
Unicode letters are supported in case conversions and detection.
Additional capabilities:
- Cycle through language-specific naming conventions
- Directly convert to a specific naming convention
- Transform word parts (subwords) based on VS Code's word-part navigation
Language-specific cycling through common naming conventions:
| Command | Cycle |
|---|---|
Word Inflection: Cycle (All Styles) |
foo_bar → FOO_BAR → FooBar → fooBar → foo-bar → Foo_Bar → foo_bar |
Word Inflection: Cycle (Ruby Style) |
foo_bar → FOO_BAR → FooBar → foo_bar |
Word Inflection: Cycle (Python Style) |
foo_bar → FOO_BAR → FooBar → foo_bar |
Word Inflection: Cycle (Elixir Style) |
foo_bar → FooBar → foo_bar |
Word Inflection: Cycle (Java Style) |
fooBar → FOO_BAR → FooBar → fooBar |
Word Inflection: Cycle (snake_case ⇔ kebab-case) |
foo_bar ⇔ foo-bar |
Word Inflection: Cycle (PascalCase ⇔ camelCase) |
FooBar ⇔ fooBar |
Convert directly to a specific naming convention:
Word Inflection: To snake_caseWord Inflection: To SCREAMING_SNAKE_CASEWord Inflection: To PascalCaseWord Inflection: To camelCaseWord Inflection: To kebab-caseWord Inflection: To Capital_Snake_Case
Word Inflection: Toggle- Toggles betweensnake_case↔PascalCase↔camelCase
Transform word parts (subwords). These commands follow VS Code's WordPart navigation behavior (via cursorWordPartRight/cursorWordPartRightSelect). They also search forward when the cursor is not on a word part and move to the end of the transformed part, matching Emacs subword-capitalize, subword-upcase, and subword-downcase.
Word Inflection: Word Part Capitalize- Capitalize the word part (e.g.,NICE|Symbol→Nice|Symbol)Word Inflection: Word Part Upcase- Upcase the word part (e.g.,nice|Symbol→NICE|Symbol)Word Inflection: Word Part Downcase- Downcase the word part (e.g.,NICE|Symbol→nice|Symbol)
The cursor moves to the end of the word part after transformation.
- Place the cursor on a symbol name, or select text
- Open the Command Palette (
Cmd+Shift+P/Ctrl+Shift+P) - Type "Word Inflection" and select the desired command
Add these to your keybindings.json for quick access:
{
"key": "ctrl+shift+u",
"command": "stringInflection.cycle",
"when": "editorTextFocus"
}MIT
This extension is a port of string-inflection by akicho8.