import { ApplyWorkspaceEditParams, CancellationToken, ConfigurationItem, Disposable, DocumentDiagnosticReport, InitializeParams, LogMessageParams, PublishDiagnosticsParams, Registration, WorkspaceDiagnosticReport } from 'vscode-languageserver-protocol'; import { Connection, Event, NotificationHandler, ProgressToken, ProgressType, ProtocolNotificationType } from 'vscode-languageserver/node'; import { ImportLogger } from '../../analyzer/importLogger'; import { PythonPathResult } from '../../analyzer/pythonPathUtils'; import { PythonPlatform } from '../../common/configOptions'; import { Deferred } from '../../common/deferred'; import { FileSystem } from '../../common/fileSystem'; import { LimitedAccessHost } from '../../common/fullAccessHost'; import { HostKind, ScriptOutput } from '../../common/host'; import { PythonVersion } from '../../common/pythonVersion'; import { Uri } from '../../common/uri/uri'; import { FourSlashData } from '../harness/fourslash/fourSlashTypes'; import * as host from '../harness/testHost'; import * as vfs from '../harness/vfs/filesystem'; import { CustomLSP } from './customLsp'; export declare const DEFAULT_WORKSPACE_ROOT: string; export declare const ERROR_SCRIPT_OUTPUT = "Error: script failed to run"; export declare const STALL_SCRIPT_OUTPUT = "Timeout: script never finished running"; export interface PyrightServerInfo { disposables: Disposable[]; registrations: Registration[]; logs: LogMessageParams[]; connection: Connection; signals: Map>; testName: string; testData: FourSlashData; projectRoots: Uri[]; progressReporters: string[]; progressReporterStatus: Map; progressParts: Map; telemetry: any[]; supportsPullDiagnostics: boolean; diagnostics: PublishDiagnosticsParams[]; diagnosticsEvent: Event; workspaceEdits: ApplyWorkspaceEditParams[]; workspaceEditsEvent: Event; getInitializeParams(): InitializeParams; dispose(): Promise; convertPathToUri(path: string): Uri; workspaceDiagnosticsPartialResultToken?: string; pendingWorkspaceDiagnostics?: Promise; } export declare class TestHostOptions { version: PythonVersion; platform: PythonPlatform; searchPaths: Uri[]; runScript: (pythonPath: Uri | undefined, scriptPath: Uri, args: string[], cwd: Uri, token: CancellationToken) => Promise; constructor({ version, platform, searchPaths, runScript, }?: { version?: PythonVersion | undefined; platform?: PythonPlatform | undefined; searchPaths?: Uri[] | undefined; runScript?: ((pythonPath: Uri | undefined, scriptPath: Uri, args: string[], cwd: Uri, token: CancellationToken) => Promise<{ stdout: string; stderr: string; }>) | undefined; }); } export declare const logToDisk: (m: string, f: Uri) => void; export declare function logToDiskImpl(message: string, fileName: Uri): void; export declare function cleanupAfterAll(): Promise; export declare function getFileLikePath(uri: Uri): string; export declare function createFileSystem(projectRoot: string, testData: FourSlashData, optionalHost?: host.TestHost): vfs.TestFileSystem; export declare function updateSettingsMap(info: PyrightServerInfo, settings: { item: ConfigurationItem; value: any; }[]): void; export declare function getParseResults(fileContents: string, isStubFile?: boolean, useNotebookMode?: boolean): import("../../parser/parser").ParseFileResults; export declare function getOpenFiles(info: PyrightServerInfo, projectRoot?: Uri): Promise; export declare function waitForPushDiagnostics(info: PyrightServerInfo, clearFirst: boolean, numberOfFiles?: number, timeout?: number): Promise; export declare function waitForEvent(event: Event, name: string, condition: (p: T) => boolean, timeout?: number): Promise; export declare function convertDiagnosticReport(uri: string | undefined, report: DocumentDiagnosticReport | WorkspaceDiagnosticReport): PublishDiagnosticsParams[]; export declare function waitForDiagnostics(info: PyrightServerInfo, timeout?: number): Promise; interface ProgressPart { } interface ProgressContext { onProgress

(type: ProgressType

, token: string | number, handler: NotificationHandler

): Disposable; sendNotification(type: ProtocolNotificationType, params?: P): void; } declare class TestProgressPart implements ProgressPart { private readonly _context; private readonly _token; constructor(_context: ProgressContext, _token: ProgressToken, info: PyrightServerInfo, done: () => void); sendCancel(): void; } export declare function waitForPromise(promise: Promise, timeout?: number, message?: string): Promise; export declare function runPyrightServer(projectRoots: string[] | string, code: string, callInitialize?: boolean, extraSettings?: { item: ConfigurationItem; value: any; }[], pythonVersion?: PythonVersion, backgroundAnalysis?: boolean, supportPullDiagnostics?: boolean): Promise; export declare function initializeLanguageServer(info: PyrightServerInfo): Promise>; export declare function sleep(timeout: number): Promise; export declare function openFile(info: PyrightServerInfo, markerName: string, text?: string): void; export declare function hover(info: PyrightServerInfo, markerName: string): Promise; export declare function getInitializeParams(projectRoots: Uri[], supportsPullDiagnostics: boolean): InitializeParams; export declare class TestHost extends LimitedAccessHost { readonly fs: FileSystem; readonly testFs: vfs.TestFileSystem; readonly testData: FourSlashData; readonly projectRoots: string[]; private readonly _options; constructor(fs: FileSystem, testFs: vfs.TestFileSystem, testData: FourSlashData, projectRoots: string[], options?: TestHostOptions); get kind(): HostKind; getPythonVersion(pythonPath?: Uri, importLogger?: ImportLogger): PythonVersion | undefined; getPythonPlatform(importLogger?: ImportLogger): PythonPlatform | undefined; getPythonSearchPaths(pythonPath?: Uri, importLogger?: ImportLogger): PythonPathResult; runScript(pythonPath: Uri | undefined, scriptPath: Uri, args: string[], cwd: Uri, token: CancellationToken): Promise; } export {};