Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Text ToolingNew to Visual Studio Code? Get it now.
Text Tooling

Text Tooling

Stephane Cuillerdier

|
1 install
| (0) | Free
Line and identifier transformations on the current selection
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Text Tooling

Line and identifier transformations on the current selection: sort, dedupe, change case, toggle comments. Each one is a single keystroke.

VS Code License

What this extension does

Text Tooling adds eleven commands that rewrite the text you selected. You can run them three ways:

  • from their keyboard shortcuts
  • from the Text Tooling submenu when you right-click in the editor
  • from the Command Palette (Ctrl+Shift+P), where they are listed under the Text Tooling: prefix

Every command works with multiple cursors and multiple selections: each selection is transformed on its own. The whole operation is a single edit, so one Ctrl+Z undoes it.

Commands

Lines

These commands work on whole lines. A selection that starts or ends in the middle of a line still covers the entire line. With no selection, they use the line under the cursor. If you drag a selection downwards and it ends at column 0 of a line, that last line is not included, because it does not look selected.

Command Shortcut What it does
Sort Lines Ascending Ctrl+Alt+S Sorts the lines from A to Z, using your locale's alphabetical order
Sort Lines Descending Ctrl+Alt+Shift+S Sorts the lines from Z to A
Toggle Sort Lines Ctrl+Alt+O Sorts the lines from A to Z; press again to sort them from Z to A, and so on
Remove Duplicate Lines Ctrl+Alt+D Keeps the first occurrence of each line and leaves the remaining lines in their original order
Comment Duplicate Lines Ctrl+Alt+Shift+D Keeps the first occurrence of each line active and comments out its repetitions, in place
Toggle Line Comment Ctrl+Alt+Q Comments or uncomments the lines (see below)

Toggle Sort Lines picks the direction from the lines themselves: lines already sorted from A to Z are sorted from Z to A, anything else is sorted from A to Z. So it always does the expected thing, even after an undo or with several selections.

Remove Duplicate Lines only removes lines that are identical character for character, including leading and trailing whitespace.

Comment Duplicate Lines compares the lines the same way, but keeps every line where it is: the repetitions are commented out with the language's line comment token, at column 0 like Toggle Line Comment, so they can be reviewed before being deleted. Blank lines are never commented.

Case

These commands work on the selected text. With no selection, they use the word under the cursor.

Command Shortcut Example
To UPPER CASE Ctrl+Alt+U myHttpServer → MYHTTPSERVER
To lower case Ctrl+Alt+L MyHttpServer → myhttpserver
To snake_case Ctrl+Alt+N myHTTPServer → my_http_server
To UPPER_SNAKE_CASE Ctrl+Alt+Shift+N myHttpServer → MY_HTTP_SERVER
To PascalCase Ctrl+Alt+P my_http_server → MyHttpServer
To camelCase Ctrl+Alt+M My-HTTP-Server → myHttpServer

snake_case, UPPER_SNAKE_CASE, PascalCase and camelCase first split the identifier into words, whatever its current style: camelCase, PascalCase, snake_case, kebab-case or space-separated words. Acronyms count as one word, so parseXmlFile becomes parse_xml_file, then ParseXmlFile.

Toggle Line Comment

  • The comment token is inserted at the very start of the line, before the indentation. The indentation itself is not changed, whether it uses tabs or spaces.
  • Blank lines are left as they are.
  • If every non-blank line in the selection is already commented, the lines are uncommented. Otherwise the whole block is commented, including lines that were already commented.
  • Uncommenting also recognizes comments placed after the indentation, such as those written by hand or by another tool. A token in the middle of a line, like the // in a URL, is never removed.

The token depends on the language of the file:

Token Languages
// C, C++, C#, Go, Java, JavaScript, JSON5, PHP, Rust, Swift, TypeScript
# CMake, Dockerfile, Makefile, Perl, PowerShell, Python, R, Ruby, Shell, TOML, YAML
-- Haskell, Lua, SQL
; INI, Lisp
' Visual Basic

Any other language uses //.

Changing a shortcut

Open File > Preferences > Keyboard Shortcuts, search for Text Tooling, then change or remove the binding you want. The shortcuts only apply while an editor that is not read-only has the focus.

Requirements

VS Code 1.80 or later, on the desktop or on the web (vscode.dev, github.dev). The extension has no settings and no runtime dependencies.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft