[Analysis API] Cause OOB when imports change in code fragments
In K1, code fragment analysis was completely invalidated on any PSI change. Because imports are not a part of the PSI tree of 'KtCodeFragment's, a colon tremble happened on 'addImportsFromString()'. In K2, changes inside code fragments are always considered in-body modifications. So, even with the colon trembling, the 'FirFile', together with its 'FirImport's was not recreated. ^KT-65600 Fixed
This commit is contained in:
+6
@@ -35,6 +35,7 @@ import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||
import org.jetbrains.kotlin.psi
|
||||
import org.jetbrains.kotlin.psi.KotlinCodeFragmentImportModificationListener
|
||||
import org.jetbrains.kotlin.psi.KtAnnotated
|
||||
import org.jetbrains.kotlin.psi.KtBlockExpression
|
||||
import org.jetbrains.kotlin.psi.KtCodeFragment
|
||||
@@ -69,6 +70,11 @@ class LLFirDeclarationModificationService(val project: Project) : Disposable {
|
||||
},
|
||||
this,
|
||||
)
|
||||
|
||||
project.messageBus.connect(this).subscribe(
|
||||
KtCodeFragment.IMPORT_MODIFICATION,
|
||||
KotlinCodeFragmentImportModificationListener { codeFragment -> outOfBlockModification(codeFragment) }
|
||||
)
|
||||
}
|
||||
|
||||
private var inBlockModificationQueue: MutableSet<ChangeType.InBlock>? = null
|
||||
|
||||
Reference in New Issue
Block a user