Auto change case in snippet


#1

I always type the following:

export const ACTION_TYPES = "ACTION_TYPES";

And clicking caps lock is tedious.

In VS code, they have the upcase option to use
${sn:/upcase}

So, I wonder if the similar implementation is present in Atom.


#2

There’s a command editor:upper-case that you can invoke and the word under the cursor will be transformed. You can attach it to a keybinding (for me, it’s ctrl-k ctrl-c by default) and use it wherever.


#3

I couldn’t put it to work in snippet .cson script. OR it won’t happen in .cson script?


#4

It should happen everywhere. You can use the Keybinding Resolver to see what commands are being matched when you press certain keys. Please post a screenshot of that.


#5

vsCode augmented their snippets to include Emmet type functionality from May (?) onwards.
Atom currently have the traditional snippet format.


#7

I know how it works for key binding, however, what I wanted was automatically upcase without clicking any bindings.


#8

How would Atom identify when you want to make a word upper case?


#9

The desired outcome:

'Export Constant':
'prefix': 'ecc'
'body': """
  export const ${1:/upcase} = '${1:/upcase}';
  $2
"""

When we exit the snippet after $2, all input will be downcase again.
ONLY $1 cursor will upcase AUTOMATICALLY.