import * as vscode from 'vscode'; import * as proto from 'vscode-languageserver-protocol'; import { NotebookCellTextDocumentFilter } from 'vscode-languageserver-protocol'; import { DynamicFeature, FeatureClient, RegistrationData, FeatureState } from './features'; export type VNotebookDocumentChangeEvent = { /** * The notebook document */ notebook: vscode.NotebookDocument; /** * The changed meta data if any. */ metadata?: { [key: string]: any; }; /** * Changes to cells. */ cells?: { /** * Changes to the cell structure to add or * remove cells. */ structure?: { /** * The change to the cell array. */ array: { start: number; deleteCount: number; cells?: vscode.NotebookCell[]; }; /** * Additional opened cell text documents. */ didOpen?: vscode.NotebookCell[]; /** * Additional closed cell text documents. */ didClose?: vscode.NotebookCell[]; }; /** * Changes to notebook cells properties like its * kind or metadata. */ data?: vscode.NotebookCell[]; /** * Changes to the text content of notebook cells. */ textContent?: vscode.TextDocumentChangeEvent[]; }; }; export type NotebookDocumentOptions = { filterCells?(notebookDocument: vscode.NotebookDocument, cells: vscode.NotebookCell[]): vscode.NotebookCell[]; }; export type $NotebookDocumentOptions = { notebookDocumentOptions?: NotebookDocumentOptions; }; export type NotebookDocumentMiddleware = { notebooks?: { didOpen?: (this: void, notebookDocument: vscode.NotebookDocument, cells: vscode.NotebookCell[], next: (this: void, notebookDocument: vscode.NotebookDocument, cells: vscode.NotebookCell[]) => Promise) => Promise; didSave?: (this: void, notebookDocument: vscode.NotebookDocument, next: (this: void, notebookDocument: vscode.NotebookDocument) => Promise) => Promise; didChange?: (this: void, event: VNotebookDocumentChangeEvent, next: (this: void, event: VNotebookDocumentChangeEvent) => Promise) => Promise; didClose?: (this: void, notebookDocument: vscode.NotebookDocument, cells: vscode.NotebookCell[], next: (this: void, notebookDocument: vscode.NotebookDocument, cells: vscode.NotebookCell[]) => Promise) => Promise; }; }; export interface NotebookDocumentSyncFeatureShape { sendDidOpenNotebookDocument(notebookDocument: vscode.NotebookDocument): Promise; sendDidSaveNotebookDocument(notebookDocument: vscode.NotebookDocument): Promise; sendDidChangeNotebookDocument(event: VNotebookDocumentChangeEvent): Promise; sendDidCloseNotebookDocument(notebookDocument: vscode.NotebookDocument): Promise; } export type $NotebookCellTextDocumentFilter = NotebookCellTextDocumentFilter & { sync: true; }; export type NotebookDocumentProviderShape = { getProvider(notebookCell: vscode.NotebookCell): NotebookDocumentSyncFeatureShape | undefined; }; export declare class NotebookDocumentSyncFeature implements DynamicFeature, NotebookDocumentProviderShape { static readonly CellScheme: string; private readonly client; private readonly registrations; private dedicatedChannel; constructor(client: FeatureClient); getState(): FeatureState; readonly registrationType: proto.RegistrationType; fillClientCapabilities(capabilities: proto.ClientCapabilities): void; preInitialize(capabilities: proto.ServerCapabilities): void; initialize(capabilities: proto.ServerCapabilities): void; register(data: RegistrationData): void; unregister(id: string): void; clear(): void; handles(textDocument: vscode.TextDocument): boolean; getProvider(notebookCell: vscode.NotebookCell): NotebookDocumentSyncFeatureShape | undefined; private findNotebookDocumentAndCell; }