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.
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.
- Custom Language Support Tutorial: Language and File Type
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