mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
[polySymbols] WEB-73607 Cleanup class names in com.intellij.html.polySymbols.* packages
GitOrigin-RevId: 3c9d650c2c6b8efbbbf1467fc4fbcaa2d5a67f68
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7aba9a9102
commit
7c226c4cac
@@ -6,7 +6,7 @@ import com.intellij.codeInsight.completion.CompletionResultSet
|
||||
import com.intellij.codeInsight.completion.XmlAttributeInsertHandler
|
||||
import com.intellij.codeInsight.completion.XmlTagInsertHandler
|
||||
import com.intellij.html.polySymbols.HtmlDescriptorUtils.getStandardHtmlAttributeDescriptors
|
||||
import com.intellij.html.polySymbols.PolySymbolsFrameworkHtmlSupport
|
||||
import com.intellij.html.polySymbols.HtmlFrameworkSymbolsSupport
|
||||
import com.intellij.html.polySymbols.HtmlSymbolQueryConfigurator
|
||||
import com.intellij.polySymbols.PolySymbolModifier
|
||||
import com.intellij.polySymbols.html.HTML_ATTRIBUTES
|
||||
@@ -38,7 +38,7 @@ class HtmlAttributeSymbolsCompletionProvider : PolySymbolsCompletionProviderBase
|
||||
|
||||
val providedAttributes = tag.attributes.asSequence().mapNotNull { it.name }.toMutableSet()
|
||||
|
||||
val attributesFilter = PolySymbolsFrameworkHtmlSupport.get(queryExecutor.framework)
|
||||
val attributesFilter = HtmlFrameworkSymbolsSupport.get(queryExecutor.framework)
|
||||
.getAttributeNameCodeCompletionFilter(tag)
|
||||
|
||||
val filteredOutStandardSymbols = getStandardHtmlAttributeDescriptors(tag)
|
||||
@@ -78,7 +78,7 @@ class HtmlAttributeSymbolsCompletionProvider : PolySymbolsCompletionProviderBase
|
||||
.exclude(PolySymbolModifier.ABSTRACT)
|
||||
.run()
|
||||
.asSingleSymbol() ?: return@runWithTimeoutOrNull null
|
||||
PolySymbolHtmlAttributeInfo.create(fullName, freshRegistry, match, insertionContext.file)
|
||||
HtmlAttributeSymbolInfo.create(fullName, freshRegistry, match, insertionContext.file)
|
||||
}
|
||||
if (info != null && info.acceptsValue && !info.acceptsNoValue) {
|
||||
XmlAttributeInsertHandler.INSTANCE.handleInsert(insertionContext, lookupItem)
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.codeInspection.XmlQuickFixFactory;
|
||||
import com.intellij.html.polySymbols.elements.PolySymbolElementDescriptor;
|
||||
import com.intellij.html.polySymbols.elements.HtmlElementSymbolDescriptor;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -84,8 +84,8 @@ public class HtmlUnknownTagInspectionBase extends HtmlUnknownElementInspection {
|
||||
|
||||
if (isAbstractDescriptor(ownDescriptor) ||
|
||||
((parentDescriptor instanceof HtmlElementDescriptorImpl
|
||||
|| parentDescriptor instanceof PolySymbolElementDescriptor polySymbolElementDescriptor
|
||||
&& !polySymbolElementDescriptor.isCustomElement()) &&
|
||||
|| parentDescriptor instanceof HtmlElementSymbolDescriptor htmlElementSymbolDescriptor
|
||||
&& !htmlElementSymbolDescriptor.isCustomElement()) &&
|
||||
ownDescriptor instanceof HtmlElementDescriptorImpl &&
|
||||
isAbstractDescriptor(descriptorFromContext))) {
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
targetClass="com.intellij.model.Symbol"
|
||||
implementationClass="com.intellij.xml.impl.XmlNamedReferenceProvider"/>
|
||||
|
||||
<multiHostInjector implementation="com.intellij.html.polySymbols.PolySymbolsHtmlTextInjector"
|
||||
<multiHostInjector implementation="com.intellij.html.polySymbols.HtmlSymbolsTextInjector"
|
||||
order="before JSConfigurationInjector, after TemporaryPlacesInjector"
|
||||
id="PolySymbolsHtmlText"/>
|
||||
|
||||
@@ -110,9 +110,9 @@
|
||||
id="html"
|
||||
implementation="com.intellij.html.polySymbols.HtmlSymbolQueryConfigurator$HtmlCodeCompletionItemCustomizer"/>
|
||||
<xml.attributeDescriptorsProvider
|
||||
implementation="com.intellij.html.polySymbols.attributes.PolySymbolAttributeDescriptorsProvider"/>
|
||||
implementation="com.intellij.html.polySymbols.attributes.HtmlAttributeSymbolDescriptorsProvider"/>
|
||||
<xml.elementDescriptorProvider
|
||||
implementation="com.intellij.html.polySymbols.elements.PolySymbolElementDescriptorsProvider"/>
|
||||
implementation="com.intellij.html.polySymbols.elements.HtmlElementSymbolDescriptorsProvider"/>
|
||||
|
||||
<polySymbols.psiReferenceProvider hostElementClass="com.intellij.psi.xml.XmlTag"
|
||||
hostLanguage="HtmlCompatible"
|
||||
@@ -123,8 +123,8 @@
|
||||
<polySymbols.psiReferenceProvider hostElementClass="com.intellij.psi.xml.XmlAttributeValue"
|
||||
hostLanguage="HtmlCompatible"
|
||||
implementationClass="com.intellij.html.polySymbols.attributeValues.HtmlAttributeValueSymbolReferenceProvider"/>
|
||||
<vetoRenameCondition implementation="com.intellij.html.polySymbols.HtmlPolySymbolRenameHandlerVeto"/>
|
||||
<xml.xmlExtension implementation="com.intellij.html.polySymbols.PolySymbolsXmlExtension" id="poly-symbols"
|
||||
<vetoRenameCondition implementation="com.intellij.html.polySymbols.HtmlSymbolRenameHandlerVeto"/>
|
||||
<xml.xmlExtension implementation="com.intellij.html.polySymbols.HtmlSymbolsXmlExtension" id="poly-symbols"
|
||||
order="before html, after react"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.html.polySymbols
|
||||
|
||||
import com.intellij.html.polySymbols.elements.PolySymbolElementDescriptor
|
||||
import com.intellij.html.polySymbols.elements.HtmlElementSymbolDescriptor
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.ModificationTracker
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
@@ -47,7 +47,7 @@ object HtmlDescriptorUtils {
|
||||
private fun getHtmlElementDescriptor(tag: XmlTag): HtmlElementDescriptorImpl? =
|
||||
when (val tagDescriptor = tag.descriptor) {
|
||||
is HtmlElementDescriptorImpl -> tagDescriptor
|
||||
is PolySymbolElementDescriptor, is AnyXmlElementDescriptor -> {
|
||||
is HtmlElementSymbolDescriptor, is AnyXmlElementDescriptor -> {
|
||||
getStandardHtmlElementDescriptor(tag)
|
||||
?: getStandardHtmlElementDescriptor(tag, "div")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.html.polySymbols
|
||||
|
||||
import com.intellij.html.polySymbols.attributes.HtmlAttributeSymbolDescriptor
|
||||
import com.intellij.html.polySymbols.attributes.HtmlAttributeSymbolInfo
|
||||
import com.intellij.html.polySymbols.elements.HtmlElementSymbolDescriptor
|
||||
import com.intellij.html.polySymbols.elements.HtmlElementSymbolInfo
|
||||
import com.intellij.psi.xml.XmlTag
|
||||
import com.intellij.polySymbols.FrameworkId
|
||||
import com.intellij.polySymbols.framework.PolySymbolFramework
|
||||
import java.util.function.Predicate
|
||||
|
||||
interface HtmlFrameworkSymbolsSupport {
|
||||
|
||||
fun createHtmlAttributeDescriptor(info: HtmlAttributeSymbolInfo, tag: XmlTag?): HtmlAttributeSymbolDescriptor =
|
||||
HtmlAttributeSymbolDescriptor(info, tag)
|
||||
|
||||
fun createHtmlElementDescriptor(info: HtmlElementSymbolInfo, tag: XmlTag): HtmlElementSymbolDescriptor =
|
||||
HtmlElementSymbolDescriptor(info, tag)
|
||||
|
||||
fun getAttributeNameCodeCompletionFilter(tag: XmlTag): Predicate<String> = Predicate { true }
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun get(id: FrameworkId?): HtmlFrameworkSymbolsSupport =
|
||||
PolySymbolFramework.get(id ?: "") as? HtmlFrameworkSymbolsSupport
|
||||
?: DefaultHtmlSupport
|
||||
|
||||
}
|
||||
|
||||
private object DefaultHtmlSupport : HtmlFrameworkSymbolsSupport
|
||||
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
package com.intellij.html.polySymbols
|
||||
|
||||
import com.intellij.documentation.mdn.*
|
||||
import com.intellij.html.polySymbols.attributes.PolySymbolAttributeDescriptor
|
||||
import com.intellij.html.polySymbols.elements.PolySymbolElementDescriptor
|
||||
import com.intellij.html.polySymbols.attributes.HtmlAttributeSymbolDescriptor
|
||||
import com.intellij.html.polySymbols.elements.HtmlElementSymbolDescriptor
|
||||
import com.intellij.model.Pointer
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
@@ -67,7 +67,7 @@ class HtmlSymbolQueryConfigurator : PolySymbolQueryConfigurator {
|
||||
val element = (context as? XmlTag) ?: (context as? XmlAttribute)?.parent ?: return
|
||||
val elementScope =
|
||||
element.takeIf { queryExecutor.allowResolve }
|
||||
?.descriptor?.asSafely<PolySymbolElementDescriptor>()?.symbol?.queryScope
|
||||
?.descriptor?.asSafely<HtmlElementSymbolDescriptor>()?.symbol?.queryScope
|
||||
?: queryExecutor.nameMatchQuery(HTML_ELEMENTS, element.name)
|
||||
.exclude(PolySymbolModifier.ABSTRACT)
|
||||
.run()
|
||||
@@ -78,7 +78,7 @@ class HtmlSymbolQueryConfigurator : PolySymbolQueryConfigurator {
|
||||
val attribute = context as? XmlAttribute ?: return
|
||||
attribute.takeIf { queryExecutor.allowResolve }
|
||||
?.descriptor
|
||||
?.asSafely<PolySymbolAttributeDescriptor>()
|
||||
?.asSafely<HtmlAttributeSymbolDescriptor>()
|
||||
?.symbol
|
||||
?.queryScope
|
||||
?.forEach(consumer)
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.intellij.polySymbols.utils.PolySymbolScopeWithCache
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@ApiStatus.Experimental
|
||||
object PolySymbolsHtmlQueryHelper {
|
||||
object HtmlSymbolQueryHelper {
|
||||
|
||||
@JvmStatic
|
||||
fun getStandardHtmlElementSymbolsScope(
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.html.polySymbols
|
||||
|
||||
import com.intellij.html.polySymbols.attributes.PolySymbolAttributeDescriptor
|
||||
import com.intellij.html.polySymbols.elements.PolySymbolElementDescriptor
|
||||
import com.intellij.html.polySymbols.attributes.HtmlAttributeSymbolDescriptor
|
||||
import com.intellij.html.polySymbols.elements.HtmlElementSymbolDescriptor
|
||||
import com.intellij.lang.html.HtmlCompatibleFile
|
||||
import com.intellij.openapi.util.Condition
|
||||
import com.intellij.psi.PsiElement
|
||||
@@ -10,13 +10,13 @@ import com.intellij.psi.html.HtmlTag
|
||||
import com.intellij.psi.xml.XmlAttribute
|
||||
import com.intellij.polySymbols.utils.unwrapMatchedSymbols
|
||||
|
||||
class HtmlPolySymbolRenameHandlerVeto : Condition<PsiElement> {
|
||||
class HtmlSymbolRenameHandlerVeto : Condition<PsiElement> {
|
||||
|
||||
override fun value(t: PsiElement): Boolean {
|
||||
if (t.containingFile is HtmlCompatibleFile) {
|
||||
val symbol = when (val parent = t.takeIf { it is HtmlTag || it is XmlAttribute } ?: t.parent) {
|
||||
is HtmlTag -> (parent.descriptor as? PolySymbolElementDescriptor)?.symbol
|
||||
is XmlAttribute -> (parent.descriptor as? PolySymbolAttributeDescriptor)?.symbol
|
||||
is HtmlTag -> (parent.descriptor as? HtmlElementSymbolDescriptor)?.symbol
|
||||
is XmlAttribute -> (parent.descriptor as? HtmlAttributeSymbolDescriptor)?.symbol
|
||||
else -> null
|
||||
}
|
||||
if (symbol != null && symbol.unwrapMatchedSymbols().any {
|
||||
@@ -26,7 +26,7 @@ import com.intellij.psi.xml.XmlText
|
||||
import com.intellij.util.asSafely
|
||||
import java.util.*
|
||||
|
||||
class PolySymbolsHtmlTextInjector : MultiHostInjector {
|
||||
class HtmlSymbolsTextInjector : MultiHostInjector {
|
||||
|
||||
override fun getLanguagesToInject(registrar: MultiHostRegistrar, context: PsiElement) {
|
||||
val languageToInject =
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.html.polySymbols
|
||||
|
||||
import com.intellij.html.polySymbols.attributes.PolySymbolAttributeDescriptor
|
||||
import com.intellij.html.polySymbols.attributes.HtmlAttributeSymbolDescriptor
|
||||
import com.intellij.lang.html.HTMLLanguage
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.polySymbols.html.HTML_ATTRIBUTES
|
||||
@@ -11,7 +11,7 @@ import com.intellij.psi.impl.source.xml.SchemaPrefix
|
||||
import com.intellij.psi.xml.XmlTag
|
||||
import com.intellij.xml.HtmlXmlExtension
|
||||
|
||||
open class PolySymbolsXmlExtension : HtmlXmlExtension() {
|
||||
open class HtmlSymbolsXmlExtension : HtmlXmlExtension() {
|
||||
|
||||
override fun isAvailable(file: PsiFile?): Boolean =
|
||||
file?.let {
|
||||
@@ -23,7 +23,7 @@ open class PolySymbolsXmlExtension : HtmlXmlExtension() {
|
||||
if (tag == null || attrName == null) return false
|
||||
return tag.attributes.asSequence()
|
||||
.map { it.descriptor }
|
||||
.filterIsInstance<PolySymbolAttributeDescriptor>()
|
||||
.filterIsInstance<HtmlAttributeSymbolDescriptor>()
|
||||
.map { it.symbol }
|
||||
.flatMap { it.nameSegments.asSequence().filter { segment -> segment.problem == null } }
|
||||
.flatMap { it.symbols }
|
||||
@@ -34,7 +34,7 @@ open class PolySymbolsXmlExtension : HtmlXmlExtension() {
|
||||
if (namespacePrefix != null) {
|
||||
context.attributes
|
||||
.find { it.name.startsWith("$namespacePrefix:") }
|
||||
?.takeIf { it.descriptor is PolySymbolAttributeDescriptor }
|
||||
?.takeIf { it.descriptor is HtmlAttributeSymbolDescriptor }
|
||||
?.let { return SchemaPrefix(it, TextRange.create(0, namespacePrefix.length), namespacePrefix) }
|
||||
}
|
||||
return super.getPrefixDeclaration(context, namespacePrefix)
|
||||
@@ -1,33 +0,0 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.html.polySymbols
|
||||
|
||||
import com.intellij.html.polySymbols.attributes.PolySymbolAttributeDescriptor
|
||||
import com.intellij.html.polySymbols.attributes.PolySymbolHtmlAttributeInfo
|
||||
import com.intellij.html.polySymbols.elements.PolySymbolElementDescriptor
|
||||
import com.intellij.html.polySymbols.elements.PolySymbolHtmlElementInfo
|
||||
import com.intellij.psi.xml.XmlTag
|
||||
import com.intellij.polySymbols.FrameworkId
|
||||
import com.intellij.polySymbols.framework.PolySymbolFramework
|
||||
import java.util.function.Predicate
|
||||
|
||||
interface PolySymbolsFrameworkHtmlSupport {
|
||||
|
||||
fun createHtmlAttributeDescriptor(info: PolySymbolHtmlAttributeInfo, tag: XmlTag?): PolySymbolAttributeDescriptor =
|
||||
PolySymbolAttributeDescriptor(info, tag)
|
||||
|
||||
fun createHtmlElementDescriptor(info: PolySymbolHtmlElementInfo, tag: XmlTag): PolySymbolElementDescriptor =
|
||||
PolySymbolElementDescriptor(info, tag)
|
||||
|
||||
fun getAttributeNameCodeCompletionFilter(tag: XmlTag): Predicate<String> = Predicate { true }
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun get(id: FrameworkId?): PolySymbolsFrameworkHtmlSupport =
|
||||
PolySymbolFramework.get(id ?: "") as? PolySymbolsFrameworkHtmlSupport
|
||||
?: DefaultHtmlSupport
|
||||
|
||||
}
|
||||
|
||||
private object DefaultHtmlSupport : PolySymbolsFrameworkHtmlSupport
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.intellij.html.polySymbols.attributeValues
|
||||
|
||||
import com.intellij.html.polySymbols.attributes.PolySymbolAttributeDescriptor
|
||||
import com.intellij.html.polySymbols.attributes.HtmlAttributeSymbolDescriptor
|
||||
import com.intellij.polySymbols.html.HTML_ATTRIBUTE_VALUES
|
||||
import com.intellij.polySymbols.PolySymbol
|
||||
import com.intellij.polySymbols.PolySymbolModifier
|
||||
@@ -23,7 +23,7 @@ class HtmlAttributeValueSymbolReferenceProvider : PsiPolySymbolReferenceProvider
|
||||
|
||||
override fun getReferencedSymbol(psiElement: XmlAttributeValue): PolySymbol? {
|
||||
val attribute = psiElement.parentOfType<XmlAttribute>()
|
||||
val attributeDescriptor = attribute?.descriptor?.asSafely<PolySymbolAttributeDescriptor>() ?: return null
|
||||
val attributeDescriptor = attribute?.descriptor?.asSafely<HtmlAttributeSymbolDescriptor>() ?: return null
|
||||
val type = attributeDescriptor.symbol.htmlAttributeValue
|
||||
?.takeIf { it.kind == null || it.kind == PolySymbolHtmlAttributeValue.Kind.PLAIN }
|
||||
?.type?.takeIf { it == Type.ENUM || it == Type.SYMBOL }
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.intellij.html.polySymbols.attributeValues
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionParameters
|
||||
import com.intellij.codeInsight.completion.CompletionResultSet
|
||||
import com.intellij.html.polySymbols.attributes.PolySymbolAttributeDescriptor
|
||||
import com.intellij.html.polySymbols.attributes.HtmlAttributeSymbolDescriptor
|
||||
import com.intellij.polySymbols.html.HTML_ATTRIBUTE_VALUES
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
@@ -27,7 +27,7 @@ class HtmlAttributeValueSymbolsCompletionProvider : PolySymbolsCompletionProvide
|
||||
val patchedResultSet = result.withPrefixMatcher(result.prefixMatcher.cloneWithPrefix(name))
|
||||
|
||||
val attribute = context.parent as? XmlAttribute ?: return
|
||||
val attributeDescriptor = attribute.descriptor.asSafely<PolySymbolAttributeDescriptor>() ?: return
|
||||
val attributeDescriptor = attribute.descriptor.asSafely<HtmlAttributeSymbolDescriptor>() ?: return
|
||||
|
||||
val type = attributeDescriptor.symbol.htmlAttributeValue?.type?.takeIf { it == Type.ENUM || it == Type.SYMBOL }
|
||||
?: return
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
package com.intellij.html.polySymbols.attributes
|
||||
|
||||
import com.intellij.codeInspection.ProblemsHolder
|
||||
import com.intellij.html.polySymbols.PolySymbolsFrameworkHtmlSupport
|
||||
import com.intellij.html.polySymbols.HtmlFrameworkSymbolsSupport
|
||||
import com.intellij.html.polySymbols.HtmlSymbolQueryConfigurator
|
||||
import com.intellij.ide.nls.NlsMessages
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
@@ -22,7 +22,7 @@ import com.intellij.xml.impl.BasicXmlAttributeDescriptor
|
||||
import com.intellij.xml.impl.XmlAttributeDescriptorEx
|
||||
import javax.swing.Icon
|
||||
|
||||
open class PolySymbolAttributeDescriptor private constructor(val tag: XmlTag?,
|
||||
open class HtmlAttributeSymbolDescriptor private constructor(val tag: XmlTag?,
|
||||
private val name: String,
|
||||
val symbol: PolySymbol,
|
||||
private val acceptsNoValue: Boolean,
|
||||
@@ -35,7 +35,7 @@ open class PolySymbolAttributeDescriptor private constructor(val tag: XmlTag?,
|
||||
private val defaultValue: String?)
|
||||
: BasicXmlAttributeDescriptor(), XmlAttributeDescriptorEx, PsiPresentableMetaData {
|
||||
|
||||
constructor(info: PolySymbolHtmlAttributeInfo, tag: XmlTag?)
|
||||
constructor(info: HtmlAttributeSymbolInfo, tag: XmlTag?)
|
||||
: this(tag, info.name, info.symbol, info.acceptsNoValue, info.acceptsValue, info.enumValues,
|
||||
info.strictEnumValues, info.type, info.icon, info.required, info.defaultValue)
|
||||
|
||||
@@ -132,8 +132,8 @@ open class PolySymbolAttributeDescriptor private constructor(val tag: XmlTag?,
|
||||
|
||||
companion object {
|
||||
|
||||
fun PolySymbolHtmlAttributeInfo.toAttributeDescriptor(tag: XmlTag?) =
|
||||
PolySymbolsFrameworkHtmlSupport.get(this.symbol.origin.framework)
|
||||
fun HtmlAttributeSymbolInfo.toAttributeDescriptor(tag: XmlTag?) =
|
||||
HtmlFrameworkSymbolsSupport.get(this.symbol.origin.framework)
|
||||
.createHtmlAttributeDescriptor(this, tag)
|
||||
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
package com.intellij.html.polySymbols.attributes
|
||||
|
||||
import com.intellij.html.polySymbols.HtmlSymbolQueryConfigurator
|
||||
import com.intellij.html.polySymbols.attributes.PolySymbolAttributeDescriptor.Companion.toAttributeDescriptor
|
||||
import com.intellij.html.polySymbols.elements.PolySymbolElementDescriptor
|
||||
import com.intellij.html.polySymbols.attributes.HtmlAttributeSymbolDescriptor.Companion.toAttributeDescriptor
|
||||
import com.intellij.html.polySymbols.elements.HtmlElementSymbolDescriptor
|
||||
import com.intellij.html.polySymbols.hasOnlyStandardHtmlSymbols
|
||||
import com.intellij.html.polySymbols.hasOnlyStandardHtmlSymbolsOrExtensions
|
||||
import com.intellij.lang.html.HtmlCompatibleFile
|
||||
@@ -20,7 +20,7 @@ import com.intellij.util.asSafely
|
||||
import com.intellij.xml.XmlAttributeDescriptor
|
||||
import com.intellij.xml.XmlAttributeDescriptorsProvider
|
||||
|
||||
class PolySymbolAttributeDescriptorsProvider : XmlAttributeDescriptorsProvider {
|
||||
class HtmlAttributeSymbolDescriptorsProvider : XmlAttributeDescriptorsProvider {
|
||||
|
||||
override fun getAttributeDescriptors(context: XmlTag?): Array<XmlAttributeDescriptor> =
|
||||
if (context == null || DumbService.isDumb(context.project) || context.containingFile !is HtmlCompatibleFile)
|
||||
@@ -60,7 +60,7 @@ class PolySymbolAttributeDescriptorsProvider : XmlAttributeDescriptorsProvider {
|
||||
.takeIf {
|
||||
it.isNotEmpty()
|
||||
&& !it.hasOnlyExtensions()
|
||||
&& (elementDescriptor is PolySymbolElementDescriptor || !it.hasOnlyStandardHtmlSymbols())
|
||||
&& (elementDescriptor is HtmlElementSymbolDescriptor || !it.hasOnlyStandardHtmlSymbols())
|
||||
}
|
||||
?.asSingleSymbol()
|
||||
?.getAttributeDescriptor(attributeName, context, queryExecutor)
|
||||
@@ -70,7 +70,7 @@ class PolySymbolAttributeDescriptorsProvider : XmlAttributeDescriptorsProvider {
|
||||
this
|
||||
.asSafely<HtmlSymbolQueryConfigurator.HtmlAttributeDescriptorBasedSymbol>()
|
||||
?.descriptor
|
||||
?: PolySymbolHtmlAttributeInfo.create(attributeName, registry, this, context)
|
||||
?: HtmlAttributeSymbolInfo.create(attributeName, registry, this, context)
|
||||
.toAttributeDescriptor(context)
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
package com.intellij.html.polySymbols.attributes
|
||||
|
||||
import com.intellij.html.polySymbols.attributes.impl.HtmlAttributeEnumConstValueSymbol
|
||||
import com.intellij.html.polySymbols.attributes.impl.PolySymbolHtmlAttributeInfoImpl
|
||||
import com.intellij.html.polySymbols.attributes.impl.HtmlAttributeSymbolInfoImpl
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.polySymbols.search.PsiSourcedPolySymbol
|
||||
import com.intellij.polySymbols.PolySymbol
|
||||
@@ -15,7 +15,7 @@ import javax.swing.Icon
|
||||
@ApiStatus.Experimental
|
||||
/* INAPPLICABLE_JVM_NAME -> https://youtrack.jetbrains.com/issue/KT-31420 **/
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
interface PolySymbolHtmlAttributeInfo {
|
||||
interface HtmlAttributeSymbolInfo {
|
||||
|
||||
val name: String
|
||||
|
||||
@@ -43,27 +43,27 @@ interface PolySymbolHtmlAttributeInfo {
|
||||
|
||||
val priority: PolySymbol.Priority
|
||||
|
||||
fun withName(name: String): PolySymbolHtmlAttributeInfo
|
||||
fun withName(name: String): HtmlAttributeSymbolInfo
|
||||
|
||||
fun withSymbol(symbol: PolySymbol): PolySymbolHtmlAttributeInfo
|
||||
fun withSymbol(symbol: PolySymbol): HtmlAttributeSymbolInfo
|
||||
|
||||
fun withAcceptsNoValue(acceptsNoValue: Boolean): PolySymbolHtmlAttributeInfo
|
||||
fun withAcceptsNoValue(acceptsNoValue: Boolean): HtmlAttributeSymbolInfo
|
||||
|
||||
fun withAcceptsValue(acceptsValue: Boolean): PolySymbolHtmlAttributeInfo
|
||||
fun withAcceptsValue(acceptsValue: Boolean): HtmlAttributeSymbolInfo
|
||||
|
||||
fun withEnumValues(enumValues: List<PolySymbolCodeCompletionItem>?): PolySymbolHtmlAttributeInfo
|
||||
fun withEnumValues(enumValues: List<PolySymbolCodeCompletionItem>?): HtmlAttributeSymbolInfo
|
||||
|
||||
fun withStrictEnumValues(strictEnumValues: Boolean): PolySymbolHtmlAttributeInfo
|
||||
fun withStrictEnumValues(strictEnumValues: Boolean): HtmlAttributeSymbolInfo
|
||||
|
||||
fun withType(type: Any?): PolySymbolHtmlAttributeInfo
|
||||
fun withType(type: Any?): HtmlAttributeSymbolInfo
|
||||
|
||||
fun withIcon(icon: Icon?): PolySymbolHtmlAttributeInfo
|
||||
fun withIcon(icon: Icon?): HtmlAttributeSymbolInfo
|
||||
|
||||
fun withRequired(required: Boolean): PolySymbolHtmlAttributeInfo
|
||||
fun withRequired(required: Boolean): HtmlAttributeSymbolInfo
|
||||
|
||||
fun withDefaultValue(defaultValue: String?): PolySymbolHtmlAttributeInfo
|
||||
fun withDefaultValue(defaultValue: String?): HtmlAttributeSymbolInfo
|
||||
|
||||
fun withPriority(priority: PolySymbol.Priority): PolySymbolHtmlAttributeInfo
|
||||
fun withPriority(priority: PolySymbol.Priority): HtmlAttributeSymbolInfo
|
||||
|
||||
fun with(name: String = this.name,
|
||||
symbol: PolySymbol = this.symbol,
|
||||
@@ -75,7 +75,7 @@ interface PolySymbolHtmlAttributeInfo {
|
||||
icon: Icon? = this.icon,
|
||||
required: Boolean = this.required,
|
||||
defaultValue: String? = this.defaultValue,
|
||||
priority: PolySymbol.Priority = this.priority): PolySymbolHtmlAttributeInfo
|
||||
priority: PolySymbol.Priority = this.priority): HtmlAttributeSymbolInfo
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -89,8 +89,8 @@ interface PolySymbolHtmlAttributeInfo {
|
||||
fun create(name: String,
|
||||
queryExecutor: PolySymbolQueryExecutor,
|
||||
symbol: PolySymbol,
|
||||
context: PsiElement): PolySymbolHtmlAttributeInfo =
|
||||
PolySymbolHtmlAttributeInfoImpl.create(name, queryExecutor, symbol, context)
|
||||
context: PsiElement): HtmlAttributeSymbolInfo =
|
||||
HtmlAttributeSymbolInfoImpl.create(name, queryExecutor, symbol, context)
|
||||
|
||||
@JvmStatic
|
||||
fun create(
|
||||
@@ -105,7 +105,7 @@ interface PolySymbolHtmlAttributeInfo {
|
||||
required: Boolean = false,
|
||||
defaultValue: String? = null,
|
||||
priority: PolySymbol.Priority = PolySymbol.Priority.NORMAL
|
||||
): PolySymbolHtmlAttributeInfo = PolySymbolHtmlAttributeInfoImpl(
|
||||
): HtmlAttributeSymbolInfo = HtmlAttributeSymbolInfoImpl(
|
||||
name, symbol, acceptsNoValue, acceptsValue, enumValues,
|
||||
strictEnumValues, type, icon, required, defaultValue, priority
|
||||
)
|
||||
@@ -11,7 +11,7 @@ class HtmlAttributeSymbolReferenceProvider : PsiPolySymbolReferenceProvider<XmlA
|
||||
|
||||
override fun getReferencedSymbol(psiElement: XmlAttribute): PolySymbol? =
|
||||
psiElement.descriptor
|
||||
?.asSafely<PolySymbolAttributeDescriptor>()
|
||||
?.asSafely<HtmlAttributeSymbolDescriptor>()
|
||||
?.symbol
|
||||
|
||||
override fun shouldShowProblems(element: XmlAttribute): Boolean =
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.intellij.polySymbols.PolySymbol
|
||||
import com.intellij.polySymbols.utils.PolySymbolTypeSupport
|
||||
import com.intellij.polySymbols.completion.PolySymbolCodeCompletionItem
|
||||
|
||||
interface PolySymbolHtmlAttributeValueTypeSupport : PolySymbolTypeSupport {
|
||||
interface HtmlAttributeValueSymbolTypeSupport : PolySymbolTypeSupport {
|
||||
|
||||
/**
|
||||
* @return [ThreeState.YES] if the type is equal to boolean ignoring null or undefined values,
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.html.polySymbols.attributes.impl
|
||||
|
||||
import com.intellij.html.polySymbols.attributes.PolySymbolHtmlAttributeInfo
|
||||
import com.intellij.html.polySymbols.attributes.PolySymbolHtmlAttributeValueTypeSupport
|
||||
import com.intellij.html.polySymbols.attributes.HtmlAttributeSymbolInfo
|
||||
import com.intellij.html.polySymbols.attributes.HtmlAttributeValueSymbolTypeSupport
|
||||
import com.intellij.polySymbols.PolySymbol
|
||||
import com.intellij.polySymbols.PolySymbolModifier
|
||||
import com.intellij.polySymbols.completion.PolySymbolCodeCompletionItem
|
||||
@@ -14,7 +14,7 @@ import com.intellij.psi.PsiElement
|
||||
import com.intellij.util.ThreeState
|
||||
import javax.swing.Icon
|
||||
|
||||
internal data class PolySymbolHtmlAttributeInfoImpl(
|
||||
internal data class HtmlAttributeSymbolInfoImpl(
|
||||
override val name: String,
|
||||
override val symbol: PolySymbol,
|
||||
override val acceptsNoValue: Boolean,
|
||||
@@ -26,39 +26,39 @@ internal data class PolySymbolHtmlAttributeInfoImpl(
|
||||
override val required: Boolean,
|
||||
override val defaultValue: String?,
|
||||
override val priority: PolySymbol.Priority,
|
||||
) : PolySymbolHtmlAttributeInfo {
|
||||
) : HtmlAttributeSymbolInfo {
|
||||
|
||||
override fun withName(name: String): PolySymbolHtmlAttributeInfo =
|
||||
override fun withName(name: String): HtmlAttributeSymbolInfo =
|
||||
copy(name = name)
|
||||
|
||||
override fun withSymbol(symbol: PolySymbol): PolySymbolHtmlAttributeInfo =
|
||||
override fun withSymbol(symbol: PolySymbol): HtmlAttributeSymbolInfo =
|
||||
copy(symbol = symbol)
|
||||
|
||||
override fun withAcceptsNoValue(acceptsNoValue: Boolean): PolySymbolHtmlAttributeInfo =
|
||||
override fun withAcceptsNoValue(acceptsNoValue: Boolean): HtmlAttributeSymbolInfo =
|
||||
copy(acceptsNoValue = acceptsNoValue)
|
||||
|
||||
override fun withAcceptsValue(acceptsValue: Boolean): PolySymbolHtmlAttributeInfo =
|
||||
override fun withAcceptsValue(acceptsValue: Boolean): HtmlAttributeSymbolInfo =
|
||||
copy(acceptsValue = acceptsValue)
|
||||
|
||||
override fun withEnumValues(enumValues: List<PolySymbolCodeCompletionItem>?): PolySymbolHtmlAttributeInfo =
|
||||
override fun withEnumValues(enumValues: List<PolySymbolCodeCompletionItem>?): HtmlAttributeSymbolInfo =
|
||||
copy(enumValues = enumValues)
|
||||
|
||||
override fun withStrictEnumValues(strictEnumValues: Boolean): PolySymbolHtmlAttributeInfo =
|
||||
override fun withStrictEnumValues(strictEnumValues: Boolean): HtmlAttributeSymbolInfo =
|
||||
copy(strictEnumValues = strictEnumValues)
|
||||
|
||||
override fun withType(type: Any?): PolySymbolHtmlAttributeInfo =
|
||||
override fun withType(type: Any?): HtmlAttributeSymbolInfo =
|
||||
copy(type = type)
|
||||
|
||||
override fun withIcon(icon: Icon?): PolySymbolHtmlAttributeInfo =
|
||||
override fun withIcon(icon: Icon?): HtmlAttributeSymbolInfo =
|
||||
copy(icon = icon)
|
||||
|
||||
override fun withRequired(required: Boolean): PolySymbolHtmlAttributeInfo =
|
||||
override fun withRequired(required: Boolean): HtmlAttributeSymbolInfo =
|
||||
copy(required = required)
|
||||
|
||||
override fun withDefaultValue(defaultValue: String?): PolySymbolHtmlAttributeInfo =
|
||||
override fun withDefaultValue(defaultValue: String?): HtmlAttributeSymbolInfo =
|
||||
copy(defaultValue = defaultValue)
|
||||
|
||||
override fun withPriority(priority: PolySymbol.Priority): PolySymbolHtmlAttributeInfo =
|
||||
override fun withPriority(priority: PolySymbol.Priority): HtmlAttributeSymbolInfo =
|
||||
copy(priority = priority)
|
||||
|
||||
override fun with(
|
||||
@@ -73,7 +73,7 @@ internal data class PolySymbolHtmlAttributeInfoImpl(
|
||||
required: Boolean,
|
||||
defaultValue: String?,
|
||||
priority: PolySymbol.Priority,
|
||||
): PolySymbolHtmlAttributeInfo =
|
||||
): HtmlAttributeSymbolInfo =
|
||||
copy(name = name,
|
||||
symbol = symbol,
|
||||
acceptsNoValue = acceptsNoValue,
|
||||
@@ -92,8 +92,8 @@ internal data class PolySymbolHtmlAttributeInfoImpl(
|
||||
queryExecutor: PolySymbolQueryExecutor,
|
||||
symbol: PolySymbol,
|
||||
context: PsiElement,
|
||||
): PolySymbolHtmlAttributeInfo {
|
||||
val typeSupport = symbol.origin.typeSupport as? PolySymbolHtmlAttributeValueTypeSupport
|
||||
): HtmlAttributeSymbolInfo {
|
||||
val typeSupport = symbol.origin.typeSupport as? HtmlAttributeValueSymbolTypeSupport
|
||||
val attrValue = symbol.htmlAttributeValue
|
||||
val kind = attrValue?.kind ?: PolySymbolHtmlAttributeValue.Kind.PLAIN
|
||||
val type = attrValue?.type ?: PolySymbolHtmlAttributeValue.Type.STRING
|
||||
@@ -155,9 +155,9 @@ internal data class PolySymbolHtmlAttributeInfoImpl(
|
||||
|
||||
val strictEnumValues = type == PolySymbolHtmlAttributeValue.Type.ENUM || typeSupport?.strictEnumValues(symbol, langType) == true
|
||||
|
||||
return PolySymbolHtmlAttributeInfoImpl(name, symbol, acceptsNoValue, acceptsValue,
|
||||
enumValues, strictEnumValues, langType, icon, isRequired,
|
||||
defaultValue, priority)
|
||||
return HtmlAttributeSymbolInfoImpl(name, symbol, acceptsNoValue, acceptsValue,
|
||||
enumValues, strictEnumValues, langType, icon, isRequired,
|
||||
defaultValue, priority)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package com.intellij.html.polySymbols.elements
|
||||
|
||||
import com.intellij.codeInspection.ProblemsHolder
|
||||
import com.intellij.html.impl.RelaxedHtmlFromSchemaElementDescriptor
|
||||
import com.intellij.html.polySymbols.PolySymbolsFrameworkHtmlSupport
|
||||
import com.intellij.html.polySymbols.HtmlFrameworkSymbolsSupport
|
||||
import com.intellij.html.polySymbols.HtmlSymbolQueryConfigurator.HtmlElementDescriptorBasedSymbol
|
||||
import com.intellij.html.polySymbols.HtmlSymbolQueryConfigurator.StandardHtmlSymbol
|
||||
import com.intellij.html.polySymbols.hasOnlyStandardHtmlSymbolsOrExtensions
|
||||
@@ -26,13 +26,13 @@ import com.intellij.xml.impl.XmlElementDescriptorEx
|
||||
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor
|
||||
import org.jetbrains.annotations.NonNls
|
||||
|
||||
open class PolySymbolElementDescriptor private constructor(
|
||||
open class HtmlElementSymbolDescriptor private constructor(
|
||||
private val tag: XmlTag,
|
||||
private val name: String,
|
||||
val symbol: PolySymbol,
|
||||
) : XmlElementDescriptorEx, XmlElementDescriptorAwareAboutChildren, XmlCustomElementDescriptor {
|
||||
|
||||
constructor(info: PolySymbolHtmlElementInfo, tag: XmlTag) : this(tag, info.name, info.symbol)
|
||||
constructor(info: HtmlElementSymbolInfo, tag: XmlTag) : this(tag, info.name, info.symbol)
|
||||
|
||||
override fun validateTagName(tag: XmlTag, holder: ProblemsHolder, isOnTheFly: Boolean) {
|
||||
|
||||
@@ -174,8 +174,8 @@ open class PolySymbolElementDescriptor private constructor(
|
||||
|
||||
companion object {
|
||||
|
||||
fun PolySymbolHtmlElementInfo.toElementDescriptor(tag: XmlTag) =
|
||||
PolySymbolsFrameworkHtmlSupport.get(this.symbol.origin.framework)
|
||||
fun HtmlElementSymbolInfo.toElementDescriptor(tag: XmlTag) =
|
||||
HtmlFrameworkSymbolsSupport.get(this.symbol.origin.framework)
|
||||
.createHtmlElementDescriptor(this, tag)
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.html.polySymbols.elements
|
||||
|
||||
import com.intellij.html.polySymbols.elements.PolySymbolElementDescriptor.Companion.toElementDescriptor
|
||||
import com.intellij.html.polySymbols.elements.HtmlElementSymbolDescriptor.Companion.toElementDescriptor
|
||||
import com.intellij.html.polySymbols.hasOnlyStandardHtmlSymbols
|
||||
import com.intellij.lang.html.HtmlCompatibleFile
|
||||
import com.intellij.openapi.project.DumbService
|
||||
@@ -13,7 +13,7 @@ import com.intellij.psi.impl.source.xml.XmlElementDescriptorProvider
|
||||
import com.intellij.psi.xml.XmlTag
|
||||
import com.intellij.xml.XmlElementDescriptor
|
||||
|
||||
class PolySymbolElementDescriptorsProvider : XmlElementDescriptorProvider {
|
||||
class HtmlElementSymbolDescriptorsProvider : XmlElementDescriptorProvider {
|
||||
|
||||
override fun getDescriptor(tag: XmlTag?): XmlElementDescriptor? =
|
||||
if (tag == null || DumbService.isDumb(tag.project) || tag.containingFile !is HtmlCompatibleFile)
|
||||
@@ -30,7 +30,7 @@ class PolySymbolElementDescriptorsProvider : XmlElementDescriptorProvider {
|
||||
&& !it.hasOnlyStandardHtmlSymbols()
|
||||
}
|
||||
?.let { list ->
|
||||
PolySymbolHtmlElementInfo.create(tag.name, list)
|
||||
HtmlElementSymbolInfo.create(tag.name, list)
|
||||
?.toElementDescriptor(tag)
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.html.polySymbols.elements
|
||||
|
||||
import com.intellij.html.polySymbols.elements.impl.PolySymbolHtmlElementInfoImpl
|
||||
import com.intellij.html.polySymbols.elements.impl.HtmlElementSymbolInfoImpl
|
||||
import com.intellij.polySymbols.PolySymbol
|
||||
import com.intellij.polySymbols.utils.asSingleSymbol
|
||||
|
||||
interface PolySymbolHtmlElementInfo {
|
||||
interface HtmlElementSymbolInfo {
|
||||
val name: String
|
||||
val symbol: PolySymbol
|
||||
|
||||
companion object {
|
||||
fun create(name: String,
|
||||
symbols: List<PolySymbol>): PolySymbolHtmlElementInfo? =
|
||||
symbols: List<PolySymbol>): HtmlElementSymbolInfo? =
|
||||
symbols.asSingleSymbol()?.let {
|
||||
PolySymbolHtmlElementInfoImpl(name, it)
|
||||
HtmlElementSymbolInfoImpl(name, it)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ class HtmlElementSymbolReferenceProvider : PsiPolySymbolReferenceProvider<XmlTag
|
||||
|
||||
override fun getReferencedSymbol(psiElement: XmlTag): PolySymbol? =
|
||||
psiElement.descriptor
|
||||
?.asSafely<PolySymbolElementDescriptor>()
|
||||
?.asSafely<HtmlElementSymbolDescriptor>()
|
||||
?.symbol
|
||||
|
||||
override fun getOffsetsToReferencedSymbols(psiElement: XmlTag, hints: PsiSymbolReferenceHints): Map<Int, PolySymbol> =
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.html.polySymbols.elements.impl
|
||||
|
||||
import com.intellij.html.polySymbols.elements.HtmlElementSymbolInfo
|
||||
import com.intellij.polySymbols.PolySymbol
|
||||
|
||||
data class HtmlElementSymbolInfoImpl(override val name: String,
|
||||
override val symbol: PolySymbol) : HtmlElementSymbolInfo
|
||||
@@ -1,8 +0,0 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.html.polySymbols.elements.impl
|
||||
|
||||
import com.intellij.html.polySymbols.elements.PolySymbolHtmlElementInfo
|
||||
import com.intellij.polySymbols.PolySymbol
|
||||
|
||||
data class PolySymbolHtmlElementInfoImpl(override val name: String,
|
||||
override val symbol: PolySymbol) : PolySymbolHtmlElementInfo
|
||||
Reference in New Issue
Block a user