diff --git a/platform/webSymbols/src/com/intellij/webSymbols/refactoring/PsiSourcedWebSymbolRenameHandler.kt b/platform/webSymbols/src/com/intellij/webSymbols/refactoring/PsiSourcedWebSymbolRenameHandler.kt index 6dafc28abff4..dac7659d11a1 100644 --- a/platform/webSymbols/src/com/intellij/webSymbols/refactoring/PsiSourcedWebSymbolRenameHandler.kt +++ b/platform/webSymbols/src/com/intellij/webSymbols/refactoring/PsiSourcedWebSymbolRenameHandler.kt @@ -1,5 +1,6 @@ package com.intellij.webSymbols.refactoring +import com.intellij.model.Symbol import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.actionSystem.DataContext import com.intellij.openapi.editor.Editor @@ -31,8 +32,9 @@ class PsiSourcedWebSymbolRenameHandler : RenameHandler { override fun isAvailableOnDataContext(dataContext: DataContext): Boolean = dataContext.getData(CommonDataKeys.SYMBOLS) - ?.filterIsInstance() - ?.mapNotNull { it.source } - ?.count { it is PsiNamedElement && it !is SyntheticElement } == 1 + ?.count { acceptSymbolForPsiSourcedWebSymbolRenameHandler(it) } == 1 -} \ No newline at end of file +} + +internal fun acceptSymbolForPsiSourcedWebSymbolRenameHandler(symbol: Symbol): Boolean = + symbol is PsiSourcedWebSymbol && symbol.source is PsiNamedElement && symbol.source !is SyntheticElement \ No newline at end of file diff --git a/platform/webSymbols/src/com/intellij/webSymbols/refactoring/WebSymbolRenameTarget.kt b/platform/webSymbols/src/com/intellij/webSymbols/refactoring/WebSymbolRenameTarget.kt index 7e5f874b7eda..8c9ae2652c40 100644 --- a/platform/webSymbols/src/com/intellij/webSymbols/refactoring/WebSymbolRenameTarget.kt +++ b/platform/webSymbols/src/com/intellij/webSymbols/refactoring/WebSymbolRenameTarget.kt @@ -13,8 +13,11 @@ interface WebSymbolRenameTarget : RenameTarget { override fun createPointer(): Pointer companion object { - fun create(symbol: WebSymbol): WebSymbolRenameTarget = - WebSymbolRenameTargetImpl(symbol) + fun create(symbol: WebSymbol): WebSymbolRenameTarget? = + if (!acceptSymbolForPsiSourcedWebSymbolRenameHandler(symbol)) + WebSymbolRenameTargetImpl(symbol) + else + null } } \ No newline at end of file