WebStorm-实时模板-指示聚焦相同变量的顺序 [英] WebStorm - Live templates - indicate the order of focusing the same variable

查看:62
本文介绍了WebStorm-实时模板-指示聚焦相同变量的顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我感兴趣的是,是否有一种方法可以表明应该在哪里开始写变量名

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$);
             ^

它将从第一个TEXT变量开始写入.

It will start writing from the first TEXT variable.

我想从第二篇开始写作:

I want to start writing from the second one:

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

推荐答案

您不能对同一变量执行此操作,因为每个变量只能处理一次.

解决方案::创建另一个/中间变量,该变量将自动接收相同的值并按所需顺序排列.

Solution: create another/intermediate variable that will automatically receive the same value and arrange them in desired order.

  1. 创建新变量并为其指定其他名称(例如$VAR$):

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

(我还添加了$END$来表示最终光标位置)

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

单击Edit Variables按钮.

按所需顺序重新排列变量(使用右侧的Up/Down按钮).

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

TEXT变量分配默认值:使其接受您将为VAR变量输入的值.

Assign default value for TEXT variable: make it to accept the value that you will enter for VAR variable.

如果您不打算在填充变量时编辑TEXT值,也请选中Skip if defined复选框.

Also check Skip if defined checkbox if you do not plan to edit the TEXT value while filling the variables.

结果:仅1个位置输入变量名(如果需要,可输入代码补全),并且输入的值会自动复制到文本字段中(展开后,您仍然可以对其进行编辑模板).

Result: only 1 place to enter variable name (code completion if available if needed) and entered value is automatically copied into the text field (which you can still edit later once you done with expanding the template).

与StackOverflow相关的问题: https://stackoverflow.com/a/40606436/783119

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

这篇关于WebStorm-实时模板-指示聚焦相同变量的顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆