import { CancellationToken } from 'vscode-languageserver'; import { ConfigOptions } from '../common/configOptions'; import { ConsoleInterface } from '../common/console'; import { Diagnostic } from '../common/diagnostic'; import { FileDiagnostics } from '../common/diagnosticSink'; import { FileEditAction } from '../common/editAction'; import { EditableProgram, ProgramView } from '../common/extensibility'; import { LogTracker } from '../common/logTracker'; import { ServiceProvider } from '../common/serviceProvider'; import '../common/serviceProviderExtensions'; import { Range, TextRange } from '../common/textRange'; import { Uri } from '../common/uri/uri'; import { ParseFileResults, ParserOutput } from '../parser/parser'; import { RequiringAnalysisCount } from './analysis'; import { ImportResolver } from './importResolver'; import { IPythonMode, SourceFile } from './sourceFile'; import { SourceFileInfo } from './sourceFileInfo'; import { SourceMapper } from './sourceMapper'; import { Symbol, SymbolTable } from './symbol'; import { PrintTypeOptions, TypeEvaluator } from './typeEvaluatorTypes'; import { Type } from './types'; export interface MaxAnalysisTime { openFilesTimeInMs: number; noOpenFilesTimeInMs: number; } export type PreCheckCallback = (parserOutput: ParserOutput, evaluator: TypeEvaluator) => void; export interface ChangedRange { range: TextRange; delta: number; } export interface OpenFileOptions { isTracked: boolean; ipythonMode: IPythonMode; chainedFileUri: Uri | undefined; changedRange?: ChangedRange; } export declare class Program { readonly serviceProvider: ServiceProvider; private _disableChecker?; private static _nextId; private readonly _console; private readonly _sourceFileList; private readonly _sourceFileMap; private readonly _logTracker; private readonly _cacheManager; private readonly _id; private _allowedThirdPartyImports; private _configOptions; private _importResolver; private _evaluator; private _disposed; private _parsedFileCount; private _preCheckCallback; private _editModeTracker; private _sourceFileFactory; constructor(initialImportResolver: ImportResolver, initialConfigOptions: ConfigOptions, serviceProvider: ServiceProvider, logTracker?: LogTracker, _disableChecker?: boolean | undefined, id?: string); get id(): string; get console(): ConsoleInterface; get rootPath(): Uri; get evaluator(): TypeEvaluator | undefined; get configOptions(): ConfigOptions; get importResolver(): ImportResolver; get fileSystem(): import("../common/fileSystem").FileSystem; get isDisposed(): boolean; dispose(): void; enterEditMode(): void; exitEditMode(): FileEditAction[]; setConfigOptions(configOptions: ConfigOptions): void; setImportResolver(importResolver: ImportResolver): void; setTrackedFiles(fileUris: Uri[]): FileDiagnostics[]; setPreCheckCallback(preCheckCallback: PreCheckCallback): void; setAllowedThirdPartyImports(importNames: string[]): void; addTrackedFiles(fileUris: Uri[], isThirdPartyImport?: boolean, isInPyTypedPackage?: boolean): void; addInterimFile(fileUri: Uri): SourceFileInfo; addTrackedFile(fileUri: Uri, isThirdPartyImport?: boolean, isInPyTypedPackage?: boolean): SourceFile; setFileOpened(fileUri: Uri, version: number | null, contents: string, options?: OpenFileOptions): void; getChainedUri(fileUri: Uri): Uri | undefined; updateChainedUri(fileUri: Uri, chainedFileUri: Uri | undefined): void; setFileClosed(fileUri: Uri, isTracked?: boolean): FileDiagnostics[]; markAllFilesDirty(evenIfContentsAreSame: boolean): void; markFilesDirty(fileUris: Uri[], evenIfContentsAreSame: boolean): void; getFileCount(userFileOnly?: boolean): number; getUserFileCount(): number; getUserFiles(): SourceFileInfo[]; getOpened(): SourceFileInfo[]; getOwnedFiles(): SourceFileInfo[]; getCheckingRequiredFiles(): SourceFileInfo[]; getFilesToAnalyzeCount(): RequiringAnalysisCount; isCheckingOnlyOpenFiles(): boolean; functionSignatureDisplay(): import("../common/configOptions").SignatureDisplayType; containsSourceFileIn(folder: Uri): boolean; owns(uri: Uri): boolean; getSourceFile(uri: Uri): SourceFile | undefined; getBoundSourceFile(uri: Uri): SourceFile | undefined; getSourceFileInfoList(): readonly SourceFileInfo[]; getSourceFileInfo(uri: Uri): SourceFileInfo | undefined; getModuleSymbolTable(fileUri: Uri): SymbolTable | undefined; getBoundSourceFileInfo(uri: Uri, content?: string, force?: boolean): SourceFileInfo | undefined; analyze(maxTime?: MaxAnalysisTime, token?: CancellationToken): boolean; analyzeFile(fileUri: Uri, token?: CancellationToken): boolean; analyzeFileAndGetDiagnostics(fileUri: Uri, token?: CancellationToken): Diagnostic[]; run(callback: (p: ProgramView) => T, token: CancellationToken): T; runEditMode(callback: (v: EditableProgram) => void, token: CancellationToken): void; getSourceMapper(fileUri: Uri, token: CancellationToken, mapCompiled?: boolean, preferStubs?: boolean): SourceMapper; getParserOutput(fileUri: Uri): ParserOutput | undefined; getParseResults(fileUri: Uri): ParseFileResults | undefined; getParseDiagnostics(fileUri: Uri): Diagnostic[] | undefined; handleMemoryHighUsage(): void; printDetailedAnalysisTimes(): void; printDependencies(projectRootDir: Uri, verbose: boolean): void; writeTypeStub(targetImportPath: Uri, targetIsSingleFile: boolean, stubPath: Uri, token: CancellationToken): void; getTypeOfSymbol(symbol: Symbol): Type; printType(type: Type, options?: PrintTypeOptions): string; getTextOnRange(fileUri: Uri, range: Range, token: CancellationToken): string | undefined; getDiagnostics(options: ConfigOptions, reportDeltasOnly?: boolean): FileDiagnostics[]; getDiagnosticsForRange(fileUri: Uri, range: Range): Diagnostic[]; clone(): Program; getCacheUsage(): number; emptyCache(): void; bindShadowFile(stubFileUri: Uri, shadowFile: Uri): SourceFile | undefined; private _handleMemoryHighUsage; private _discardCachedParseResults; private _runEvaluatorWithCancellationToken; private _removeUnneededFiles; private _isFileNeeded; private _isImportNeededRecursive; private _createSourceMapper; private _isImportAllowed; private _getSourceFileInfoFromKey; private _updateSourceFileImports; private _removeSourceFileFromListAndMap; private _addToSourceFileListAndMap; private _getModuleName; private _getModuleImportInfoForFile; private _addShadowedFile; private _createInterimFileInfo; private _createNewEvaluator; private _parseFile; private _getImplicitImports; private _bindImplicitImports; private _bindFile; private _getEffectiveFutureImports; private _lookUpImport; private _shouldCheckFile; private _checkTypes; private _checkDependentFiles; private _getImportsRecursive; private _detectAndReportImportCycles; private _logImportCycle; private _markFileDirtyRecursive; }