Selecting A Dollar Sign Variable In Visual Studio Code and Sublime Text

One of the first things I ever do when I change the editor or at least try a new one is to check the customization of the editor like the keyboard layout, the theming and so on. I wouldn’t do my whole workflow a favor to repeatedly readjust everything every time. Fortunately, the Visual Code Editor is customizable in the same excellent way like Sublime Text and it’s awesome.

Anyway, the main issue I had was related to variable names which start with a dollar sign. The Visual Code Editor just selected the name and not the dollar sign, which can be a huge pain if you always have to correct the selection by hand to select the whole variable name including the dollar sign variable. Lucky me, I had the same issue with Sublime Text before and could solve it by using a customized expression. The same expression I used with Visual Studio Code and surprise, surprise, it’s working like a charm.

Open your Visual Studio Code Editor and go on your Mac to Code > Preferences > User settings. Two files going to be open. The Default settings on the left and the User settings on the right. Put the following line of code in the settings.json of the User settings to solve the selecting issue:

Restarting the editor is not necessary. The changes are immediately available


Selecting a dollar sign variable without the new expression


Selecting a dollar sign variable with the new expression

As I mentioned before, with Sublime Text 3 I had the same issue which you can solve with the same word separator expression. Open Sublime Text 3 and go on Mac to Sublime Text > Preferences > Settings – User and add the following line of code:


Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn