VS Code – snake_case to camelCase

VS Code doesn’t currently provide a built-in way to convert cases like snake_case, camelCase or TitleCase. Here’s a keyboard focused workflow to handle snake_case to camelCase conversion:

Some Background

I began one of my web apps using snake_case for class and function names. It turns out, a lot of JavaScript apps and tool-kits use camelCase and I wanted other users to feel comfortable using the app alongside those. So I wanted to convert cases. In editors like Vim or Sublime Text, it’s super easy. I’d been using VS Code, which required a workaround, resulting in the workflow above.

More Discussion

I posted the same workflow here as well:
https://github.com/Microsoft/vscode/issues/12185#issuecomment-414411370

In that discussion, user @jpike88 provides an alternative explanation that follows the same line of thought. The difference is just that the workflow I posted focuses on key-presses, no mouse interaction needed. I thought Vim users might find that more natural. Either way, I think both explanations work together to help get the workflow idea across.

Hope it helps. 🙂

Advertisements
VS Code – snake_case to camelCase

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s