简体   繁体   English

双击突出显示变量Sublime Text 3包括$

[英]Double click highlight variable Sublime Text 3 include $

I wanted ST3 to include the "$" when selecting PHP files so I edited word_separators by removing $ as such : 我希望ST3在选择PHP文件时包含“$”,所以我通过删除$来编辑word_separators

"word_separators": "./\\()\"':,.;<>~!@#%^&*|+=[]{}`~?"

And now it highlight the whole varibale including the "$" when double clicking a variable. 现在它突出显示整个varibale,包括双击变量时的“$”。 However, now Sublime is not matching/outlining those variables using the default match_selection functionality. 但是,现在Sublime没有使用默认的match_selection功能匹配/概述这些变量。
Any thoughts on this? 有什么想法吗? Is there a setting I am missing. 有没有我错过的设置。 Much appreciated. 非常感激。

Please see my answer to this question for an in-depth look at the effect of changing word_separators and various find and select options. 请查看 对此问题的 回答 ,深入了解更改word_separators和各种查找和选择选项的效果。 Long story short, altering word_separators changes the behavior of double-clicking, as you noted, but other operations, including match_selection , rely on an internal word separators list that apparently can't be altered by the user. 简而言之,改变word_separators会改变word_separators的行为,正如您所指出的那样,但其他操作(包括match_selection )依赖于内部单词分隔符列表,显然用户无法更改。 So, when you double-click to select a PHP variable, you'll get the $ selected, but other instances of the variable won't be highlighted. 因此,当您双击以选择PHP变量时,您将获得$ selected,但不会突出显示该变量的其他实例。 They will be selected when using Ctrl D to make multiple selections, however: 使用Ctrl D进行多项选择时选择它们,但是:

$ wp_error ctrl + d

Additionally, when using the Find dialog, other instances will be highlighted: 此外,使用“ Find对话框时,将突出显示其他实例:

找到$ wp_error

So, to address your original problem, if you need to see all the instances of the currently-selected variable, set "find_selected_text": true in your user preferences, double-click to select your variable of interest, then hit Ctrl F ( F on OS X) to view all occurrences. 因此,要解决原始问题,如果需要查看当前所选变量的所有实例,请在用户首选项中设置"find_selected_text": true ,双击以选择感兴趣的变量,然后按Ctrl F F OS X)查看所有事件。 Just make sure you don't have the regex search button selected, as $ has a special meaning in regexes. 只要确保你没有选择正则表达式搜索按钮,因为$在正则表达式中有特殊含义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM