Changes to File stubbing, maybe this fixes some strange errors in log.
This commit is contained in:
parent
82feb8c43c
commit
72db8ad8b2
@ -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<M68kFileStub>("MC68000_FILE", MC68000Language.INSTANCE) {
|
||||
class M68kFileElementType private constructor() : ILightStubFileElementType<PsiFileStub<M68kFile>>("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
|
||||
}
|
@ -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<M68kFile?>(file)
|
||||
class M68kFileStub(file: M68kFile) : PsiFileStubImpl<M68kFile>(file)
|
@ -7,9 +7,9 @@ import de.platon42.intellij.plugins.m68k.psi.M68kPsiElement
|
||||
object M68kStubElementTypeFactory {
|
||||
@JvmStatic
|
||||
fun stubFactory(name: String): IStubElementType<out StubElement<out M68kPsiElement>, 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'")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user