Search code examples
rubyminejetbrains-idelive-templates

Is it possible to chain predefined functions in RubyMine live templates?


I want to be able to chain live template predefined functions so the output of one can be used as the input of another, like so:

underscoresToSpaces(fileNameWithoutExtension())

I have a (perhaps false) memory of having been able to do this before, but can't manage to get it to work again.

I am using RubyMine 8.0.3.


Solution

  • Chaining predefined functions in RubyMine live templates works for me in a straightforward way. Defining this live template in Preferences → Editor → Live Templates

    enter image description here

    and typing fws in an editor inserts the file's name without spaces.

    Current RubyMine (I'm using 8.0.3 too) has a bug which causes a template variable's expression to not be saved properly if you tab out of the expression field. Work around it by clicking OK after entering the expression.