2. Language and File Type
The IntelliJ Platform determines file type by examining the name of a file. Each language has Language and LanguageFileType objects defining the language. Register the LanguageFileType
with the IntelliJ Platform in the plugin configuration file.
Define the Language
The language implemented in this tutorial is named "Simple" - note the case of the name. The SimpleLanguage
class is defined in the org.intellij.sdk.language
package of the simple_language_plugin
code sample:
Define an Icon
The icon for the Simple Language is defined by the SimpleIcons
class. Please see Working with Icons and Images for details on how to define and use icons.
Define a FileType
The SimpleFileType
is defined by subclassing LanguageFileType
:
Register the FileType
The Simple Language file type is registered via the com.intellij.fileType
extension point in plugin.xml and registered with *.simple extension:
Define a FileType Factory
First, define SimpleFileTypeFactory
as a subclass of FileTypeFactory
.
Register the FileType Factory
The SimpleFileTypeFactory
is registered using the com.intellij.fileTypeFactory
extension point in plugin.xml.