Custom file types in IntelliJ IDEA
IntelliJ IDEA is a great IDE for Java, Groovy, Flex, Python, Ruby and many other languages. The text editor with camel-hump completion, and version control support are so great that it may be hard to switch to another editor which may lack some useful features. So, when a need arises for me to code in a language that’s not listed on the features page, I just teach IDEA some basics about that language, and feel much more comfortable than I would if I was editing a plain text. Luckily, you don’t have to write a plugin for that, it is possible via the GUI.
Assume you want to edit Haskell code in IDEA. You go to IDE Settings | File Types and press the ‘Add‘ button next to the file types list:
This brings a dialog where you can provide some knowledge about Haskell: case sensitivity, brace matching settings, ways of defining comments and keywords. You can have up to four lists of keywords, which will be colored differently in the editor. And, of course, all of them will be auto-completed.
After you are done with this dialog, all that remains is to assign the *.hs extension to the newly created file type:
And enjoy hacking: