If you want to achieve the same result as shared by Douglas Gaskill in his answer, but on a per language basis, that is also possible.
You simply need to specify the language, as follows (in your user settings). As the original poster wanted this for php
I'll use that example:
"[php]": {
"editor.wordSeparators": "`~!@#%^&*()=+[{]}\\|;:'\",.<>/?",
}
In this specific example, hyphens will no longer be treated as word separators (which is a pain for double-clicking any strings, terms, values, etc., that have hyphens in them), only when the editor is set to PHP
language mode.
Also, for those who are new to this...
At some stage VSCode started showing a GUI for editing Settings (I don't recall seeing that in the past), and this won't allow you to edit the editor.wordSeparators
value in the way I have indicated.
To make the changes in the way I've indicated, you'll need to open the Settings not from Code > Preferences > Settings
(on Mac, not sure how it looks on other operating systems), but instead from the Command Pallet (on Mac, that's Command-shift-P
), or View > Command Pallet
. The command is >Preferences: Open Settings (JSON)
.
You can then add in the code I've provided, or your version of it.
To get an idea of what that looks like in context of other settings, here's an example:
// Place your settings in this file to overwrite the default settings
{
"composer.executablePath": "/usr/local/bin/composer",
"terminal.integrated.shell.osx": "/usr/local/bin/powershell",
"editor.wordWrap": "on",
"extensions.autoUpdate": false
"[php]": {
"editor.wordSeparators": "`~!@#%^&*()=+[{]}\\|;:'\",.<>/?",
}
}