EditorFileModule

private class EditorFileModule(val snippet: KtFile, val contextModule: KaModule, val resolutionMode: KaDanglingFileResolutionMode) : KaModuleBase, KaDanglingFileModule

A dangling file module that holds its file outright.

The stock KaDanglingFileModuleImpl takes a smart pointer on the file instead, which the pointer manager registers and keeps; the module offers no way to hand it back, and its own reference is private. So the file's PSI tree outlives anything that releases the module, which is what AnalysisSession.Editor.close would otherwise be unable to reclaim. Here the file is an ordinary field, and goes when the module does.

Writing one is the documented alternative — the stock implementation says as much. The optimization given up is one shortcut in session building: for its own class the factory merges the context session's symbol providers straight in, and for anything else it aggregates and compares both dependency sets first. Same result, a little more work per session. Everything below mirrors the stock behavior, which is to say it defers to the context module throughout.

Constructors

Link copied to clipboard
constructor(snippet: KtFile, contextModule: KaModule, resolutionMode: KaDanglingFileResolutionMode)

Properties

Link copied to clipboard
open override val baseContentScope: GlobalSearchScope

Through the view provider, not PsiFile.virtualFile: the latter is null for an in-memory file, and the scope still has to accept one.

Link copied to clipboard
open override val contentScope: GlobalSearchScope
Link copied to clipboard
open override val contextModule: KaModule
Link copied to clipboard
open override val directDependsOnDependencies: List<KaModule>
Link copied to clipboard
open override val directFriendDependencies: List<KaModule>
Link copied to clipboard
open override val directRegularDependencies: List<KaModule>
Link copied to clipboard
open val file: KtFile
Link copied to clipboard
open override val files: List<KtFile>

Throwing once invalid is the interface's contract, not a choice.

Link copied to clipboard
open override val isCodeFragment: Boolean
Link copied to clipboard
open override val isValid: Boolean
Link copied to clipboard
Link copied to clipboard
open override val project: Project
Link copied to clipboard
open override val resolutionMode: KaDanglingFileResolutionMode
Link copied to clipboard
private val snippet: KtFile
Link copied to clipboard
Link copied to clipboard
open override val targetPlatform: TargetPlatform
Link copied to clipboard
open override val transitiveDependsOnDependencies: List<KaModule>

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String