Create IntelliJ plugin to handle file type without extension
I am trying to create an IntelliJ plugin to support custom language support by following this tutorial: https://confluence.jetbrains.com/display/IntelliJIDEA/Custom+Language+Support . My problem is that the files I want to provide for support are named "Config", without the extension. However, the LanguageFileType class only supports extension-based compatible files. Is there a way to register a regular expression for the filename, not just the extension?
+3
source to share
1 answer
I figured out how to do it. In FileTypeFactory, pass FileNameMatcher as the second argument to the call consume
:
public class ConfigFileTypeFactory extends FileTypeFactory {
@Override
public void createFileTypes(FileTypeConsumer consumer) {
consumer.consume(BrazilConfigFileType.INSTANCE, new ExactFileNameMatcher("Config"));
}
}
+3
source to share