Reputation: 2133
I'm trying to create an IntelliJ plugin to handle custom language support by following this tutorial: https://confluence.jetbrains.com/display/IntelliJIDEA/Custom+Language+Support. My problem is the files I want to provide support for are called "Config", with no extension. The LanguageFileType class seems to only support matching files based on extension, though. Is there any way to register a regex for the filename instead of just the extension?
Upvotes: 3
Views: 191
Reputation: 2133
I figured out how to do this - In the FileTypeFactory, pass a FileNameMatcher as the 2nd argument to the consume
call:
public class ConfigFileTypeFactory extends FileTypeFactory {
@Override
public void createFileTypes(FileTypeConsumer consumer) {
consumer.consume(BrazilConfigFileType.INSTANCE, new ExactFileNameMatcher("Config"));
}
}
Upvotes: 3