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
|
package de.platon42.intellij.plugins.m68k
|
||||||
|
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.stubs.PsiFileStub
|
||||||
import com.intellij.psi.stubs.DefaultStubBuilder
|
import com.intellij.psi.tree.ILightStubFileElementType
|
||||||
import com.intellij.psi.stubs.StubElement
|
|
||||||
import com.intellij.psi.tree.IStubFileElementType
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kFile
|
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 {
|
companion object {
|
||||||
@JvmField
|
@JvmField
|
||||||
val INSTANCE = M68kFileElementType()
|
val INSTANCE = M68kFileElementType()
|
||||||
|
|
||||||
const val STUB_VERSION = 2
|
const val STUB_VERSION = 3
|
||||||
const val STUB_EXTERNAL_ID_PREFIX = "MC68000."
|
const val STUB_EXTERNAL_ID_PREFIX = "MC68000."
|
||||||
|
const val EXTERNAL_ID = STUB_EXTERNAL_ID_PREFIX + "FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getStubVersion() = STUB_VERSION
|
override fun getStubVersion() = STUB_VERSION
|
||||||
|
|
||||||
override fun getBuilder() =
|
override fun getExternalId() = EXTERNAL_ID
|
||||||
object : DefaultStubBuilder() {
|
|
||||||
override fun createStubForFile(file: PsiFile): StubElement<*> {
|
|
||||||
return if (file is M68kFile) M68kFileStub(file) else super.createStubForFile(file)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -3,4 +3,4 @@ package de.platon42.intellij.plugins.m68k.stubs
|
|||||||
import com.intellij.psi.stubs.PsiFileStubImpl
|
import com.intellij.psi.stubs.PsiFileStubImpl
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kFile
|
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 {
|
object M68kStubElementTypeFactory {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun stubFactory(name: String): IStubElementType<out StubElement<out M68kPsiElement>, out M68kPsiElement> {
|
fun stubFactory(name: String): IStubElementType<out StubElement<out M68kPsiElement>, out M68kPsiElement> {
|
||||||
when (name) {
|
return when (name) {
|
||||||
"GLOBAL_LABEL" -> return M68kElementTypes.GLOBAL_LABEL
|
"GLOBAL_LABEL" -> M68kElementTypes.GLOBAL_LABEL
|
||||||
"SYMBOL_DEFINITION" -> return M68kElementTypes.SYMBOL_DEFINITION
|
"SYMBOL_DEFINITION" -> M68kElementTypes.SYMBOL_DEFINITION
|
||||||
else -> throw RuntimeException("Unknown element type '$name'")
|
else -> throw RuntimeException("Unknown element type '$name'")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user