syntaxHighlighter on decompiled file


Hi. I have implemented a BinaryFileDecompiler attached to a FileType with method isBinary overridden.

I've also created a PsiFileBase for my compiled fileType and attached to the method createFile() in a ParserDefinition class

Decompiler works, but syntax highlighting does not work.

object MyParserDefinition : ParserDefinition {
override fun createFile(viewProvider: FileViewProvider): PsiFile = when (viewProvider.fileType) {
MySourceFileType -> MySourceFile(viewProvider)
MyIncludeFileType -> MyIncludeFile(viewProvider)
MyCompiledFileType -> MyCompiledFile(viewProvider)
else -> throw RuntimeException("Illegal viewProvider") // is this ok?
object MyCompiledFileType : FileType {
override fun getName(): String = "MY_COMPILED"
override fun isReadOnly(): Boolean = true
override fun isBinary(): Boolean = true

class MyCompiledFile(viewProvider: FileViewProvider) : PsiFileBase(viewProvider, MyLanguage) {
override fun getFileType(): FileType = MyCompiledFileType
override fun toString(): String = "compiled file viewProvider"



Then, if I try to add a syntaxHighlighter, even with implementationClass value empty, I can open my compiled file, but it shows a infinite "Loading…" text.

Is it normal? Am I missing something to implement?


This is a similiar issue: , but his solution (including the syntaxHighlighter) does not work


Please try implementing com.intellij.psi.PsiCompiledFile in your MyCompiledFile


Thanks for the your reply.

I fixed all the things. 

I had to create an implementation for my file which extends PsiFileBase and implements PsiFileEx and PsiCompiledBase and a new FileViewProvider with his factory. 


Please sign in to leave a comment.