Microsoft has released Visual Studio Code for Linux (and OSX and Windows) for free (https://code.visualstudio.com/). It's not a bad editor over-all, but I had one thing that urked me. I do a lot of PHP work here and sometimes the include files have the extension .inc instead of .php ... Well, VSCode doesn't seem to think those are php and therefore doesn't highlight them. You'd think it'd read that from the <?php at the top, or infer it from the format, or have some sort of menu to tell it 'treat this as php', but it doesn't. However, we can fix that, and NOT just for PHP!
Open up your favorite text editor and go to your VSCode install directory. Doing an 'ls' should look something like this:
$ ls
Code content_shell.pak icudtl.dat libgcrypt.so.11 libnode.so
libnotify.so.4 locales natives_blob.bin resources snapshot_blob.bin
Now, 'cd' into your resources/app/extensions/ directory and you'll see all sorts of extensions. For me, it looks a little something like this:
$ ls
bat ini perl theme-monokai
clojure jade php theme-monokai-dimmed
coffeescript java powershell theme-quietlight
cpp javascript python theme-red
csharp less r theme-solarized-dark
csharp-o lib.core.d.ts ruby theme-solarized-light
css lua rust theme-tomorrow-night-blue
declares.d.ts make shaderlab tsconfig.json
docker markdown shellscript typescript
fsharp mono-debug sql vb
go node-debug swift vscode-api-tests
groovy node.d.ts theme-abyss xml
html objective-c theme-kimbie-dark yaml
Now, most of those are directories, and they have files under them... the one we care about is
/package.json ... Open that up in your favorite text editor (like vim) and follow the json object looking for the line under the node "contributes"->"languages" called "extensions"... For instance, Python says:
"extensions" : [ ".py", ".rpy", ".pyw", ".cpy", ".gyp", ".gypi" ],
php says:
"extensions": [ ".php", ".phtml", ".ctp" ],
etc... Just add in your desired extension (for me, I added the text ',".inc" ') in the object and save it. Restart VSCode and you've got nicely syntax highlighted text!
Update!
As of VSCode 1.1.0+, you can actually add these things in your settings.json. To get there, go to "Preferences->User Settings". It'll open up a big (or small) json object it reads in for your settings. You'll want to add the lines in:
{
...
"files.associations": {
"*.inc": "php",
}
}
Save it and you're good to go! (you may need to restart VSCode)