Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.vk.kphpstorm.kphptags.psi.stubs

import com.intellij.psi.PsiElement
import com.intellij.psi.stubs.StubElement
import com.intellij.psi.stubs.StubElementFactory
import com.intellij.psi.tree.IElementType
import com.intellij.util.io.StringRef
import com.jetbrains.php.lang.documentation.phpdoc.psi.impl.tags.PhpDocTagImpl
import com.jetbrains.php.lang.documentation.phpdoc.psi.stubs.PhpDocTagStub
import com.jetbrains.php.lang.documentation.phpdoc.psi.stubs.PhpDocTagStubImpl

@Suppress("UnstableApiUsage")
class KphpDocTagStubFactory(private val elementType: IElementType) : StubElementFactory<PhpDocTagStub, PhpDocTagImpl> {
override fun createStub(psi: PhpDocTagImpl, parentStub: StubElement<out PsiElement>?): PhpDocTagStub {
return PhpDocTagStubImpl(
parentStub,
elementType,
StringRef.fromString(psi.name),
null
)
}

override fun createPsi(stub: PhpDocTagStub): PhpDocTagImpl {
return PhpDocTagImpl(stub, stub.elementType)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.vk.kphpstorm.kphptags.psi.stubs
import com.intellij.psi.stubs.StubRegistry
import com.intellij.psi.stubs.StubRegistryExtension
import com.jetbrains.php.lang.documentation.phpdoc.psi.stubs.PhpDocTagStubSerializer
import com.jetbrains.php.lang.psi.stubs.stub_factories.PhpDocTagStubFactory
import com.vk.kphpstorm.kphptags.psi.KphpDocElementTypes

@Suppress("UnstableApiUsage")
Expand Down Expand Up @@ -38,7 +37,7 @@ class KphpStubRegistryExtension : StubRegistryExtension {
private fun registerFactories(registry: StubRegistry) {
registry.registerStubFactory(
KphpDocElementTypes.kphpDocTagSimple,
PhpDocTagStubFactory(KphpDocElementTypes.kphpDocTagSimple)
KphpDocTagStubFactory(KphpDocElementTypes.kphpDocTagSimple)
)

registry.registerStubFactory(
Expand All @@ -48,12 +47,12 @@ class KphpStubRegistryExtension : StubRegistryExtension {

registry.registerStubFactory(
KphpDocElementTypes.kphpDocTagWarnPerformance,
PhpDocTagStubFactory(KphpDocElementTypes.kphpDocTagWarnPerformance)
KphpDocTagStubFactory(KphpDocElementTypes.kphpDocTagWarnPerformance)
)

registry.registerStubFactory(
KphpDocElementTypes.kphpDocTagJson,
PhpDocTagStubFactory(KphpDocElementTypes.kphpDocTagJson)
KphpDocTagStubFactory(KphpDocElementTypes.kphpDocTagJson)
)
}
}
Loading