WebStorm - Live templates - indicate the order of

2020-02-07 03:05发布

I am interested in if there is a mean to indicate where the writing the variable name should start

e.g if I call this live template:

console.log('$TEXT$', $TEXT$);
             ^

It will start writing from the first TEXT variable.

I want to start writing from the second one:

console.log('$TEXT$', $TEXT$);
                      ^

1条回答
别忘想泡老子
2楼-- · 2020-02-07 03:31

You cannot do that for the same variable as each variable is processed only once.

Solution:

  1. Give them different names

    console.log('$TEXT$', $VAR$);$END$
    

    (I've also added $END$ to denote final cursor position)

  2. Click on Edit Variables button

  3. Rearrange variables in desired order (using Up / Down buttons on the right side)

  4. Assign TEXT variable default text -- the value that you will enter into VAR variable.

  5. Also check Skip if defined if you do not plan to edit the TEXT afterwards.

enter image description here

Result:

enter image description here

Related StackOverflow question: https://stackoverflow.com/a/40606436/783119

查看更多
登录 后发表回答