diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/M68kFileElementType.kt b/src/main/java/de/platon42/intellij/plugins/m68k/M68kFileElementType.kt index 98df13d..cb586b7 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/M68kFileElementType.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/M68kFileElementType.kt @@ -1,28 +1,21 @@ package de.platon42.intellij.plugins.m68k -import com.intellij.psi.PsiFile -import com.intellij.psi.stubs.DefaultStubBuilder -import com.intellij.psi.stubs.StubElement -import com.intellij.psi.tree.IStubFileElementType +import com.intellij.psi.stubs.PsiFileStub +import com.intellij.psi.tree.ILightStubFileElementType import de.platon42.intellij.plugins.m68k.psi.M68kFile -import de.platon42.intellij.plugins.m68k.stubs.M68kFileStub -class M68kFileElementType private constructor() : IStubFileElementType("MC68000_FILE", MC68000Language.INSTANCE) { +class M68kFileElementType private constructor() : ILightStubFileElementType>("MC68000_FILE", MC68000Language.INSTANCE) { companion object { @JvmField val INSTANCE = M68kFileElementType() - const val STUB_VERSION = 2 + const val STUB_VERSION = 3 const val STUB_EXTERNAL_ID_PREFIX = "MC68000." + const val EXTERNAL_ID = STUB_EXTERNAL_ID_PREFIX + "FILE" } override fun getStubVersion() = STUB_VERSION - override fun getBuilder() = - object : DefaultStubBuilder() { - override fun createStubForFile(file: PsiFile): StubElement<*> { - return if (file is M68kFile) M68kFileStub(file) else super.createStubForFile(file) - } - } + override fun getExternalId() = EXTERNAL_ID } \ No newline at end of file diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/stubs/M68kFileStub.kt b/src/main/java/de/platon42/intellij/plugins/m68k/stubs/M68kFileStub.kt index 9e56581..a50c447 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/stubs/M68kFileStub.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/stubs/M68kFileStub.kt @@ -3,4 +3,4 @@ package de.platon42.intellij.plugins.m68k.stubs import com.intellij.psi.stubs.PsiFileStubImpl import de.platon42.intellij.plugins.m68k.psi.M68kFile -class M68kFileStub(file: M68kFile?) : PsiFileStubImpl(file) \ No newline at end of file +class M68kFileStub(file: M68kFile) : PsiFileStubImpl(file) \ No newline at end of file diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/stubs/M68kStubElementTypeFactory.kt b/src/main/java/de/platon42/intellij/plugins/m68k/stubs/M68kStubElementTypeFactory.kt index ba30d8d..0438443 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/stubs/M68kStubElementTypeFactory.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/stubs/M68kStubElementTypeFactory.kt @@ -7,9 +7,9 @@ import de.platon42.intellij.plugins.m68k.psi.M68kPsiElement object M68kStubElementTypeFactory { @JvmStatic fun stubFactory(name: String): IStubElementType, out M68kPsiElement> { - when (name) { - "GLOBAL_LABEL" -> return M68kElementTypes.GLOBAL_LABEL - "SYMBOL_DEFINITION" -> return M68kElementTypes.SYMBOL_DEFINITION + return when (name) { + "GLOBAL_LABEL" -> M68kElementTypes.GLOBAL_LABEL + "SYMBOL_DEFINITION" -> M68kElementTypes.SYMBOL_DEFINITION else -> throw RuntimeException("Unknown element type '$name'") } }