2

So we can use expressions to transform other variables in live templates. For example:

Working example with two variables while second one references the first one

Is it possible to apply snakeCase to NAME directly? So whatever I type, gets converted into snake case? Desired result:

Example with expected behaviour, having just one variable

Tried snakeCase(NAME), snakeCase(String) and snakeCase(). None seemed to work. Maybe someone had it figured out?

unxp
  • 318
  • 2
  • 12
  • Show you live template / how you plan to use it. As Lena said, you may simply use another variable that will hold that value. – LazyOne Mar 20 '19 at 13:17
  • Well in this case I wanted to enforce snake_case for test method name, no matter how I type it in. Was just wondering if it's possible. Anyway, String Manipulation plugin will do the job. – unxp Mar 20 '19 at 15:04

1 Answers1

3

No, it's not possible - you can't pass a variable to itself, it has to be either another live template variable (defined before) or some known value calculated based on clipboard content (snakeCase(clipboard())), file name (snakeCase(fileName())), name got from completion, etc.

If you like to change names of existing variables, you can try String Manipulation plugin, for example

lena
  • 90,154
  • 11
  • 145
  • 150