Giter Site home page Giter Site logo

vscode-toggle-case's Introduction

Change Case

Build Status

Since changing the case is a frequent requirement during development and general writing, there needs to a better way to do this. This VS Code Extension provides a faster, easy to remember and user friendly ways to change case of the selected text.

You can use Keyboard Shortcut, MacOS Touchbar or VS Code Command Palette to change the case.

This extension supports multiple ways to change the case and it works on both single and multi cursors.

Usage

  • Press the defined keybord shortcut to toggle through various cases. And dont worry you will never loose your original text since that is also included in the cycle.

    • Cmd + M on MacOS
    • Ctrl + M on Windows

    Working

  • This works with multi lines selection as well

    Working

  • Or if you want to change text to a particular format, you can select the text (multiple selection works too) and open Command Pallette (defaults to Cmd + Shift + P in MacOS) and start typing Change case to and select the required case.

    Working

  • Or if you are using a mac with a touch bar, the moment you select some text on the VS Code editor, a button will popup on your touchbar. You can press this to toggle through multiple cases.

    Working

Case Supported

You can toggle through multiple cases, you can find the complete list below:

  • UPPERCASE
  • lowercase
  • Title Case
  • camelCase
  • CONSTANT_CASE
  • dot.case
  • Header-Case
  • kebab-case
  • PascalCase
  • path/case
  • Sentence case
  • snake_case

This extenion is using some functions of change-case.

Settings

The extension supports the following setting. Navigate to Preferences > Setting > Toggle Case

  • You can enable/disable any case from being the part of the loop.
  • You can turn notification on/off showing the case text is transformed to.
  • Navigate to Preferences > Keyboard Shortcuts to change default keybinding of Cmd + M / Ctrl + M to your liking.

Installation

Launch VS Code Quick Open (Ctrl/Cmd+P), paste the following command, and press enter.

ext install toggle-case

Or you can use this VS Code Marketplace link of the extension to download it directly to VS Code.

Support

Log a issue or reach out to me at [email protected]

vscode-toggle-case's People

Contributors

gyaur avatar pranshuagrawal avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

vscode-toggle-case's Issues

Feature request: per language (file extension) settings

It would great if per language (file extension) settings were available.
For example .py would have CONSTANT_CASE, snake_case
.c, .cpp, c++, .h, .hpp, h++: camelCase, CONSTANT_CASE,
.js: camelCase, PascalCase (aka UpperCamelCase)

Implementation of "Smart" toggle?

Hi @pranshuagrawal !

I've just hitted following case while using your extension:

When you're toggling some simple single word without any "dividable parts/separators", like console for example.

Then, there are only 3 possible case-variations for that word:
console (lowercase)
Console (capitalized)
CONSOLE (uppercase)

So, is it possible to make check (after each case transformation) if transformed string is different from the original input?
When resulting string is not different (so no transformation has been actually done) then move to the next transformation in the list and apply it - until any change is made (or transformation list reaches it's end - to prevent infinite loop).

As a result - only 3 variations (described above) will be resulted while toggling the case (because dot case, header case, kebab case and others cases (which are using "word separation") will be skipped by the check).

Simply said - after this change, only transformations which would have any effect will be actually used/cycled. Does it makes sense to you @pranshuagrawal โ“

Title Case doesn't work - Transforms to Sentence Case instead

The Title Case transform doesn't seem to work: it changes text to Sentence case instead of title case. Title Case should capitalize the first letter of each word when words are separated by spaces. I think perhaps this extension is not coded to manage text with spaces in it, but is intended for string or variable names?

Here is a sample text that I tried:
This is a sentence with only one capital letter.
And here is the output when I use the Transform to Title Case:
This is a sentence with only one capital letter.

Here is another sample:
here's a phrase I want to transform to Title Case
And here is the Title Case output:
Here's a phrase i want to transform to title case

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.