microsoft/vscode

Missing Sublime Text command - Change case of selection

waderyan opened this issue · 6 comments

While building this extension to map Sublime Text default keyboard shortcuts to VS Code, I found that this feature is missing.

The feature is changing the case of the selection to upper and lower case.

Default Sublime Text keybindings

Case change Windows / Linux Mac
Upper case ctrl+k ctrl+u cmd+k cmd+u
Lower case ctrl+k ctrl+l cmd+k cmd+l

upper_lower_case

Today an extension exists with this functionality. I think this is a good feature to bring into the core of the product.

As there are extensions to do this (https://github.com/wmaurer/vscode-change-case), I think there's sufficient demand for this feature, and reason to include it for all users. Definitely essential for any text-editor.

@gandhis1 thank you for your feedback. I opened this issue so I agree with you. I've been trying to come up with specific use cases where this is helpful. Can you help me by adding a couple others?

Use Cases:

  1. Constants are often all caps. While refactoring you may want to change a variable to use all caps.
  2. Inverse of 1.

I mostly use it to correct improperly formatted SQL queries (keywords should be capitalized, and names lowercase).

This feature composes especially well with multi-cursor selections.

As a result, it's very useful for "generating" (read: typing by hand) boilerplate code from a list of stuff. E.g. if one has the identifiers foo, bar, and baz, and wants to make getFoo() { } and so on, they can simply select the first letters of each of the identifiers, uppercase, and prepend with get.

I often hop out of Visual Studio into Sublime Text to generate methods or write lists of method calls or something similar using the uppercase/lowercase feature--however the change-case extension mentioned earlier provides way more functionality that all seems useful.

lipis commented

When pasting multiple things from variables/enums.. then you can multi select the first letters and transform them into capital letters if you want to use them as labels :)

We try to keep VS Code lean and we think the functionality you're asking for is great for a VS Code extension. Maybe you can already find one that suits you in the VS Code Marketplace. Just in case, in a few simple steps you can get started writing your own extension. See also our issue reporting guidelines.

Happy Coding!