本文介绍了如何选择具有相同名称的变量(不是文本)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

选择变量 f 时,编辑器会突出显示该变量的其他出现.到目前为止一切顺利,但是当尝试使用 Ctrl+D 将它们添加到选择列表时,它还会添加 f,因为它作为常规文本出现在代码中.我可以用 Ctrl+K 跳过这个,但是如果编辑器已经将 f 识别为一个变量,那么它肯定也可以只选择变量吗?此选项不在菜单中.

When selecting variable f, the editor highlights other occurrences of the variable. So far so good, but when trying to add them to the selection list with Ctrl+D, it also adds f as it occurs in the code as regular text. I can skip this with Ctrl+K, but if the editor already identifies f as a variable, then it can surely also just select variables? This option is not in the menu.

以这个 JavaScript 片段为例.

Take this JavaScript snippet.

f=function(){};
f();

When selecting the first f, it also highlights f in f(), but not f in.
当使用 Ctrl+D 进行多选时,它确实选择了它.

When selecting the first f, it also highlights f in f(), but not f in function.
When multi-selecting with Ctrl+D it does select it though.

推荐答案

这是一个错误. 帖子也有解决方法.

不要选择变量,只需将光标放在它的左边,然后按Ctrl+D.这也将选择它,但只有其他变量(或编辑器识别为变量的变量,基于单词边界)在随后的 Ctrl+D 按下.

Rather than selecting the variable, just put the cursor left to it, and press Ctrl+D. This will also select it, but only other variables (or what the editor recognises as variables, based on word boundaries) on subsequent Ctrl+D presses.

这篇关于如何选择具有相同名称的变量(不是文本)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 20:21