import { CancellationToken, DidChangeConfigurationParams, DidChangeNotebookDocumentParams, Disposable, NotificationHandler, RequestHandler } from 'vscode-languageserver-protocol'; import { Uri } from '../../common/uri/uri'; export interface RequestSender { sendRequest(method: string, params: any, token?: CancellationToken): Promise; } export interface NotificationSender { sendNotification: (method: string, params?: any) => void; } export interface RequestReceiver { onRequest(method: string, handler: RequestHandler): Disposable; } export interface NotificationReceiver { onNotification

(method: string, handler: NotificationHandler

): Disposable; } export interface WorkspaceInfo { rootUri: Uri; kinds: string[]; pythonPath: Uri | undefined; pythonPathKind: string; } export declare namespace CustomLSP { export enum TestSignalKinds { Initialization = "initialization", DidOpenDocument = "didopendocument", DidChangeDocument = "didchangedocument" } export interface TestSignal { uri: string; kind: TestSignalKinds; } export enum Requests { GetDiagnostics = "test/getDiagnostics", GetOpenFiles = "test/getOpenFiles" } export enum Notifications { SetStatusBarMessage = "python/setStatusBarMessage", BeginProgress = "python/beginProgress", ReportProgress = "python/reportProgress", EndProgress = "python/endProgress", WorkspaceTrusted = "python/workspaceTrusted", TestSignal = "test/signal", DidChangeConfiguration = "workspace/didChangeConfiguration", DidChangeNotebookDocument = "notebookDocument/didChange", CacheDirCreate = "python/cacheDirCreate", CacheFileWrite = "python/cacheFileWrite", TestStartServer = "test/startServer", TestStartServerResponse = "test/startServerResponse" } interface Params { [Requests.GetDiagnostics]: { uri: string; }; [Requests.GetOpenFiles]: { uri: string; }; [Notifications.CacheDirCreate]: { uri: string; }; [Notifications.CacheFileWrite]: { uri: string; contents: string; overwrite: boolean; }; [Notifications.SetStatusBarMessage]: string; [Notifications.BeginProgress]: undefined; [Notifications.ReportProgress]: string; [Notifications.EndProgress]: undefined; [Notifications.WorkspaceTrusted]: { isTrusted: boolean; }; [Notifications.TestSignal]: TestSignal; [Notifications.DidChangeConfiguration]: DidChangeConfigurationParams; [Notifications.DidChangeNotebookDocument]: DidChangeNotebookDocumentParams; [Notifications.TestStartServer]: TestServerStartOptions; [Notifications.TestStartServerResponse]: { testName: string; }; } interface Response { [Requests.GetDiagnostics]: { diagnostics: string; }; [Requests.GetOpenFiles]: { files: string; }; } export interface IFileSpec { wildcardRoot: Uri; regExp: string; hasDirectoryWildcard: boolean; } export interface IConfigOptions { projectRoot: Uri; pythonPath?: Uri; typeshedPath?: Uri; include: IFileSpec[]; exclude: IFileSpec[]; ignore: IFileSpec[]; strict: IFileSpec[]; } /** * Data passed to the server worker thread in order to setup * a test server. */ export interface TestServerStartOptions { testName: string; pid: string; logFile: Uri; code: string; projectRoots: Uri[]; pythonVersion: string; backgroundAnalysis?: boolean; } export function sendRequest

(connection: RequestSender, method: M, params: P[M], token?: CancellationToken): Promise; export function sendNotification

(connection: NotificationSender, method: M, params: P[M]): void; export function onRequest

(connection: RequestReceiver, method: M, handler: RequestHandler): Disposable; export function onNotification

(connection: NotificationReceiver, method: M, handler: NotificationHandler): Disposable; export {}; }