import { CachedDirectoryStructureHost, CompilerOptions, Diagnostic, DirectoryStructureHost, DocumentPosition, DocumentPositionMapper, DocumentRegistry, DocumentRegistryBucketKeyWithMode, FileExtensionInfo, FileWatcher, FormatCodeSettings, HostCancellationToken, IncompleteCompletionsCache, JSDocParsingMode, LanguageServiceMode, MultiMap, noop, PackageJsonAutoImportPreference, ParsedCommandLine, Path, PerformanceEvent, PluginImport, ProgramUpdateLevel, ProjectPackageJsonInfo, ReadonlyCollection, ScriptKind, SourceFile, SourceFileLike, TextChange, TsConfigSourceFile, TypeAcquisition, UserPreferences, WatchFactory, WatchOptions, WatchType, WildcardDirectoryWatcher } from "./_namespaces/ts.js"; import { AutoImportProviderProject, AuxiliaryProject, BeginInstallTypes, ConfiguredProject, EndInstallTypes, ExternalProject, InferredProject, InvalidateCachedTypings, ITypingsInstaller, Logger, NormalizedPath, PackageInstalledResponse, PackageJsonCache, Project, ProjectFilesWithTSDiagnostics, ScriptInfo, ServerHost, Session, SetTypings, ThrottledOperations, WatchTypingLocations } from "./_namespaces/ts.server.js"; import * as protocol from "./protocol.js"; export declare const maxProgramSizeForNonTsFiles: number; /** @internal */ export declare const maxFileSize: number; export declare const ProjectsUpdatedInBackgroundEvent = "projectsUpdatedInBackground"; export declare const ProjectLoadingStartEvent = "projectLoadingStart"; export declare const ProjectLoadingFinishEvent = "projectLoadingFinish"; export declare const LargeFileReferencedEvent = "largeFileReferenced"; export declare const ConfigFileDiagEvent = "configFileDiag"; export declare const ProjectLanguageServiceStateEvent = "projectLanguageServiceState"; export declare const ProjectInfoTelemetryEvent = "projectInfo"; export declare const OpenFileInfoTelemetryEvent = "openFileInfo"; export declare const CreateFileWatcherEvent: protocol.CreateFileWatcherEventName; export declare const CreateDirectoryWatcherEvent: protocol.CreateDirectoryWatcherEventName; export declare const CloseFileWatcherEvent: protocol.CloseFileWatcherEventName; export interface ProjectsUpdatedInBackgroundEvent { eventName: typeof ProjectsUpdatedInBackgroundEvent; data: { openFiles: string[]; }; } export interface ProjectLoadingStartEvent { eventName: typeof ProjectLoadingStartEvent; data: { project: Project; reason: string; }; } export interface ProjectLoadingFinishEvent { eventName: typeof ProjectLoadingFinishEvent; data: { project: Project; }; } export interface LargeFileReferencedEvent { eventName: typeof LargeFileReferencedEvent; data: { file: string; fileSize: number; maxFileSize: number; }; } export interface ConfigFileDiagEvent { eventName: typeof ConfigFileDiagEvent; data: { triggerFile: string; configFileName: string; diagnostics: readonly Diagnostic[]; }; } export interface ProjectLanguageServiceStateEvent { eventName: typeof ProjectLanguageServiceStateEvent; data: { project: Project; languageServiceEnabled: boolean; }; } /** This will be converted to the payload of a protocol.TelemetryEvent in session.defaultEventHandler. */ export interface ProjectInfoTelemetryEvent { readonly eventName: typeof ProjectInfoTelemetryEvent; readonly data: ProjectInfoTelemetryEventData; } export interface ProjectInfoTelemetryEventData { /** Cryptographically secure hash of project file location. */ readonly projectId: string; /** Count of file extensions seen in the project. */ readonly fileStats: FileStats; /** * Any compiler options that might contain paths will be taken out. * Enum compiler options will be converted to strings. */ readonly compilerOptions: CompilerOptions; readonly extends: boolean | undefined; readonly files: boolean | undefined; readonly include: boolean | undefined; readonly exclude: boolean | undefined; readonly compileOnSave: boolean; readonly typeAcquisition: ProjectInfoTypeAcquisitionData; readonly configFileName: "tsconfig.json" | "jsconfig.json" | "other"; readonly projectType: "external" | "configured"; readonly languageServiceEnabled: boolean; /** TypeScript version used by the server. */ readonly version: string; } /** * Info that we may send about a file that was just opened. * Info about a file will only be sent once per session, even if the file changes in ways that might affect the info. * Currently this is only sent for '.js' files. */ export interface OpenFileInfoTelemetryEvent { readonly eventName: typeof OpenFileInfoTelemetryEvent; readonly data: OpenFileInfoTelemetryEventData; } export interface OpenFileInfoTelemetryEventData { readonly info: OpenFileInfo; } export interface ProjectInfoTypeAcquisitionData { readonly enable: boolean | undefined; readonly include: boolean; readonly exclude: boolean; } export interface FileStats { readonly js: number; readonly jsSize?: number; readonly jsx: number; readonly jsxSize?: number; readonly ts: number; readonly tsSize?: number; readonly tsx: number; readonly tsxSize?: number; readonly dts: number; readonly dtsSize?: number; readonly deferred: number; readonly deferredSize?: number; } export interface OpenFileInfo { readonly checkJs: boolean; } export interface CreateFileWatcherEvent { readonly eventName: protocol.CreateFileWatcherEventName; readonly data: protocol.CreateFileWatcherEventBody; } export interface CreateDirectoryWatcherEvent { readonly eventName: protocol.CreateDirectoryWatcherEventName; readonly data: protocol.CreateDirectoryWatcherEventBody; } export interface CloseFileWatcherEvent { readonly eventName: protocol.CloseFileWatcherEventName; readonly data: protocol.CloseFileWatcherEventBody; } export type ProjectServiceEvent = LargeFileReferencedEvent | ProjectsUpdatedInBackgroundEvent | ProjectLoadingStartEvent | ProjectLoadingFinishEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent | ProjectInfoTelemetryEvent | OpenFileInfoTelemetryEvent | CreateFileWatcherEvent | CreateDirectoryWatcherEvent | CloseFileWatcherEvent; export type ProjectServiceEventHandler = (event: ProjectServiceEvent) => void; /** @internal */ export type PerformanceEventHandler = (event: PerformanceEvent) => void; export interface SafeList { [name: string]: { match: RegExp; exclude?: (string | number)[][]; types?: string[]; }; } export interface TypesMapFile { typesMap: SafeList; simpleMap: { [libName: string]: string; }; } export declare function convertFormatOptions(protocolOptions: protocol.FormatCodeSettings): FormatCodeSettings; export declare function convertCompilerOptions(protocolOptions: protocol.ExternalProjectCompilerOptions): CompilerOptions & protocol.CompileOnSaveMixin; export declare function convertWatchOptions(protocolOptions: protocol.ExternalProjectCompilerOptions, currentDirectory?: string): WatchOptionsAndErrors | undefined; export declare function convertTypeAcquisition(protocolOptions: protocol.InferredProjectCompilerOptions): TypeAcquisition | undefined; export declare function tryConvertScriptKindName(scriptKindName: protocol.ScriptKindName | ScriptKind): ScriptKind; export declare function convertScriptKindName(scriptKindName: protocol.ScriptKindName): ScriptKind; /** @internal */ export declare function convertUserPreferences(preferences: protocol.UserPreferences): UserPreferences; export interface HostConfiguration { formatCodeOptions: FormatCodeSettings; preferences: protocol.UserPreferences; hostInfo: string; extraFileExtensions?: FileExtensionInfo[]; watchOptions?: WatchOptions; /** @internal */ beforeSubstitution?: WatchOptions; } export interface OpenConfiguredProjectResult { configFileName?: NormalizedPath; configFileErrors?: readonly Diagnostic[]; } export declare const nullTypingsInstaller: ITypingsInstaller; /** @internal */ export interface ConfigFileExistenceInfo { /** * Cached value of existence of config file * It is true if there is configured project open for this file. * It can be either true or false if this is the config file that is being watched by inferred project * to decide when to update the structure so that it knows about updating the project for its files * (config file may include the inferred project files after the change and hence may be wont need to be in inferred project) */ exists: boolean; /** * Tracks how many open files are impacted by this config file that are root of inferred project */ inferredProjectRoots?: number; /** * openFilesImpactedByConfigFiles is a map of open files that would be impacted by this config file * because these are the paths being looked up for their default configured project location */ openFilesImpactedByConfigFile?: Set; /** * The file watcher watching the config file because there is open script info that is root of * inferred project and will be impacted by change in the status of the config file * or * Configured project for this config file is open * or * Configured project references this config file */ watcher?: FileWatcher; /** * Cached parsed command line and other related information like watched directories etc */ config?: ParsedConfig; } export interface ProjectServiceOptions { host: ServerHost; logger: Logger; cancellationToken: HostCancellationToken; useSingleInferredProject: boolean; useInferredProjectPerProjectRoot: boolean; typingsInstaller?: ITypingsInstaller; eventHandler?: ProjectServiceEventHandler; canUseWatchEvents?: boolean; suppressDiagnosticEvents?: boolean; throttleWaitMilliseconds?: number; globalPlugins?: readonly string[]; pluginProbeLocations?: readonly string[]; allowLocalPluginLoads?: boolean; typesMapLocation?: string; serverMode?: LanguageServiceMode; session: Session | undefined; /** @internal */ incrementalVerifier?: (service: ProjectService) => void; jsDocParsingMode?: JSDocParsingMode; } /** * string if file name, * false if no config file name * @internal */ export type ConfigFileName = NormalizedPath | false; /** * Stores cached config file name for info as well as ancestor so is a map * Key is false for Open ScriptInfo * Key is NormalizedPath for Config file name * @internal */ export type ConfigFileMapForOpenFile = Map; /** * The cache for open script info will have * ConfigFileName or false if ancestors are not looked up * Map if ancestors are looked up * @internal */ export type ConfigFileForOpenFile = ConfigFileName | ConfigFileMapForOpenFile; /** @internal */ export interface OriginalFileInfo { fileName: NormalizedPath; path: Path; } /** @internal */ export interface AncestorConfigFileInfo { /** config file name */ fileName: NormalizedPath; /** path of open file so we can look at correct root */ path: Path; configFileInfo: true; isForDefaultProject: boolean; } /** @internal */ export type OpenScriptInfoOrClosedFileInfo = ScriptInfo | OriginalFileInfo; /** @internal */ export type OpenScriptInfoOrClosedOrConfigFileInfo = OpenScriptInfoOrClosedFileInfo | AncestorConfigFileInfo; /** @internal */ export declare enum ConfiguredProjectLoadKind { FindOptimized = 0, Find = 1, CreateReplayOptimized = 2, CreateReplay = 3, CreateOptimized = 4, Create = 5, ReloadOptimized = 6, Reload = 7 } /** @internal */ export type ConfigureProjectToLoadKind = Map; /** @internal */ export type ConfiguredProjectToAnyReloadKind = Map; /** @internal */ export type DefaultConfiguredProjectResult = ReturnType; /** @internal */ export interface FindCreateOrLoadConfiguredProjectResult { project: ConfiguredProject; sentConfigFileDiag: boolean; configFileExistenceInfo: ConfigFileExistenceInfo | undefined; reason: string | undefined; } /** @internal */ export interface PackageJsonWatcher extends FileWatcher { projects: Set; } /** @internal */ export interface WildcardWatcher extends FileWatcher { packageJsonWatches: Set | undefined; } /** @internal */ export declare function getDetailWatchInfo(watchType: WatchType, project: Project | NormalizedPath | undefined): string; /** * returns true if project updated with new program * @internal */ export declare function updateProjectIfDirty(project: Project): boolean; /** @internal */ export interface OpenFileArguments { fileName: string; content?: string; scriptKind?: protocol.ScriptKindName | ScriptKind; hasMixedContent?: boolean; projectRootPath?: string; } /** @internal */ export interface ChangeFileArguments { fileName: string; changes: Iterable; } export interface WatchOptionsAndErrors { watchOptions: WatchOptions; errors: Diagnostic[] | undefined; } /** @internal */ export interface ParsedConfig { cachedDirectoryStructureHost: CachedDirectoryStructureHost; /** * The map contains * - true if project is watching config file as well as wild cards * - false if just config file is watched */ projects: Map; parsedCommandLine?: ParsedCommandLine; watchedDirectories?: Map>; /** * true if watchedDirectories need to be updated as per parsedCommandLine's updated watched directories */ watchedDirectoriesStale?: boolean; updateLevel?: ProgramUpdateLevel.RootNamesAndUpdate | ProgramUpdateLevel.Full; } export declare class ProjectService { /** @internal */ readonly documentRegistry: DocumentRegistry; /** * Container of all known scripts * * @internal */ readonly filenameToScriptInfo: Map; private readonly nodeModulesWatchers; /** * Contains all the deleted script info's version information so that * it does not reset when creating script info again * (and could have potentially collided with version where contents mismatch) */ private readonly filenameToScriptInfoVersion; private readonly allJsFilesForOpenFileTelemetry; /** * Map to the real path of the infos * * @internal */ readonly realpathToScriptInfos: MultiMap | undefined; /** * maps external project file name to list of config files that were the part of this project */ private readonly externalProjectToConfiguredProjectMap; /** * external projects (configuration and list of root files is not controlled by tsserver) */ readonly externalProjects: ExternalProject[]; /** * projects built from openFileRoots */ readonly inferredProjects: InferredProject[]; /** * projects specified by a tsconfig.json file */ readonly configuredProjects: Map; /** @internal */ readonly newInferredProjectName: () => string; /** @internal */ readonly newAutoImportProviderProjectName: () => string; /** @internal */ readonly newAuxiliaryProjectName: () => string; /** * Open files: with value being project root path, and key being Path of the file that is open */ readonly openFiles: Map; /** Config files looked up and cached config files for open script info */ private readonly configFileForOpenFiles; /** Set of open script infos that are root of inferred project */ private rootOfInferredProjects; /** * Map of open files that are opened without complete path but have projectRoot as current directory */ private readonly openFilesWithNonRootedDiskPath; private compilerOptionsForInferredProjects; private compilerOptionsForInferredProjectsPerProjectRoot; private watchOptionsForInferredProjects; private watchOptionsForInferredProjectsPerProjectRoot; private typeAcquisitionForInferredProjects; private typeAcquisitionForInferredProjectsPerProjectRoot; /** * Project size for configured or external projects */ private readonly projectToSizeMap; /** * This is a map of config file paths existence that doesnt need query to disk * - The entry can be present because there is inferred project that needs to watch addition of config file to directory * In this case the exists could be true/false based on config file is present or not * - Or it is present if we have configured project open with config file at that location * In this case the exists property is always true * * @internal */ readonly configFileExistenceInfoCache: Map; /** @internal */ readonly throttledOperations: ThrottledOperations; private readonly hostConfiguration; private safelist; private readonly legacySafelist; private pendingProjectUpdates; /** * All the open script info that needs recalculation of the default project, * this also caches config file info before config file change was detected to use it in case projects are not updated yet */ private pendingOpenFileProjectUpdates?; /** @internal */ pendingEnsureProjectForOpenFiles: boolean; readonly currentDirectory: NormalizedPath; readonly toCanonicalFileName: (f: string) => string; readonly host: ServerHost; readonly logger: Logger; readonly cancellationToken: HostCancellationToken; readonly useSingleInferredProject: boolean; readonly useInferredProjectPerProjectRoot: boolean; readonly typingsInstaller: ITypingsInstaller; private readonly globalCacheLocationDirectoryPath; readonly throttleWaitMilliseconds?: number; /** @internal */ readonly eventHandler?: ProjectServiceEventHandler; private readonly suppressDiagnosticEvents?; readonly globalPlugins: readonly string[]; readonly pluginProbeLocations: readonly string[]; readonly allowLocalPluginLoads: boolean; /** @internal */ currentPluginConfigOverrides: Map | undefined; readonly typesMapLocation: string | undefined; readonly serverMode: LanguageServiceMode; /** Tracks projects that we have already sent telemetry for. */ private readonly seenProjects; /** @internal */ readonly watchFactory: WatchFactory; private readonly sharedExtendedConfigFileWatchers; private readonly extendedConfigCache; /** @internal */ readonly packageJsonCache: PackageJsonCache; private packageJsonFilesMap; private incompleteCompletionsCache; /** @internal */ readonly session: Session | undefined; private performanceEventHandler?; private pendingPluginEnablements?; private currentPluginEnablementPromise?; /** @internal */ baseline: (title?: string) => void; /** @internal */ verifyDocumentRegistry: typeof noop; /** @internal */ verifyProgram: (project: Project) => void; /** @internal */ onProjectCreation: (project: Project) => void; /** @internal */ canUseWatchEvents: boolean; readonly jsDocParsingMode: JSDocParsingMode | undefined; constructor(opts: ProjectServiceOptions); toPath(fileName: string): Path; /** @internal */ getExecutingFilePath(): string; /** @internal */ getNormalizedAbsolutePath(fileName: string): string; /** @internal */ setDocument(key: DocumentRegistryBucketKeyWithMode, path: Path, sourceFile: SourceFile): void; /** @internal */ getDocument(key: DocumentRegistryBucketKeyWithMode, path: Path): SourceFile | undefined; /** @internal */ ensureInferredProjectsUpToDate_TestOnly(): void; /** @internal */ getCompilerOptionsForInferredProjects(): CompilerOptions | undefined; /** @internal */ onUpdateLanguageServiceStateForProject(project: Project, languageServiceEnabled: boolean): void; private loadTypesMap; updateTypingsForProject(response: SetTypings | InvalidateCachedTypings | PackageInstalledResponse): void; /** @internal */ updateTypingsForProject(response: SetTypings | InvalidateCachedTypings | PackageInstalledResponse | BeginInstallTypes | EndInstallTypes): void; /** @internal */ watchTypingLocations(response: WatchTypingLocations): void; /** @internal */ delayEnsureProjectForOpenFiles(): void; private delayUpdateProjectGraph; /** @internal */ hasPendingProjectUpdate(project: Project): boolean; /** @internal */ sendProjectsUpdatedInBackgroundEvent(): void; /** @internal */ sendLargeFileReferencedEvent(file: string, fileSize: number): void; /** @internal */ sendProjectLoadingStartEvent(project: ConfiguredProject, reason: string): void; /** @internal */ sendProjectLoadingFinishEvent(project: ConfiguredProject): void; /** @internal */ sendPerformanceEvent(kind: PerformanceEvent["kind"], durationMs: number): void; /** @internal */ delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project: Project): void; private delayUpdateProjectGraphs; setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.InferredProjectCompilerOptions, projectRootPath?: string): void; findProject(projectName: string): Project | undefined; /** @internal */ forEachProject(cb: (project: Project) => void): void; /** @internal */ forEachEnabledProject(cb: (project: Project) => void): void; getDefaultProjectForFile(fileName: NormalizedPath, ensureProject: boolean): Project | undefined; /** @internal */ tryGetDefaultProjectForFile(fileNameOrScriptInfo: NormalizedPath | ScriptInfo): Project | undefined; /** * If there is default project calculation pending for this file, * then it completes that calculation so that correct default project is used for the project */ private tryGetDefaultProjectForEnsuringConfiguredProjectForFile; /** @internal */ ensureDefaultProjectForFile(fileNameOrScriptInfo: NormalizedPath | ScriptInfo): Project; private doEnsureDefaultProjectForFile; getScriptInfoEnsuringProjectsUptoDate(uncheckedFileName: string): ScriptInfo | undefined; /** * Ensures the project structures are upto date * This means, * - we go through all the projects and update them if they are dirty * - if updates reflect some change in structure or there was pending request to ensure projects for open files * ensure that each open script info has project */ private ensureProjectStructuresUptoDate; getFormatCodeOptions(file: NormalizedPath): FormatCodeSettings; getPreferences(file: NormalizedPath): protocol.UserPreferences; getHostFormatCodeOptions(): FormatCodeSettings; getHostPreferences(): protocol.UserPreferences; private onSourceFileChanged; private handleSourceMapProjects; private delayUpdateSourceInfoProjects; private delayUpdateProjectsOfScriptInfoPath; private handleDeletedFile; /** * This is to watch whenever files are added or removed to the wildcard directories */ private watchWildcardDirectory; private onWildCardDirectoryWatcherInvoke; private delayUpdateProjectsFromParsedConfigOnConfigFileChange; private onConfigFileChanged; private removeProject; /** @internal */ assignOrphanScriptInfoToInferredProject(info: ScriptInfo, projectRootPath: NormalizedPath | undefined): InferredProject; private assignOrphanScriptInfosToInferredProject; /** * Remove this file from the set of open, non-configured files. * @param info The file that has been closed or newly configured */ private closeOpenFile; private deleteScriptInfo; private configFileExists; private createConfigFileWatcherForParsedConfig; private ensureConfigFileWatcherForProject; /** @internal */ releaseParsedConfig(canonicalConfigFilePath: NormalizedPath, forProject: ConfiguredProject): void; /** * This is called on file close or when its removed from inferred project as root, * so that we handle the watches and inferred project root data * @internal */ stopWatchingConfigFilesForScriptInfo(info: ScriptInfo): void; /** * This is called by inferred project whenever script info is added as a root * * @internal */ startWatchingConfigFilesForInferredProjectRoot(info: ScriptInfo): void; /** * This function tries to search for a tsconfig.json for the given file. * This is different from the method the compiler uses because * the compiler can assume it will always start searching in the * current directory (the directory in which tsc was invoked). * The server must start searching from the directory containing * the newly opened file. */ private forEachConfigFileLocation; /** @internal */ findDefaultConfiguredProject(info: ScriptInfo): ConfiguredProject | undefined; /** @internal */ findDefaultConfiguredProjectWorker(info: ScriptInfo, kind: ConfiguredProjectLoadKind.Find | ConfiguredProjectLoadKind.CreateReplay): DefaultConfiguredProjectResult | undefined; /** Get cached configFileName for scriptInfo or ancestor of open script info */ private getConfigFileNameForFileFromCache; /** Caches the configFilename for script info or ancestor of open script info */ private setConfigFileNameForFileInCache; /** * This function tries to search for a tsconfig.json for the given file. * This is different from the method the compiler uses because * the compiler can assume it will always start searching in the * current directory (the directory in which tsc was invoked). * The server must start searching from the directory containing * the newly opened file. * If script info is passed in, it is asserted to be open script info * otherwise just file name * when findFromCacheOnly is true only looked up in cache instead of hitting disk to figure things out * @internal */ getConfigFileNameForFile(info: OpenScriptInfoOrClosedOrConfigFileInfo, findFromCacheOnly: boolean): NormalizedPath | undefined; private printProjects; /** @internal */ findConfiguredProjectByProjectName(configFileName: NormalizedPath, allowDeferredClosed?: boolean): ConfiguredProject | undefined; private getConfiguredProjectByCanonicalConfigFilePath; private findExternalProjectByProjectName; /** Get a filename if the language service exceeds the maximum allowed program size; otherwise returns undefined. */ private getFilenameForExceededTotalSizeLimitForNonTsFiles; private createExternalProject; /** @internal */ sendProjectTelemetry(project: ExternalProject | ConfiguredProject): void; private addFilesToNonInferredProject; /** @internal */ createConfiguredProject(configFileName: NormalizedPath, reason: string): ConfiguredProject; /** * Read the config file of the project, and update the project root file names. */ private loadConfiguredProject; /** @internal */ ensureParsedConfigUptoDate(configFilename: NormalizedPath, canonicalConfigFilePath: NormalizedPath, configFileExistenceInfo: ConfigFileExistenceInfo, forProject: ConfiguredProject): ConfigFileExistenceInfo; /** @internal */ watchWildcards(configFileName: NormalizedPath, { exists, config }: ConfigFileExistenceInfo, forProject: ConfiguredProject): void; /** @internal */ stopWatchingWildCards(canonicalConfigFilePath: NormalizedPath, forProject: ConfiguredProject): void; private updateNonInferredProjectFiles; private updateRootAndOptionsOfNonInferredProject; /** * Reload the file names from config file specs and update the project graph * * @internal */ reloadFileNamesOfConfiguredProject(project: ConfiguredProject): boolean; private reloadFileNamesOfParsedConfig; /** @internal */ setFileNamesOfAutoImportProviderOrAuxillaryProject(project: AutoImportProviderProject | AuxiliaryProject, fileNames: readonly string[]): void; /** @internal */ reloadConfiguredProjectOptimized(project: ConfiguredProject, reason: string, reloadedProjects: ConfiguredProjectToAnyReloadKind): void; /** @internal */ reloadConfiguredProjectClearingSemanticCache(project: ConfiguredProject, reason: string, reloadedProjects: ConfiguredProjectToAnyReloadKind): boolean; private setProjectForReload; /** * Read the config file of the project again by clearing the cache and update the project graph * * @internal */ reloadConfiguredProject(project: ConfiguredProject, reason: string): void; private clearSemanticCache; /** @internal */ sendConfigFileDiagEvent(project: ConfiguredProject, triggerFile: NormalizedPath | undefined, force: boolean): boolean; private getOrCreateInferredProjectForProjectRootPathIfEnabled; private getOrCreateSingleInferredProjectIfEnabled; private getOrCreateSingleInferredWithoutProjectRoot; private createInferredProject; /** @internal */ getOrCreateScriptInfoNotOpenedByClient(uncheckedFileName: string, currentDirectory: string, hostToQueryFileExistsOn: DirectoryStructureHost, deferredDeleteOk: boolean): ScriptInfo | undefined; getScriptInfo(uncheckedFileName: string): ScriptInfo | undefined; /** @internal */ getScriptInfoOrConfig(uncheckedFileName: string): ScriptInfoOrConfig | undefined; /** @internal */ logErrorForScriptInfoNotFound(fileName: string): void; /** * Returns the projects that contain script info through SymLink * Note that this does not return projects in info.containingProjects * * @internal */ getSymlinkedProjects(info: ScriptInfo): MultiMap | undefined; private watchClosedScriptInfo; private createNodeModulesWatcher; /** @internal */ watchPackageJsonsInNodeModules(dir: string, project: Project): FileWatcher; private watchClosedScriptInfoInNodeModules; private getModifiedTime; private refreshScriptInfo; private refreshScriptInfosInDirectory; private stopWatchingScriptInfo; private getOrCreateScriptInfoNotOpenedByClientForNormalizedPath; getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, hostToQueryFileExistsOn?: { fileExists(path: string): boolean; }): ScriptInfo | undefined; private getOrCreateScriptInfoWorker; /** * This gets the script info for the normalized path. If the path is not rooted disk path then the open script info with project root context is preferred */ getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo | undefined; getScriptInfoForPath(fileName: Path): ScriptInfo | undefined; /** @internal */ getDocumentPositionMapper(project: Project, generatedFileName: string, sourceFileName?: string): DocumentPositionMapper | undefined; private addSourceInfoToSourceMap; private addMissingSourceMapFile; /** @internal */ getSourceFileLike(fileName: string, projectNameOrProject: string | Project, declarationInfo?: ScriptInfo): SourceFileLike | undefined; /** @internal */ setPerformanceEventHandler(performanceEventHandler: PerformanceEventHandler): void; setHostConfiguration(args: protocol.ConfigureRequestArguments): void; /** @internal */ getWatchOptions(project: Project): WatchOptions | undefined; private getWatchOptionsFromProjectWatchOptions; closeLog(): void; private sendSourceFileChange; /** * This function rebuilds the project for every file opened by the client * This does not reload contents of open files from disk. But we could do that if needed */ reloadProjects(): void; /** * Remove the root of inferred project if script info is part of another project */ private removeRootOfInferredProjectIfNowPartOfOtherProject; /** * This function is to update the project structure for every inferred project. * It is called on the premise that all the configured projects are * up to date. * This will go through open files and assign them to inferred project if open file is not part of any other project * After that all the inferred project graphs are updated */ private ensureProjectForOpenFiles; /** * Open file whose contents is managed by the client * @param filename is absolute pathname * @param fileContent is a known version of the file content that is more up to date than the one on disk */ openClientFile(fileName: string, fileContent?: string, scriptKind?: ScriptKind, projectRootPath?: string): OpenConfiguredProjectResult; /** @internal */ getOriginalLocationEnsuringConfiguredProject(project: Project, location: DocumentPosition): DocumentPosition | undefined; /** @internal */ fileExists(fileName: NormalizedPath): boolean; private findExternalProjectContainingOpenScriptInfo; private getOrCreateOpenScriptInfo; private assignProjectToOpenedScriptInfo; /** * Depending on kind * - Find the configuedProject and return it - if allowDeferredClosed is set it will find the deferredClosed project as well * - Create - if the project doesnt exist, it creates one as well. If not delayLoad, the project is updated (with triggerFile if passed) * - Reload - if the project doesnt exist, it creates one. If not delayLoad, the project is reloaded clearing semantic cache * @internal */ findCreateOrReloadConfiguredProject(configFileName: NormalizedPath, kind: ConfiguredProjectLoadKind, /** Used with ConfiguredProjectLoadKind.Create or ConfiguredProjectLoadKind.Reload for new projects or reload updates */ reason?: string, /** Used with ConfiguredProjectLoadKind.Find to get deferredClosed projects as well */ allowDeferredClosed?: boolean, /** Used with ConfiguredProjectLoadKind.Create to send configFileDiag */ triggerFile?: NormalizedPath, /** Used with ConfiguredProjectLoadKind.Reload to check if this project was already reloaded */ reloadedProjects?: ConfiguredProjectToAnyReloadKind, /** Used with ConfiguredProjectLoadKind.Create to specify only create project without updating */ delayLoad?: boolean, /** Used with ConfiguredProjectLoadKind.Reload to specify delay reload, and also a set of configured projects already marked for delay load */ delayReloadedConfiguredProjects?: Set, /** project if already known for the config file */ projectForConfigFile?: ConfiguredProject): FindCreateOrLoadConfiguredProjectResult | undefined; /** * Finds the default configured project for given info * For any tsconfig found, it looks into that project, if not then all its references, * The search happens for all tsconfigs till projectRootPath */ private tryFindDefaultConfiguredProjectForOpenScriptInfo; private isMatchedByConfig; private tryFindDefaultConfiguredProjectForOpenScriptInfoOrClosedFileInfo; /** * Finds the default configured project, if found, it creates the solution projects (does not load them right away) * with Find: finds the projects even if the project is deferredClosed */ private tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo; /** @internal */ loadAncestorProjectTree(forProjects?: ReadonlyCollection): void; private ensureProjectChildren; private cleanupConfiguredProjects; private cleanupProjectsAndScriptInfos; private tryInvokeWildCardDirectories; openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, projectRootPath?: NormalizedPath): OpenConfiguredProjectResult; /** @internal */ getOrphanConfiguredProjects(toRetainConfiguredProjects: ConfigureProjectToLoadKind | Set | undefined, openFilesWithRetainedConfiguredProject: Set | undefined, externalProjectsRetainingConfiguredProjects: Set | undefined): Set; private removeOrphanScriptInfos; private telemetryOnOpenFile; /** * Close file whose contents is managed by the client * @param filename is absolute pathname */ closeClientFile(uncheckedFileName: string): void; /** @internal */ closeClientFile(uncheckedFileName: string, skipAssignOrphanScriptInfosToInferredProject: true): boolean; private collectChanges; /** @internal */ synchronizeProjectList(knownProjects: protocol.ProjectVersionInfo[], includeProjectReferenceRedirectInfo?: boolean): ProjectFilesWithTSDiagnostics[]; /** @internal */ applyChangesInOpenFiles(openFiles: Iterable | undefined, changedFiles?: Iterable, closedFiles?: string[]): void; /** @internal */ applyChangesToFile(scriptInfo: ScriptInfo, changes: Iterable): void; closeExternalProject(uncheckedFileName: string): void; /** @internal */ closeExternalProject(uncheckedFileName: string, cleanupAfter: boolean): void; openExternalProjects(projects: protocol.ExternalProject[]): void; /** Makes a filename safe to insert in a RegExp */ private static readonly filenameEscapeRegexp; private static escapeFilenameForRegex; resetSafeList(): void; applySafeList(proj: protocol.ExternalProject): NormalizedPath[]; private applySafeListWorker; openExternalProject(proj: protocol.ExternalProject): void; /** @internal */ openExternalProject(proj: protocol.ExternalProject, cleanupAfter: boolean): void; hasDeferredExtension(): boolean; /** * Performs the initial steps of enabling a plugin by finding and instantiating the module for a plugin either asynchronously or synchronously * @internal */ requestEnablePlugin(project: Project, pluginConfigEntry: PluginImport, searchPaths: string[]): void; /** * Performs the remaining steps of enabling a plugin after its module has been instantiated. */ private endEnablePlugin; /** @internal */ hasNewPluginEnablementRequests(): boolean; /** @internal */ hasPendingPluginEnablements(): boolean; /** * Waits for any ongoing plugin enablement requests to complete. * * @internal */ waitForPendingPlugins(): Promise; /** * Starts enabling any requested plugins without waiting for the result. * * @internal */ enableRequestedPlugins(): void; private enableRequestedPluginsAsync; private enableRequestedPluginsWorker; configurePlugin(args: protocol.ConfigurePluginRequestArguments): void; /** @internal */ getPackageJsonsVisibleToFile(fileName: string, project: Project, rootDir?: string): readonly ProjectPackageJsonInfo[]; /** @internal */ getNearestAncestorDirectoryWithPackageJson(fileName: string, project: Project): string | undefined; private watchPackageJsonFile; private onPackageJsonChange; /** @internal */ includePackageJsonAutoImports(): PackageJsonAutoImportPreference; /** @internal */ getIncompleteCompletionsCache(): IncompleteCompletionsCache; } /** @internal */ export type ScriptInfoOrConfig = ScriptInfo | TsConfigSourceFile; /** @internal */ export declare function isConfigFile(config: ScriptInfoOrConfig): config is TsConfigSourceFile; //# sourceMappingURL=editorServices.d.ts.map