[AA] KT-58257 Prepare KtResolveExtension API for active invalidation
- `KtResolveExtension`s need to participate in active invalidation, because LL FIR sessions depend on changes in resolve extension files. - The resolve extension will simply be able to use the `KotlinModificationSubscriptionService`, which is part of the Analysis API surface for **API implementors**, to publish modification events.
This commit is contained in:
committed by
Space Team
parent
0c94a3131c
commit
e3d803de8b
+11
-14
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.resolve.extensions
|
||||
|
||||
import com.intellij.openapi.util.ModificationTracker
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
@@ -24,27 +23,25 @@ import org.jetbrains.kotlin.name.FqName
|
||||
*/
|
||||
public abstract class KtResolveExtension {
|
||||
/**
|
||||
* Get the list of files that should be generated for the module.
|
||||
* Get the list of files that should be generated for the module. Returned files should contain valid Kotlin code.
|
||||
*
|
||||
* The content of those files should remain valid until the tracker [getModificationTracker] is modified.
|
||||
* If the content of these files becomes invalid (e.g., because the source declarations they were based on changed), the
|
||||
* [KtResolveExtension] must publish an out-of-block modification event via the Analysis API message bus:
|
||||
* [org.jetbrains.kotlin.analysis.providers.topics.KotlinTopics.MODULE_OUT_OF_BLOCK_MODIFICATION].
|
||||
*
|
||||
* Returned files should contain a valid Kotlin code.
|
||||
* To react to changes in Kotlin sources, [KtResolveExtension] may subscribe to Analysis API topics:
|
||||
* [org.jetbrains.kotlin.analysis.providers.topics.KotlinTopics]. If the [KtResolveExtension] both subscribes to and
|
||||
* publishes modification events, care needs to be taken that no cycles are introduced. In general, the [KtResolveExtension] should
|
||||
* never publish an event for a module A in a listener for the same module A.
|
||||
*
|
||||
* An out-of-block modification event for the [KtResolveExtension]'s associated module does not need to be published in response to an
|
||||
* out-of-block modification event for the same module, because the original event suffices for invalidation.
|
||||
*
|
||||
* @see KtResolveExtensionFile
|
||||
* @see KtResolveExtension
|
||||
*/
|
||||
public abstract fun getKtFiles(): List<KtResolveExtensionFile>
|
||||
|
||||
/**
|
||||
* Returns a [ModificationTracker], which controls the validity lifecycle of the files provided by [getKtFiles].
|
||||
*
|
||||
* All files generated by [getKtFiles] should be valid if the [ModificationTracker] did not change.
|
||||
* If files become invalid (e.g., the in-source declarations they were based on changed) the [ModificationTracker] should be incremented.
|
||||
*
|
||||
* @see KtResolveExtension
|
||||
*/
|
||||
public abstract fun getModificationTracker(): ModificationTracker
|
||||
|
||||
/**
|
||||
* Returns the set of packages that are contained in the files provided by [getKtFiles].
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user