1 | import * as vscode from 'vscode';
|
2 | import * as proto from 'vscode-languageserver-protocol';
|
3 | import { NotebookCellTextDocumentFilter } from 'vscode-languageserver-protocol';
|
4 | import { DynamicFeature, FeatureClient, RegistrationData, FeatureState } from './features';
|
5 | export type VNotebookDocumentChangeEvent = {
|
6 | |
7 |
|
8 |
|
9 | notebook: vscode.NotebookDocument;
|
10 | |
11 |
|
12 |
|
13 | metadata?: {
|
14 | [key: string]: any;
|
15 | };
|
16 | |
17 |
|
18 |
|
19 | cells?: {
|
20 | |
21 |
|
22 |
|
23 |
|
24 | structure?: {
|
25 | |
26 |
|
27 |
|
28 | array: {
|
29 | start: number;
|
30 | deleteCount: number;
|
31 | cells?: vscode.NotebookCell[];
|
32 | };
|
33 | |
34 |
|
35 |
|
36 | didOpen?: vscode.NotebookCell[];
|
37 | |
38 |
|
39 |
|
40 | didClose?: vscode.NotebookCell[];
|
41 | };
|
42 | |
43 |
|
44 |
|
45 |
|
46 | data?: vscode.NotebookCell[];
|
47 | |
48 |
|
49 |
|
50 | textContent?: vscode.TextDocumentChangeEvent[];
|
51 | };
|
52 | };
|
53 | export type NotebookDocumentOptions = {
|
54 | filterCells?(notebookDocument: vscode.NotebookDocument, cells: vscode.NotebookCell[]): vscode.NotebookCell[];
|
55 | };
|
56 | export type $NotebookDocumentOptions = {
|
57 | notebookDocumentOptions?: NotebookDocumentOptions;
|
58 | };
|
59 | export type NotebookDocumentMiddleware = {
|
60 | notebooks?: {
|
61 | didOpen?: (this: void, notebookDocument: vscode.NotebookDocument, cells: vscode.NotebookCell[], next: (this: void, notebookDocument: vscode.NotebookDocument, cells: vscode.NotebookCell[]) => Promise<void>) => Promise<void>;
|
62 | didSave?: (this: void, notebookDocument: vscode.NotebookDocument, next: (this: void, notebookDocument: vscode.NotebookDocument) => Promise<void>) => Promise<void>;
|
63 | didChange?: (this: void, event: VNotebookDocumentChangeEvent, next: (this: void, event: VNotebookDocumentChangeEvent) => Promise<void>) => Promise<void>;
|
64 | didClose?: (this: void, notebookDocument: vscode.NotebookDocument, cells: vscode.NotebookCell[], next: (this: void, notebookDocument: vscode.NotebookDocument, cells: vscode.NotebookCell[]) => Promise<void>) => Promise<void>;
|
65 | };
|
66 | };
|
67 | export interface NotebookDocumentSyncFeatureShape {
|
68 | sendDidOpenNotebookDocument(notebookDocument: vscode.NotebookDocument): Promise<void>;
|
69 | sendDidSaveNotebookDocument(notebookDocument: vscode.NotebookDocument): Promise<void>;
|
70 | sendDidChangeNotebookDocument(event: VNotebookDocumentChangeEvent): Promise<void>;
|
71 | sendDidCloseNotebookDocument(notebookDocument: vscode.NotebookDocument): Promise<void>;
|
72 | }
|
73 | export type $NotebookCellTextDocumentFilter = NotebookCellTextDocumentFilter & {
|
74 | sync: true;
|
75 | };
|
76 | export type NotebookDocumentProviderShape = {
|
77 | getProvider(notebookCell: vscode.NotebookCell): NotebookDocumentSyncFeatureShape | undefined;
|
78 | };
|
79 | export declare class NotebookDocumentSyncFeature implements DynamicFeature<proto.NotebookDocumentSyncRegistrationOptions>, NotebookDocumentProviderShape {
|
80 | static readonly CellScheme: string;
|
81 | private readonly client;
|
82 | private readonly registrations;
|
83 | private dedicatedChannel;
|
84 | constructor(client: FeatureClient<NotebookDocumentMiddleware, $NotebookDocumentOptions>);
|
85 | getState(): FeatureState;
|
86 | readonly registrationType: proto.RegistrationType<proto.NotebookDocumentSyncRegistrationOptions>;
|
87 | fillClientCapabilities(capabilities: proto.ClientCapabilities): void;
|
88 | preInitialize(capabilities: proto.ServerCapabilities<any>): void;
|
89 | initialize(capabilities: proto.ServerCapabilities<any>): void;
|
90 | register(data: RegistrationData<proto.NotebookDocumentSyncRegistrationOptions>): void;
|
91 | unregister(id: string): void;
|
92 | clear(): void;
|
93 | handles(textDocument: vscode.TextDocument): boolean;
|
94 | getProvider(notebookCell: vscode.NotebookCell): NotebookDocumentSyncFeatureShape | undefined;
|
95 | private findNotebookDocumentAndCell;
|
96 | }
|