SublimeText / WordHighlight

Highlight all copies of the currently selected word.
MIT License
179 stars 24 forks source link

PHP variable highlighting #2

Closed ghost closed 12 years ago

ghost commented 12 years ago

"Fixed" PHP variable highlighting, in case '$' is removed from the word_separators setting (which seems to make more sense for that particular syntax: it enables selecting whole variables e.g. with "expand selection to word"), and the regex stops matching because of this. Wasn't able to do the fix without side-effects: now, considerably more characters are accepted while forming a highlight-able word -- which may not always be desirable.

For the more complete reasoning of the change, please see the gh-1 issue.

adzenith commented 12 years ago

Okay, I see—\b works with normal regex word boundaries, and doesn't pay attention to Sublime Text's word_boundary option. Hm.

ghost commented 12 years ago

Since the patch I offered introduces inconsistency with the current Find, with "whole word" option enabled (which I believe should behave similarly), I've filed a bug report on userecho: http://sublimetext.userecho.com/topic/61252-find-whole-word-for-variables/

adzenith commented 12 years ago

Yeah, I think the find uses the regex \b instead of the word_separators. I was thinking about this last night and I think merging your pull request is the way to go. Ideally Sublime Text's find engine will be updated, but in the interim I think this will help enough that I'm okay with its potentially idiosyncratic behaviour.