Setting syntax highlighting for individual file

node.js, php, phpstorm, shell, webstorm

Solution

PhpStorm/WebStorm (as well as whole IDEA platform) does not have ability for user to change custom language / syntax highlighting on the go (whenever you want) -- it has to be associated with certain file type.

Of course -- implementing this (shebang recognition) via plugin is possible -- just like it is implemented for PHP files.

On one hand there is http://youtrack.jetbrains.com/issue/WEB-11842 -- vote/star/comment to get notified on progress

On another hand -- it works for me in PhpStorm (v8 EAP build) -- as you can clearly see file is recognized as JavaScript (sorry, I have nodejs plugin installed, but it is not configured/no nodejs sources/SDK as I do not use it myself).

You can clarify the actual status of this feature in that ticket.

Problem

Often I write small command line utilities and will use alternate languages to create these scripts (e.g. node.js, php, etc.). When I create these files, I use a standard `#!` to start the file to indicate to the shell what the intepreter should be. For example, for a node.js script, I'd put this at the top: `#!/usr/bin/env node` In PHPStorm/WebStorm, the syntax highlighting works fine as long as the file has the extension of `.js` but if I drop the extension, there is no syntax highlighting. In SublimeText, I can use the command pallet to set the syntax of the current file to JavaScript (for example) by typing the Ctrl+P/Cmd+P + SSJS (Set Syntax JavaScript) Is there any way within the JetBrains IDE's to set the syntax of an individual file beyond just registering a file type based on file extension?

Original source