IntelliJ Platform Plugin SDK Help

Registering a File Type

The first step in developing a custom language plugin is registering a file type associated with the language.

The IDE typically determines the type of a file by looking at its filename or extension. In 2020.2, support for mapping via hashbang is available via hashBangs attribute in com.intellij.fileType extension point.

A custom language file type is a class derived from LanguageFileType, which passes a Language subclass to its base class constructor.

When targeting 2019.2 or later only, use com.intellij.fileType extension point to associate LanguageFileType with corresponding filename extension(s), hardcoded file names, hash bangs (2020.2), and patterns.

To register a file type, the plugin developer provides a subclass of FileTypeFactory, which is registered via the com.intellij.fileTypeFactory extension point.


To verify that the file type is registered correctly, you can implement the LanguageFileType.getIcon() method and verify that the correct icon (see Working with Icons and Images) is displayed for files associated with your file type.

If you want IDEs to show a hint prompting users that your plugin supports a specific file type, see Plugin Recommendations.

To control file type association with the IDE in the operating system, implement OSFileIdeAssociation (2020.3).

Last modified: 02 September 2021