updateDocument
abstract fun updateDocument(fileName: String, compilationSettingsOrHost: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: String, scriptKind: ScriptKind = definedExternally, sourceFileOptions: CreateSourceFileOptions = definedExternally): SourceFile(source)
abstract fun updateDocument(fileName: String, compilationSettingsOrHost: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: String, scriptKind: ScriptKind = definedExternally, sourceFileOptions: ScriptTarget = definedExternally): SourceFile(source)
abstract fun updateDocument(fileName: String, compilationSettingsOrHost: MinimalResolutionCacheHost, scriptSnapshot: IScriptSnapshot, version: String, scriptKind: ScriptKind = definedExternally, sourceFileOptions: CreateSourceFileOptions = definedExternally): SourceFile(source)
abstract fun updateDocument(fileName: String, compilationSettingsOrHost: MinimalResolutionCacheHost, scriptSnapshot: IScriptSnapshot, version: String, scriptKind: ScriptKind = definedExternally, sourceFileOptions: ScriptTarget = definedExternally): SourceFile(source)
Request an updated version of an already existing SourceFile with a given fileName and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile to get an updated SourceFile.
Parameters
fileName
The name of the file requested
compilationSettingsOrHost
Some compilation settings like target affects the shape of a the resulting SourceFile. This allows the DocumentRegistry to store multiple copies of the same file for different compilation settings. A minimal resolution cache is needed to fully define a source file's shape when the compilation settings include module: node16
+, so providing a cache host object should be preferred. A common host is a language service ConfiguredProject
.
scriptSnapshot
Text of the file.
version
Current version of the file.