diff --git a/platform/platform-resources/src/META-INF/XmlPlugin.xml b/platform/platform-resources/src/META-INF/XmlPlugin.xml
index 576c7622ddf4..093ced26ac64 100644
--- a/platform/platform-resources/src/META-INF/XmlPlugin.xml
+++ b/platform/platform-resources/src/META-INF/XmlPlugin.xml
@@ -40,6 +40,9 @@
+
+
+
diff --git a/xml/xml-parser/src/com/intellij/psi/xml/HtmlFileElementType.kt b/xml/xml-parser/src/com/intellij/psi/xml/HtmlFileElementType.kt
index ad1b49b699be..5ed0938171b6 100644
--- a/xml/xml-parser/src/com/intellij/psi/xml/HtmlFileElementType.kt
+++ b/xml/xml-parser/src/com/intellij/psi/xml/HtmlFileElementType.kt
@@ -3,51 +3,18 @@ package com.intellij.psi.xml
import com.intellij.lang.Language
import com.intellij.lang.html.HTMLLanguage
-import com.intellij.psi.stubs.PsiFileStub
-import com.intellij.psi.tree.IElementType
import com.intellij.psi.tree.IFileElementType
-import com.intellij.psi.tree.IStubFileElementType
-import kotlin.concurrent.Volatile
open class HtmlFileElementType(
debugName: String,
language: Language,
-) : IStubFileElementType?>(debugName, language) {
+) : IFileElementType(debugName, language) {
protected constructor() :
this("html", HTMLLanguage.INSTANCE)
- override fun getStubVersion(): Int =
- getHtmlStubVersion() + 3
-
companion object {
@JvmField
val INSTANCE: IFileElementType = HtmlFileElementType()
-
- @Volatile
- private var stubVersion = -1
-
- @JvmStatic
- fun getHtmlStubVersion(): Int {
- val version = stubVersion
- if (version != -1)
- return version
-
- val result = enumerate { it is IStubFileElementType<*> && isAcceptable(it) }
- .sumOf { (it as IStubFileElementType<*>).stubVersion }
-
- stubVersion = result
-
- return result
- }
-
- @JvmStatic
- fun isAcceptable(elementType: IElementType): Boolean {
- val id = elementType.language.id
-
- //hardcoded values as in BaseHtmlLexer
- //js and css dialect uses the same stub id as the parent language
- return id == "JavaScript" || id == "CSS"
- }
}
}
diff --git a/xml/xml-parser/src/com/intellij/psi/xml/HtmlLanguageStubDefinition.kt b/xml/xml-parser/src/com/intellij/psi/xml/HtmlLanguageStubDefinition.kt
new file mode 100644
index 000000000000..e4707ad74b79
--- /dev/null
+++ b/xml/xml-parser/src/com/intellij/psi/xml/HtmlLanguageStubDefinition.kt
@@ -0,0 +1,47 @@
+// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package com.intellij.psi.xml
+
+import com.intellij.psi.StubBuilder
+import com.intellij.psi.stubs.DefaultStubBuilder
+import com.intellij.psi.stubs.LanguageStubDefinition
+import com.intellij.psi.stubs.StubElementRegistryService
+import com.intellij.psi.tree.IElementType
+import com.intellij.psi.tree.IElementType.enumerate
+import com.intellij.psi.tree.IFileElementType
+
+class HtmlLanguageStubDefinition : LanguageStubDefinition {
+ override val stubVersion: Int
+ get() = getHtmlStubVersion() + 3
+
+ override val builder: StubBuilder
+ get() = DefaultStubBuilder()
+
+ companion object {
+ @Volatile
+ private var stubVersion = -1
+
+ @JvmStatic
+ fun getHtmlStubVersion(): Int {
+ val version = stubVersion
+ if (version != -1)
+ return version
+
+ val result = enumerate { it is IFileElementType && isAcceptable(it) }
+ .mapNotNull { StubElementRegistryService.getInstance().getStubDescriptor(it.language)?.stubDefinition }
+ .sumOf { it.stubVersion }
+
+ stubVersion = result
+
+ return result
+ }
+
+ @JvmStatic
+ fun isAcceptable(elementType: IElementType): Boolean {
+ val id = elementType.language.id
+
+ //hardcoded values as in BaseHtmlLexer
+ //js and css dialect uses the same stub id as the parent language
+ return id == "JavaScript" || id == "CSS"
+ }
+ }
+}
\ No newline at end of file
diff --git a/xml/xml-parser/src/com/intellij/psi/xml/HtmlStubRegistryExtension.kt b/xml/xml-parser/src/com/intellij/psi/xml/HtmlStubRegistryExtension.kt
new file mode 100644
index 000000000000..10e219e1e54b
--- /dev/null
+++ b/xml/xml-parser/src/com/intellij/psi/xml/HtmlStubRegistryExtension.kt
@@ -0,0 +1,36 @@
+// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package com.intellij.psi.xml
+
+import com.intellij.psi.stubs.IndexSink
+import com.intellij.psi.stubs.PsiFileStub
+import com.intellij.psi.stubs.PsiFileStubImpl
+import com.intellij.psi.stubs.StubElement
+import com.intellij.psi.stubs.StubInputStream
+import com.intellij.psi.stubs.StubOutputStream
+import com.intellij.psi.stubs.StubRegistry
+import com.intellij.psi.stubs.StubRegistryExtension
+import com.intellij.psi.stubs.StubSerializer
+import com.intellij.psi.stubs.StubSerializerId
+import com.intellij.psi.xml.XmlElementType.HTML_FILE
+
+class HtmlStubRegistryExtension : StubRegistryExtension {
+ override fun register(registry: StubRegistry) {
+ registry.registerStubSerializer(HTML_FILE, HtmlFileStubSerializer())
+ }
+
+ private class HtmlFileStubSerializer : StubSerializer> {
+ override fun getExternalId(): String {
+ return StubSerializerId.DEFAULT_EXTERNAL_ID
+ }
+
+ override fun serialize(stub: PsiFileStub<*>, dataStream: StubOutputStream) {
+ }
+
+ override fun deserialize(dataStream: StubInputStream, parentStub: StubElement<*>?): PsiFileStub<*> {
+ return PsiFileStubImpl(null)
+ }
+
+ override fun indexStub(stub: PsiFileStub<*>, sink: IndexSink) {
+ }
+ }
+}
\ No newline at end of file
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/html/BackendHtmlElementFactory.kt b/xml/xml-psi-impl/src/com/intellij/lang/html/BackendHtmlElementFactory.kt
index 665c3bd85fe0..2ae607b77c8d 100644
--- a/xml/xml-psi-impl/src/com/intellij/lang/html/BackendHtmlElementFactory.kt
+++ b/xml/xml-psi-impl/src/com/intellij/lang/html/BackendHtmlElementFactory.kt
@@ -24,7 +24,7 @@ class BackendHtmlElementFactory:
val elementType = node.elementType
return when {
- elementType is XmlStubBasedElementType<*, *>
+ elementType is XmlStubBasedElementType<*>
-> elementType.createPsi(node)
elementType is HtmlCustomEmbeddedContentTokenType
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/stubs/HtmlStubBasedTagStubFactory.kt b/xml/xml-psi-impl/src/com/intellij/lang/stubs/HtmlStubBasedTagStubFactory.kt
new file mode 100644
index 000000000000..9e1b7a552bb8
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/lang/stubs/HtmlStubBasedTagStubFactory.kt
@@ -0,0 +1,17 @@
+// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package com.intellij.lang.stubs
+
+import com.intellij.psi.PsiElement
+import com.intellij.psi.impl.source.html.HtmlStubBasedTagImpl
+import com.intellij.psi.impl.source.xml.stub.XmlTagStubImpl
+import com.intellij.psi.stubs.StubElement
+import com.intellij.psi.stubs.StubElementFactory
+import com.intellij.psi.tree.IElementType
+
+open class HtmlStubBasedTagStubFactory(val elementType: IElementType) : StubElementFactory {
+ override fun createStub(psi: HtmlStubBasedTagImpl, parentStub: StubElement?): XmlTagStubImpl =
+ XmlTagStubImpl(psi, parentStub, elementType)
+
+ override fun createPsi(stub: XmlTagStubImpl): HtmlStubBasedTagImpl =
+ HtmlStubBasedTagImpl(stub, elementType)
+}
\ No newline at end of file
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/stubs/HtmlStubBasedTagStubSerializer.kt b/xml/xml-psi-impl/src/com/intellij/lang/stubs/HtmlStubBasedTagStubSerializer.kt
new file mode 100644
index 000000000000..e5ca95e3581c
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/lang/stubs/HtmlStubBasedTagStubSerializer.kt
@@ -0,0 +1,17 @@
+// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package com.intellij.lang.stubs
+
+import com.intellij.psi.impl.source.xml.stub.XmlTagStubImpl
+import com.intellij.psi.stubs.StubElement
+import com.intellij.psi.stubs.StubInputStream
+import com.intellij.psi.stubs.StubOutputStream
+import com.intellij.psi.tree.IElementType
+
+open class HtmlStubBasedTagStubSerializer(elementType: IElementType) : XmlStubBasedStubSerializer(elementType) {
+ override fun serialize(stub: XmlTagStubImpl, dataStream: StubOutputStream) {
+ stub.serialize(dataStream)
+ }
+
+ override fun deserialize(dataStream: StubInputStream, parentStub: StubElement<*>?): XmlTagStubImpl =
+ XmlTagStubImpl(parentStub, dataStream, elementType)
+}
\ No newline at end of file
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/stubs/XmlStubBasedAttributeStubFactory.kt b/xml/xml-psi-impl/src/com/intellij/lang/stubs/XmlStubBasedAttributeStubFactory.kt
new file mode 100644
index 000000000000..473451aa7af7
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/lang/stubs/XmlStubBasedAttributeStubFactory.kt
@@ -0,0 +1,17 @@
+// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package com.intellij.lang.stubs
+
+import com.intellij.psi.PsiElement
+import com.intellij.psi.impl.source.xml.XmlStubBasedAttribute
+import com.intellij.psi.impl.source.xml.stub.XmlAttributeStubImpl
+import com.intellij.psi.stubs.StubElement
+import com.intellij.psi.stubs.StubElementFactory
+import com.intellij.psi.tree.IElementType
+
+open class XmlStubBasedAttributeStubFactory(val elementType: IElementType) : StubElementFactory {
+ override fun createStub(psi: XmlStubBasedAttribute, parentStub: StubElement?): XmlAttributeStubImpl =
+ XmlAttributeStubImpl(psi, parentStub, elementType)
+
+ override fun createPsi(stub: XmlAttributeStubImpl): XmlStubBasedAttribute =
+ XmlStubBasedAttribute(stub, elementType)
+}
\ No newline at end of file
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/stubs/XmlStubBasedAttributeStubSerializer.kt b/xml/xml-psi-impl/src/com/intellij/lang/stubs/XmlStubBasedAttributeStubSerializer.kt
new file mode 100644
index 000000000000..44eb71aa2a9b
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/lang/stubs/XmlStubBasedAttributeStubSerializer.kt
@@ -0,0 +1,17 @@
+// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package com.intellij.lang.stubs
+
+import com.intellij.psi.impl.source.xml.stub.XmlAttributeStubImpl
+import com.intellij.psi.stubs.StubElement
+import com.intellij.psi.stubs.StubInputStream
+import com.intellij.psi.stubs.StubOutputStream
+import com.intellij.psi.tree.IElementType
+
+open class XmlStubBasedAttributeStubSerializer(elementType: IElementType) : XmlStubBasedStubSerializer(elementType) {
+ override fun serialize(stub: XmlAttributeStubImpl, dataStream: StubOutputStream) {
+ stub.serialize(dataStream)
+ }
+
+ override fun deserialize(dataStream: StubInputStream, parentStub: StubElement<*>?): XmlAttributeStubImpl =
+ XmlAttributeStubImpl(parentStub, dataStream, elementType)
+}
\ No newline at end of file
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/stubs/XmlStubBasedStubSerializer.kt b/xml/xml-psi-impl/src/com/intellij/lang/stubs/XmlStubBasedStubSerializer.kt
new file mode 100644
index 000000000000..b0e87ed392f6
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/lang/stubs/XmlStubBasedStubSerializer.kt
@@ -0,0 +1,15 @@
+// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package com.intellij.lang.stubs
+
+import com.intellij.psi.stubs.IndexSink
+import com.intellij.psi.stubs.StubElement
+import com.intellij.psi.stubs.StubSerializer
+import com.intellij.psi.tree.IElementType
+
+abstract class XmlStubBasedStubSerializer>(val elementType: IElementType) : StubSerializer {
+ override fun getExternalId(): String =
+ elementType.toString()
+
+ override fun indexStub(stub: T, sink: IndexSink) {
+ }
+}
\ No newline at end of file
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/stubs/XmlStubBasedTagStubFactory.kt b/xml/xml-psi-impl/src/com/intellij/lang/stubs/XmlStubBasedTagStubFactory.kt
new file mode 100644
index 000000000000..918157bf2d0b
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/lang/stubs/XmlStubBasedTagStubFactory.kt
@@ -0,0 +1,17 @@
+// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package com.intellij.lang.stubs
+
+import com.intellij.psi.PsiElement
+import com.intellij.psi.impl.source.xml.XmlStubBasedTag
+import com.intellij.psi.impl.source.xml.stub.XmlTagStubImpl
+import com.intellij.psi.stubs.StubElement
+import com.intellij.psi.stubs.StubElementFactory
+import com.intellij.psi.tree.IElementType
+
+open class XmlStubBasedTagStubFactory(val elementType: IElementType) : StubElementFactory {
+ override fun createStub(psi: XmlStubBasedTag, parentStub: StubElement?): XmlTagStubImpl =
+ XmlTagStubImpl(psi, parentStub, elementType)
+
+ override fun createPsi(stub: XmlTagStubImpl): XmlStubBasedTag =
+ XmlStubBasedTag(stub, elementType)
+}
\ No newline at end of file
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/stubs/XmlStubBasedTagStubSerializer.kt b/xml/xml-psi-impl/src/com/intellij/lang/stubs/XmlStubBasedTagStubSerializer.kt
new file mode 100644
index 000000000000..1014b31a5ba9
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/lang/stubs/XmlStubBasedTagStubSerializer.kt
@@ -0,0 +1,18 @@
+// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package com.intellij.lang.stubs
+
+import com.intellij.psi.impl.source.xml.stub.XmlTagStubImpl
+import com.intellij.psi.stubs.StubElement
+import com.intellij.psi.stubs.StubInputStream
+import com.intellij.psi.stubs.StubOutputStream
+import com.intellij.psi.tree.IElementType
+
+open class XmlStubBasedTagStubSerializer(elementType: IElementType) : XmlStubBasedStubSerializer(elementType) {
+ override fun serialize(stub: XmlTagStubImpl, dataStream: StubOutputStream) {
+ stub.serialize(dataStream)
+ }
+
+ override fun deserialize(dataStream: StubInputStream, parentStub: StubElement<*>?): XmlTagStubImpl {
+ return XmlTagStubImpl(parentStub, dataStream, elementType)
+ }
+}
\ No newline at end of file
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xml/BackendXmlElementFactory.kt b/xml/xml-psi-impl/src/com/intellij/lang/xml/BackendXmlElementFactory.kt
index bbddc8bbb261..bc46e9ad8a71 100644
--- a/xml/xml-psi-impl/src/com/intellij/lang/xml/BackendXmlElementFactory.kt
+++ b/xml/xml-psi-impl/src/com/intellij/lang/xml/BackendXmlElementFactory.kt
@@ -22,7 +22,7 @@ class BackendXmlElementFactory :
val elementType = node.elementType
return when (elementType) {
- is XmlStubBasedElementType<*, *>,
+ is XmlStubBasedElementType<*>,
-> elementType.createPsi(node)
else -> throw UnsupportedNodeElementTypeException(node)
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlStubBasedTagElementType.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlStubBasedTagElementType.java
index e87e66c6315d..7f3fdc567c0e 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlStubBasedTagElementType.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlStubBasedTagElementType.java
@@ -4,47 +4,20 @@ package com.intellij.psi.impl.source.html;
import com.intellij.lang.ASTNode;
import com.intellij.lang.Language;
import com.intellij.psi.impl.source.xml.stub.XmlStubBasedElementType;
-import com.intellij.psi.impl.source.xml.stub.XmlTagStubImpl;
-import com.intellij.psi.stubs.StubElement;
-import com.intellij.psi.stubs.StubInputStream;
-import com.intellij.psi.stubs.StubOutputStream;
import com.intellij.psi.tree.ICompositeElementType;
import com.intellij.psi.xml.IXmlTagElementType;
import org.jetbrains.annotations.NotNull;
-import java.io.IOException;
-
public class HtmlStubBasedTagElementType
- extends XmlStubBasedElementType implements ICompositeElementType, IXmlTagElementType {
+ extends XmlStubBasedElementType implements ICompositeElementType, IXmlTagElementType {
public HtmlStubBasedTagElementType(@NotNull String debugName,
@NotNull Language language) {
super(debugName, language);
}
- @Override
- public void serialize(@NotNull XmlTagStubImpl stub, @NotNull StubOutputStream dataStream) throws IOException {
- stub.serialize(dataStream);
- }
-
- @Override
- public @NotNull XmlTagStubImpl deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
- return new XmlTagStubImpl(parentStub, dataStream, this);
- }
-
- @Override
- public @NotNull HtmlStubBasedTagImpl createPsi(@NotNull XmlTagStubImpl stub) {
- return new HtmlStubBasedTagImpl(stub, this);
- }
-
@Override
public @NotNull HtmlStubBasedTagImpl createPsi(@NotNull ASTNode node) {
return new HtmlStubBasedTagImpl(node);
}
-
- @Override
- public @NotNull XmlTagStubImpl createStub(@NotNull HtmlStubBasedTagImpl psi, StubElement parentStub) {
- return new XmlTagStubImpl(psi, parentStub, this);
- }
-
}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlStubBasedTagImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlStubBasedTagImpl.java
index 941ebd786b3e..bc8628130d2f 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlStubBasedTagImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlStubBasedTagImpl.java
@@ -7,7 +7,7 @@ import com.intellij.psi.impl.source.tree.TreeElement;
import com.intellij.psi.impl.source.xml.XmlStubBasedTag;
import com.intellij.psi.impl.source.xml.XmlTagDelegate;
import com.intellij.psi.impl.source.xml.stub.XmlTagStubImpl;
-import com.intellij.psi.stubs.IStubElementType;
+import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.xml.XmlTag;
import com.intellij.xml.util.XmlUtil;
@@ -17,7 +17,7 @@ import org.jetbrains.annotations.Nullable;
public class HtmlStubBasedTagImpl extends XmlStubBasedTag implements HtmlTag {
public HtmlStubBasedTagImpl(@NotNull XmlTagStubImpl stub,
- @NotNull IStubElementType extends XmlTagStubImpl, ? extends HtmlStubBasedTagImpl> nodeType) {
+ @NotNull IElementType nodeType) {
super(stub, nodeType);
}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedAttribute.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedAttribute.java
index 798e32cb7d46..d15c728225ca 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedAttribute.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedAttribute.java
@@ -3,14 +3,14 @@ package com.intellij.psi.impl.source.xml;
import com.intellij.lang.ASTNode;
import com.intellij.psi.impl.source.xml.stub.XmlAttributeStubImpl;
-import com.intellij.psi.stubs.IStubElementType;
+import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class XmlStubBasedAttribute extends XmlStubBasedAttributeBase {
public XmlStubBasedAttribute(@NotNull XmlAttributeStubImpl stub,
- @NotNull IStubElementType extends XmlAttributeStubImpl, ? extends XmlStubBasedAttribute> nodeType) {
+ @NotNull IElementType nodeType) {
super(stub, nodeType);
}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedAttributeBase.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedAttributeBase.java
index 837709b30791..771cafb8ce8b 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedAttributeBase.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedAttributeBase.java
@@ -5,8 +5,8 @@ import com.intellij.lang.ASTNode;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.xml.stub.XmlAttributeStub;
-import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.stubs.PsiFileStub;
+import com.intellij.psi.tree.IElementType;
import com.intellij.psi.xml.*;
import com.intellij.util.ArrayUtil;
import com.intellij.util.IncorrectOperationException;
@@ -26,7 +26,7 @@ public class XmlStubBasedAttributeBase>
private volatile @Nullable XmlAttributeDelegate myImpl;
public XmlStubBasedAttributeBase(@NotNull StubT stub,
- @NotNull IStubElementType extends StubT, ? extends XmlAttribute> nodeType) {
+ @NotNull IElementType nodeType) {
super(stub, nodeType);
}
@@ -47,6 +47,11 @@ public class XmlStubBasedAttributeBase>
return new XmlStubBasedAttributeBaseDelegate();
}
+ @Override
+ public IElementType getIElementType() {
+ return getElementTypeImpl();
+ }
+
@Override
public XmlAttributeValue getValueElement() {
return (XmlAttributeValue)XmlChildRole.ATTRIBUTE_VALUE_FINDER.findChild(this.getNode());
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedElement.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedElement.java
index 78dde24747e1..e18b63e8bce5 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedElement.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedElement.java
@@ -8,8 +8,8 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.PsiElementProcessor;
import com.intellij.psi.search.SearchScope;
-import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.stubs.StubElement;
+import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.PsiUtilCore;
import com.intellij.psi.xml.XmlElement;
import com.intellij.psi.xml.XmlTag;
@@ -30,7 +30,7 @@ import java.util.List;
public abstract class XmlStubBasedElement> extends StubBasedPsiElementBase implements XmlElement {
XmlStubBasedElement(@NotNull T stub,
- @NotNull IStubElementType nodeType) {
+ @NotNull IElementType nodeType) {
super(stub, nodeType);
}
@@ -123,6 +123,6 @@ public abstract class XmlStubBasedElement> extends Stub
@Override
public String toString() {
- return "PsiElement" + "(" + getElementType() + ")";
+ return "PsiElement" + "(" + getElementTypeImpl() + ")";
}
}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedTag.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedTag.java
index 797b609640be..6bfc16e5a858 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedTag.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedTag.java
@@ -3,13 +3,13 @@ package com.intellij.psi.impl.source.xml;
import com.intellij.lang.ASTNode;
import com.intellij.psi.impl.source.xml.stub.XmlTagStubImpl;
-import com.intellij.psi.stubs.IStubElementType;
+import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
public class XmlStubBasedTag extends XmlStubBasedTagBase {
public XmlStubBasedTag(@NotNull XmlTagStubImpl stub,
- @NotNull IStubElementType extends XmlTagStubImpl, ? extends XmlStubBasedTag> nodeType) {
+ @NotNull IElementType nodeType) {
super(stub, nodeType);
}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedTagBase.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedTagBase.java
index 9357000421c4..770936140340 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedTagBase.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlStubBasedTagBase.java
@@ -7,8 +7,8 @@ import com.intellij.psi.impl.meta.MetaRegistry;
import com.intellij.psi.impl.source.tree.TreeElement;
import com.intellij.psi.impl.source.xml.stub.XmlTagStub;
import com.intellij.psi.meta.PsiMetaData;
-import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.stubs.PsiFileStub;
+import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.CachedValueProvider.Result;
import com.intellij.psi.util.CachedValuesManager;
import com.intellij.psi.util.PsiModificationTracker;
@@ -39,7 +39,7 @@ public class XmlStubBasedTagBase>
private volatile XmlTagValue myValue;
private volatile XmlAttribute[] myAttributes;
- XmlStubBasedTagBase(@NotNull StubT stub, @NotNull IStubElementType nodeType) {
+ XmlStubBasedTagBase(@NotNull StubT stub, @NotNull IElementType nodeType) {
super(stub, nodeType);
}
@@ -282,6 +282,11 @@ public class XmlStubBasedTagBase>
}
}
+ @Override
+ public IElementType getIElementType() {
+ return getElementTypeImpl();
+ }
+
@Override
public String toString() {
return "XmlTag:" + getName();
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlAttributeStubImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlAttributeStubImpl.java
index 26399ff18ddc..2881b97c80d2 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlAttributeStubImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlAttributeStubImpl.java
@@ -3,6 +3,7 @@ package com.intellij.psi.impl.source.xml.stub;
import com.intellij.psi.impl.source.xml.XmlStubBasedAttribute;
import com.intellij.psi.stubs.*;
+import com.intellij.psi.tree.IElementType;
import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -18,7 +19,7 @@ public class XmlAttributeStubImpl extends StubBase implem
public XmlAttributeStubImpl(@Nullable StubElement> parent,
@NotNull StubInputStream dataStream,
- @NotNull IStubElementType extends XmlAttributeStubImpl, ? extends XmlStubBasedAttribute> elementType)
+ @NotNull IElementType elementType)
throws IOException {
super(parent, elementType);
name = notNull(StringRef.toString(dataStream.readName()), "");
@@ -27,13 +28,13 @@ public class XmlAttributeStubImpl extends StubBase implem
public XmlAttributeStubImpl(@NotNull XmlStubBasedAttribute psi,
@Nullable StubElement> parent,
- @NotNull IStubElementType extends XmlAttributeStubImpl, ? extends XmlStubBasedAttribute> elementType) {
+ @NotNull IElementType elementType) {
super(parent, elementType);
name = psi.getName();
value = psi.getValue();
}
- void serialize(StubOutputStream stream) throws IOException {
+ public void serialize(StubOutputStream stream) throws IOException {
stream.writeName(name);
stream.writeName(value);
}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlStubBasedAttributeElementType.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlStubBasedAttributeElementType.java
index cc06c30d2388..c0fb4bb0fc2c 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlStubBasedAttributeElementType.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlStubBasedAttributeElementType.java
@@ -4,17 +4,12 @@ package com.intellij.psi.impl.source.xml.stub;
import com.intellij.lang.ASTNode;
import com.intellij.lang.Language;
import com.intellij.psi.impl.source.xml.XmlStubBasedAttribute;
-import com.intellij.psi.stubs.StubElement;
-import com.intellij.psi.stubs.StubInputStream;
-import com.intellij.psi.stubs.StubOutputStream;
import com.intellij.psi.tree.ICompositeElementType;
import com.intellij.psi.xml.IXmlAttributeElementType;
import org.jetbrains.annotations.NotNull;
-import java.io.IOException;
-
public class XmlStubBasedAttributeElementType
- extends XmlStubBasedElementType implements ICompositeElementType, IXmlAttributeElementType {
+ extends XmlStubBasedElementType implements ICompositeElementType, IXmlAttributeElementType {
public XmlStubBasedAttributeElementType(@NotNull String debugName,
@@ -22,29 +17,8 @@ public class XmlStubBasedAttributeElementType
super(debugName, language);
}
- @Override
- public void serialize(@NotNull XmlAttributeStubImpl stub, @NotNull StubOutputStream dataStream) throws IOException {
- stub.serialize(dataStream);
- }
-
- @Override
- public @NotNull XmlAttributeStubImpl deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
- return new XmlAttributeStubImpl(parentStub, dataStream, this);
- }
-
- @Override
- public @NotNull XmlStubBasedAttribute createPsi(@NotNull XmlAttributeStubImpl stub) {
- return new XmlStubBasedAttribute(stub, this);
- }
-
@Override
public @NotNull XmlStubBasedAttribute createPsi(@NotNull ASTNode node) {
return new XmlStubBasedAttribute(node);
}
-
- @Override
- public @NotNull XmlAttributeStubImpl createStub(@NotNull XmlStubBasedAttribute psi, StubElement parentStub) {
- return new XmlAttributeStubImpl(psi, parentStub, this);
- }
-
}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlStubBasedElementType.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlStubBasedElementType.java
index 1d361fd9e3eb..71c71d2a29cb 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlStubBasedElementType.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlStubBasedElementType.java
@@ -6,16 +6,14 @@ import com.intellij.lang.Language;
import com.intellij.lang.xml.XMLLanguage;
import com.intellij.psi.PsiElement;
import com.intellij.psi.impl.source.tree.CompositeElement;
-import com.intellij.psi.stubs.IStubElementType;
-import com.intellij.psi.stubs.IndexSink;
-import com.intellij.psi.stubs.StubElement;
import com.intellij.psi.tree.ICompositeElementType;
+import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
import java.util.Locale;
-public abstract class XmlStubBasedElementType, PsiT extends PsiElement>
- extends IStubElementType implements ICompositeElementType {
+public abstract class XmlStubBasedElementType
+ extends IElementType implements ICompositeElementType {
private String externalId = null;
@@ -25,22 +23,13 @@ public abstract class XmlStubBasedElementType, PsiT
}
@Override
- public @NotNull String getExternalId() {
+ public @NotNull String toString() {
if (externalId == null) {
externalId = (getLanguage() == XMLLanguage.INSTANCE ? "" : getLanguage().getID().toUpperCase(Locale.ENGLISH) + ":") + getDebugName();
}
return externalId;
}
- @Override
- public String toString() {
- return getExternalId();
- }
-
- @Override
- public void indexStub(@NotNull StubT stub, @NotNull IndexSink sink) {
- }
-
public abstract @NotNull PsiT createPsi(@NotNull ASTNode node);
@Override
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlStubBasedTagElementType.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlStubBasedTagElementType.java
index 509f361f2f78..7be218065b3d 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlStubBasedTagElementType.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlStubBasedTagElementType.java
@@ -4,46 +4,20 @@ package com.intellij.psi.impl.source.xml.stub;
import com.intellij.lang.ASTNode;
import com.intellij.lang.Language;
import com.intellij.psi.impl.source.xml.XmlStubBasedTag;
-import com.intellij.psi.stubs.StubElement;
-import com.intellij.psi.stubs.StubInputStream;
-import com.intellij.psi.stubs.StubOutputStream;
import com.intellij.psi.tree.ICompositeElementType;
import com.intellij.psi.xml.IXmlTagElementType;
import org.jetbrains.annotations.NotNull;
-import java.io.IOException;
-
public class XmlStubBasedTagElementType
- extends XmlStubBasedElementType implements ICompositeElementType, IXmlTagElementType {
+ extends XmlStubBasedElementType implements ICompositeElementType, IXmlTagElementType {
public XmlStubBasedTagElementType(@NotNull String debugName,
@NotNull Language language) {
super(debugName, language);
}
- @Override
- public void serialize(@NotNull XmlTagStubImpl stub, @NotNull StubOutputStream dataStream) throws IOException {
- stub.serialize(dataStream);
- }
-
- @Override
- public @NotNull XmlTagStubImpl deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
- return new XmlTagStubImpl(parentStub, dataStream, this);
- }
-
- @Override
- public @NotNull XmlStubBasedTag createPsi(@NotNull XmlTagStubImpl stub) {
- return new XmlStubBasedTag(stub, this);
- }
-
@Override
public @NotNull XmlStubBasedTag createPsi(@NotNull ASTNode node) {
return new XmlStubBasedTag(node);
}
-
- @Override
- public @NotNull XmlTagStubImpl createStub(@NotNull XmlStubBasedTag psi, StubElement parentStub) {
- return new XmlTagStubImpl(psi, parentStub, this);
- }
-
}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlTagStubImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlTagStubImpl.java
index d6ca8119e881..118f50ce1c8b 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlTagStubImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/stub/XmlTagStubImpl.java
@@ -3,6 +3,7 @@ package com.intellij.psi.impl.source.xml.stub;
import com.intellij.psi.impl.source.xml.XmlStubBasedTag;
import com.intellij.psi.stubs.*;
+import com.intellij.psi.tree.IElementType;
import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -17,7 +18,7 @@ public class XmlTagStubImpl extends StubBase implements XmlTagS
public XmlTagStubImpl(@Nullable StubElement> parent,
@NotNull StubInputStream dataStream,
- @NotNull IStubElementType extends XmlTagStubImpl, ? extends XmlStubBasedTag> elementType)
+ @NotNull IElementType elementType)
throws IOException {
super(parent, elementType);
name = notNull(StringRef.toString(dataStream.readName()), "");
@@ -25,7 +26,7 @@ public class XmlTagStubImpl extends StubBase implements XmlTagS
public XmlTagStubImpl(@NotNull XmlStubBasedTag psi,
@Nullable StubElement> parent,
- @NotNull IStubElementType extends XmlTagStubImpl, ? extends XmlStubBasedTag> elementType) {
+ @NotNull IElementType elementType) {
super(parent, elementType);
name = psi.getName();
}