I'm working on migrating my plugin tests from PlatformLiteFixture to the IdeaTestFixtureFactory framework. I have simple platform tests working, but am now trying to figure out how to get tests that require parsing a language to work (so using PsiManager.getInstance(project).findFile(file) will return a PsiFile of the parsed file in the specified language).
What is the recommended way to register a language extension, parser definition, and AST factory using the IdeaTestFixtureFactory framework? Are there any examples of this being used? How do I register the language file type (see below for details)?
# Registering File Types
I've tracked down the current issue to file.getFileType() in FileManagerImpl#createFileViewProvider. This is because the filetype is not registered. However, if I do:
val app = ApplicationManager.getApplication()
Then the file.getFileType() call still ends up using FileTypeManagerImpl instead of the mock class (additionally, HeavyIdeaTestFixtureImpl is casting to FileTypeManagerImpl, making it hard to replace that with a mock implementation). -- How do I register/customize services on the fixture's application instance?
I can't use registerFileType as that is deprecated.
So do I need to make use of the FileTypeBean extension point? If so, where and when do I register those, as I need an application instance to register the EP on and the associated FileTypeBean instances, but need to do it before the FileTypeManagerImpl is registered.