WEB-76271 PolySymbols: remove library and version properties from PolySymbolOrigin interface - additional fixes

GitOrigin-RevId: 7e877f595dc83222b24af5646afdd508e81f4496
This commit is contained in:
Piotr Tomiak
2026-01-10 01:01:12 +00:00
committed by intellij-monorepo-bot
parent 3af3d32a46
commit ff80769de9
3 changed files with 12 additions and 5 deletions
@@ -27,9 +27,7 @@ interface CustomElementsSymbol : PolySymbol, PolySymbolScope {
PolySymbolDocumentationTarget.create(this, location) { symbol, _ ->
description = symbol.description
defaultValue = symbol.defaultValue
library = symbol.origin.let { origin ->
library + (origin.version?.takeIf { it != "0.0.0" }?.let { "@$it" } ?: "")
}
library = symbol.origin.library + (symbol.origin.version?.takeIf { it != "0.0.0" }?.let { "@$it" } ?: "")
}
override fun <T : Any> get(property: PolySymbolProperty<T>): T? =
@@ -11,6 +11,7 @@ import com.intellij.polySymbols.documentation.PolySymbolDocumentationTarget
import com.intellij.polySymbols.html.PolySymbolHtmlAttributeValue
import com.intellij.polySymbols.html.htmlAttributeValue
import com.intellij.polySymbols.js.PROP_JS_SYMBOL_KIND
import com.intellij.polySymbols.query.PolySymbolMatch
import com.intellij.polySymbols.query.PolySymbolWithPattern
import com.intellij.polySymbols.search.PsiSourcedPolySymbol
import com.intellij.polySymbols.testFramework.DebugOutputPrinter
@@ -18,6 +19,7 @@ import com.intellij.polySymbols.utils.PolySymbolTypeSupport.Companion.PROP_TYPE_
import com.intellij.polySymbols.utils.completeMatch
import com.intellij.polySymbols.utils.nameSegments
import com.intellij.polySymbols.utils.qualifiedName
import com.intellij.polySymbols.utils.unwrapMatchedSymbols
import com.intellij.polySymbols.webTypes.WebTypesSymbol
import com.intellij.util.applyIf
import com.intellij.util.asSafely
@@ -85,14 +87,17 @@ open class PolySymbolsDebugOutputPrinter : DebugOutputPrinter() {
.asSafely<PolySymbolDocumentationTarget>()
?.documentation
val framework = (source as? WebTypesSymbol)?.origin?.framework
?: (source as? PolySymbolMatch)?.unwrapMatchedSymbols()?.firstNotNullOfOrNull { (it as? WebTypesSymbol)?.origin?.framework }
?: "<none>"
printProperty(level,
"origin",
"${documentation?.library} (${(source as? WebTypesSymbol)?.origin?.framework ?: "<none>"})")
"${documentation?.library} ($framework)")
printProperty(level, "source", (source as? PsiSourcedPolySymbol)?.source)
printProperty(level, "type", source[PROP_TYPE_SUPPORT]?.typeProperty?.let { source[it] })
printProperty(level, "attrValue", source.htmlAttributeValue)
printProperty(level, "complete", source.completeMatch)
if (documentation != null) {
if (documentation != null && source !is PolySymbolMatch) {
printProperty(level, "description", documentation.description?.ellipsis(45))
printProperty(level, "docUrl", documentation.docUrl)
printProperty(level, "descriptionSections", documentation.descriptionSections.takeIf { it.isNotEmpty() })
@@ -25,6 +25,10 @@ class HtmlCodeCompletionItemCustomizer : PolySymbolCodeCompletionItemCustomizer
?.asSafely<PolySymbolDocumentationTarget>()
?.documentation
?.library
?.let {
val atIndex = it.lastIndexOf('@')
if (atIndex > 0) it.substring(0, atIndex) else it
}
}
HTML_ATTRIBUTES -> item // TODO - we can figure out the actual type with full match provided
else -> item