Remove deprecated InjectorUtils#putInjectedFileUserData in injection (KT-33775)
#KT-33775 Fixed
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.idea.injection
|
package org.jetbrains.kotlin.idea.injection
|
||||||
|
|
||||||
import com.intellij.codeInsight.AnnotationUtil
|
import com.intellij.codeInsight.AnnotationUtil
|
||||||
|
import com.intellij.lang.injection.InjectedLanguageManager
|
||||||
import com.intellij.lang.injection.MultiHostInjector
|
import com.intellij.lang.injection.MultiHostInjector
|
||||||
import com.intellij.lang.injection.MultiHostRegistrar
|
import com.intellij.lang.injection.MultiHostRegistrar
|
||||||
import com.intellij.openapi.application.ApplicationManager
|
import com.intellij.openapi.application.ApplicationManager
|
||||||
@@ -25,7 +26,6 @@ import com.intellij.psi.util.CachedValuesManager
|
|||||||
import com.intellij.psi.util.PsiTreeUtil
|
import com.intellij.psi.util.PsiTreeUtil
|
||||||
import org.intellij.plugins.intelliLang.Configuration
|
import org.intellij.plugins.intelliLang.Configuration
|
||||||
import org.intellij.plugins.intelliLang.inject.InjectorUtils
|
import org.intellij.plugins.intelliLang.inject.InjectorUtils
|
||||||
import org.intellij.plugins.intelliLang.inject.LanguageInjectionSupport
|
|
||||||
import org.intellij.plugins.intelliLang.inject.TemporaryPlacesRegistry
|
import org.intellij.plugins.intelliLang.inject.TemporaryPlacesRegistry
|
||||||
import org.intellij.plugins.intelliLang.inject.config.BaseInjection
|
import org.intellij.plugins.intelliLang.inject.config.BaseInjection
|
||||||
import org.intellij.plugins.intelliLang.inject.config.InjectionPlace
|
import org.intellij.plugins.intelliLang.inject.config.InjectionPlace
|
||||||
@@ -94,7 +94,7 @@ class KotlinLanguageInjector(
|
|||||||
kotlinCachedInjection.baseInjection
|
kotlinCachedInjection.baseInjection
|
||||||
else -> {
|
else -> {
|
||||||
fun computeAndCache(): BaseInjection {
|
fun computeAndCache(): BaseInjection {
|
||||||
val computedInjection = computeBaseInjection(ktHost, support, registrar) ?: ABSENT_KOTLIN_INJECTION
|
val computedInjection = computeBaseInjection(ktHost, support) ?: ABSENT_KOTLIN_INJECTION
|
||||||
ktHost.cachedInjectionWithModification = KotlinCachedInjection(modificationCount, computedInjection)
|
ktHost.cachedInjectionWithModification = KotlinCachedInjection(modificationCount, computedInjection)
|
||||||
return computedInjection
|
return computedInjection
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ class KotlinLanguageInjector(
|
|||||||
InjectorUtils.putInjectedFileUserData(
|
InjectorUtils.putInjectedFileUserData(
|
||||||
ktHost,
|
ktHost,
|
||||||
language,
|
language,
|
||||||
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil.FRANKENSTEIN_INJECTION,
|
InjectedLanguageManager.FRANKENSTEIN_INJECTION,
|
||||||
if (parts.isUnparsable) java.lang.Boolean.TRUE else null
|
if (parts.isUnparsable) java.lang.Boolean.TRUE else null
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
@@ -138,14 +138,12 @@ class KotlinLanguageInjector(
|
|||||||
@Suppress("FoldInitializerAndIfToElvis")
|
@Suppress("FoldInitializerAndIfToElvis")
|
||||||
private fun computeBaseInjection(
|
private fun computeBaseInjection(
|
||||||
ktHost: KtStringTemplateExpression,
|
ktHost: KtStringTemplateExpression,
|
||||||
support: KotlinLanguageInjectionSupport,
|
support: KotlinLanguageInjectionSupport
|
||||||
registrar: MultiHostRegistrar
|
|
||||||
): BaseInjection? {
|
): BaseInjection? {
|
||||||
val containingFile = ktHost.containingFile
|
val containingFile = ktHost.containingFile
|
||||||
|
|
||||||
val tempInjectedLanguage = TemporaryPlacesRegistry.getInstance(project).getLanguageFor(ktHost, containingFile)
|
val tempInjectedLanguage = TemporaryPlacesRegistry.getInstance(project).getLanguageFor(ktHost, containingFile)
|
||||||
if (tempInjectedLanguage != null) {
|
if (tempInjectedLanguage != null) {
|
||||||
InjectorUtils.putInjectedFileUserData(registrar, LanguageInjectionSupport.TEMPORARY_INJECTED_LANGUAGE, tempInjectedLanguage)
|
|
||||||
return BaseInjection(support.id).apply {
|
return BaseInjection(support.id).apply {
|
||||||
injectedLanguageId = tempInjectedLanguage.id
|
injectedLanguageId = tempInjectedLanguage.id
|
||||||
prefix = tempInjectedLanguage.prefix
|
prefix = tempInjectedLanguage.prefix
|
||||||
|
|||||||
Reference in New Issue
Block a user