Selected variable highlighting and word separators in Sublime Text

2

2

I removed the dollar sign from the list of word separators to be able to select PHP variables with double-clicks. Problem is when i select a variable: what i would expect is all other occurrences of the variable to be highlighted but it doesn't happen. Any idea?

Ithilion

Posted 2013-09-18T16:30:55.720

Reputation: 43

Does it work in Sublime Text 2? The reason I ask is to see if it is a problem with the pre-release/beta software (off topic on SU) or is a Sublime Text * issue (on topic on SU). – nerdwaller – 2013-09-18T16:38:07.150

I just tried it on SB2 and it doesn't work. Should i remove the version from this answer? – Ithilion – 2013-09-18T16:43:52.230

Answers

1

It's working just fine for me in ST2 on XP. What may have happened is your "match_selection" setting might have gotten set to false. Make sure

"match_selection": true

is in your preferences file (Preferences -> Settings - User) and you should see the expected behavior.


UPDATE After checking some other ST3 builds on a different machine, I was able to replicate the issue, however it doesn't seem to depend on whether $ is included in the "word_separators" preference. Using the following test code:

<?php

function myFunc($var_1, $var_2) {
    return $var_1 + $var_2;
}

I selected var_1 in one line, and the corresponding var_1 was highlighted with a box around it, like usual. Same with var_2. Next, I selected $var_1, but the other occurrence was not highlighted. This behavior was the same regardless of whether $ is defined as a word separator or not. Interestingly, even though the other $var_1 wasn't highlighted, it was still able to be selected with CtrlD, so the bug is only with the highlighting code, not the search and select code.

https://github.com/SublimeText/Issues/issues is the unofficial repository for Sublime Text issues, mainly those having to do with ST3. I'd suggest you head over there, search around to see if anyone else has noticed this, and if not to open a new issue with as much detail as possible.

MattDMo

Posted 2013-09-18T16:30:55.720

Reputation: 4 968

what versions/build numbers are you using? And what platform are you on? – MattDMo – 2013-09-18T17:50:58.130

I'm using ST3 build 3047 on Windows 7 Ultimate x64 (ST3 is portable edition) – Ithilion – 2013-09-18T17:52:22.703

If you're a registered user, try Build 3053. Maybe something got broken somewhere...

– MattDMo – 2013-09-18T17:55:13.510

I just logged into another machine running Build 3048 and I see the same thing - if I select just the text part of the variable, I see the corresponding part highlight elsewhere. However, if I include the $, no highlighting. I'd suggest heading over to the unofficial ST3 issues tracker on GitHub, search around, then open an issue if no one has reported it yet.

– MattDMo – 2013-09-18T18:02:08.820

Unfortunately, i'm not (yet) a registered user. I'll try reporting it as you suggested. – Ithilion – 2013-09-18T18:05:03.073

1

John Xiao

Posted 2013-09-18T16:30:55.720

Reputation: 133

Please write out the answer from your reference on this site. If the link goes dead then so does this answer. Thanks for your contribution! – jAce – 2015-10-12T10:42:33.963