1 | import { TextDocument, TextDocumentChangeEvent, TextDocumentWillSaveEvent, TextEdit as VTextEdit, DocumentSelector as VDocumentSelector, Event } from 'vscode';
|
2 | import { ClientCapabilities, DidChangeTextDocumentParams, DidCloseTextDocumentParams, DidOpenTextDocumentParams, DidSaveTextDocumentParams, DocumentSelector, ProtocolNotificationType, RegistrationType, ServerCapabilities, TextDocumentChangeRegistrationOptions, TextDocumentRegistrationOptions, TextDocumentSaveRegistrationOptions, TextDocumentSyncKind, TextDocumentSyncOptions, WillSaveTextDocumentParams } from 'vscode-languageserver-protocol';
|
3 | import { FeatureClient, TextDocumentEventFeature, DynamicFeature, NextSignature, TextDocumentSendFeature, NotifyingFeature, RegistrationData, DynamicDocumentFeature, NotificationSendEvent } from './features';
|
4 | export interface TextDocumentSynchronizationMiddleware {
|
5 | didOpen?: NextSignature<TextDocument, Promise<void>>;
|
6 | didChange?: NextSignature<TextDocumentChangeEvent, Promise<void>>;
|
7 | willSave?: NextSignature<TextDocumentWillSaveEvent, Promise<void>>;
|
8 | willSaveWaitUntil?: NextSignature<TextDocumentWillSaveEvent, Thenable<VTextEdit[]>>;
|
9 | didSave?: NextSignature<TextDocument, Promise<void>>;
|
10 | didClose?: NextSignature<TextDocument, Promise<void>>;
|
11 | }
|
12 | export interface DidOpenTextDocumentFeatureShape extends DynamicFeature<TextDocumentRegistrationOptions>, TextDocumentSendFeature<(textDocument: TextDocument) => Promise<void>>, NotifyingFeature<DidOpenTextDocumentParams> {
|
13 | openDocuments: Iterable<TextDocument>;
|
14 | }
|
15 | export type ResolvedTextDocumentSyncCapabilities = {
|
16 | resolvedTextDocumentSync?: TextDocumentSyncOptions;
|
17 | };
|
18 | export declare class DidOpenTextDocumentFeature extends TextDocumentEventFeature<DidOpenTextDocumentParams, TextDocument, TextDocumentSynchronizationMiddleware> implements DidOpenTextDocumentFeatureShape {
|
19 | private readonly _syncedDocuments;
|
20 | constructor(client: FeatureClient<TextDocumentSynchronizationMiddleware>, syncedDocuments: Map<string, TextDocument>);
|
21 | get openDocuments(): IterableIterator<TextDocument>;
|
22 | fillClientCapabilities(capabilities: ClientCapabilities): void;
|
23 | initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
|
24 | get registrationType(): RegistrationType<TextDocumentRegistrationOptions>;
|
25 | register(data: RegistrationData<TextDocumentRegistrationOptions>): void;
|
26 | protected getTextDocument(data: TextDocument): TextDocument;
|
27 | protected notificationSent(textDocument: TextDocument, type: ProtocolNotificationType<DidOpenTextDocumentParams, TextDocumentRegistrationOptions>, params: DidOpenTextDocumentParams): void;
|
28 | }
|
29 | export interface DidCloseTextDocumentFeatureShape extends DynamicFeature<TextDocumentRegistrationOptions>, TextDocumentSendFeature<(textDocument: TextDocument) => Promise<void>>, NotifyingFeature<DidCloseTextDocumentParams> {
|
30 | }
|
31 | export declare class DidCloseTextDocumentFeature extends TextDocumentEventFeature<DidCloseTextDocumentParams, TextDocument, TextDocumentSynchronizationMiddleware> implements DidCloseTextDocumentFeatureShape {
|
32 | private readonly _syncedDocuments;
|
33 | private readonly _pendingTextDocumentChanges;
|
34 | constructor(client: FeatureClient<TextDocumentSynchronizationMiddleware>, syncedDocuments: Map<string, TextDocument>, pendingTextDocumentChanges: Map<string, TextDocument>);
|
35 | get registrationType(): RegistrationType<TextDocumentRegistrationOptions>;
|
36 | fillClientCapabilities(capabilities: ClientCapabilities): void;
|
37 | initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
|
38 | protected callback(data: TextDocument): Promise<void>;
|
39 | protected getTextDocument(data: TextDocument): TextDocument;
|
40 | protected notificationSent(textDocument: TextDocument, type: ProtocolNotificationType<DidCloseTextDocumentParams, TextDocumentRegistrationOptions>, params: DidCloseTextDocumentParams): void;
|
41 | unregister(id: string): void;
|
42 | }
|
43 | export interface DidChangeTextDocumentFeatureShape extends DynamicFeature<TextDocumentChangeRegistrationOptions>, TextDocumentSendFeature<(event: TextDocumentChangeEvent) => Promise<void>>, NotifyingFeature<DidChangeTextDocumentParams> {
|
44 | }
|
45 | export declare class DidChangeTextDocumentFeature extends DynamicDocumentFeature<TextDocumentChangeRegistrationOptions, TextDocumentSynchronizationMiddleware> implements DidChangeTextDocumentFeatureShape {
|
46 | private _listener;
|
47 | private readonly _changeData;
|
48 | private readonly _onNotificationSent;
|
49 | private readonly _onPendingChangeAdded;
|
50 | private readonly _pendingTextDocumentChanges;
|
51 | private _syncKind;
|
52 | constructor(client: FeatureClient<TextDocumentSynchronizationMiddleware>, pendingTextDocumentChanges: Map<string, TextDocument>);
|
53 | get onNotificationSent(): Event<NotificationSendEvent<DidChangeTextDocumentParams>>;
|
54 | get onPendingChangeAdded(): Event<void>;
|
55 | get syncKind(): TextDocumentSyncKind;
|
56 | get registrationType(): RegistrationType<TextDocumentChangeRegistrationOptions>;
|
57 | fillClientCapabilities(capabilities: ClientCapabilities): void;
|
58 | initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
|
59 | register(data: RegistrationData<TextDocumentChangeRegistrationOptions>): void;
|
60 | getDocumentSelectors(): IterableIterator<VDocumentSelector>;
|
61 | private callback;
|
62 | notificationSent(textDocument: TextDocument, type: ProtocolNotificationType<DidChangeTextDocumentParams, TextDocumentRegistrationOptions>, params: DidChangeTextDocumentParams): void;
|
63 | unregister(id: string): void;
|
64 | clear(): void;
|
65 | getPendingDocumentChanges(excludes: Set<string>): TextDocument[];
|
66 | getProvider(document: TextDocument): {
|
67 | send: (event: TextDocumentChangeEvent) => Promise<void>;
|
68 | } | undefined;
|
69 | private updateSyncKind;
|
70 | }
|
71 | export declare class WillSaveFeature extends TextDocumentEventFeature<WillSaveTextDocumentParams, TextDocumentWillSaveEvent, TextDocumentSynchronizationMiddleware> {
|
72 | constructor(client: FeatureClient<TextDocumentSynchronizationMiddleware>);
|
73 | get registrationType(): RegistrationType<TextDocumentRegistrationOptions>;
|
74 | fillClientCapabilities(capabilities: ClientCapabilities): void;
|
75 | initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
|
76 | protected getTextDocument(data: TextDocumentWillSaveEvent): TextDocument;
|
77 | }
|
78 | export declare class WillSaveWaitUntilFeature extends DynamicDocumentFeature<TextDocumentRegistrationOptions, TextDocumentSynchronizationMiddleware> {
|
79 | private _listener;
|
80 | private readonly _selectors;
|
81 | constructor(client: FeatureClient<TextDocumentSynchronizationMiddleware>);
|
82 | protected getDocumentSelectors(): IterableIterator<VDocumentSelector>;
|
83 | get registrationType(): RegistrationType<TextDocumentRegistrationOptions>;
|
84 | fillClientCapabilities(capabilities: ClientCapabilities): void;
|
85 | initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
|
86 | register(data: RegistrationData<TextDocumentRegistrationOptions>): void;
|
87 | private callback;
|
88 | unregister(id: string): void;
|
89 | clear(): void;
|
90 | }
|
91 | export interface DidSaveTextDocumentFeatureShape extends DynamicFeature<TextDocumentRegistrationOptions>, TextDocumentSendFeature<(textDocument: TextDocument) => Promise<void>>, NotifyingFeature<DidSaveTextDocumentParams> {
|
92 | }
|
93 | export declare class DidSaveTextDocumentFeature extends TextDocumentEventFeature<DidSaveTextDocumentParams, TextDocument, TextDocumentSynchronizationMiddleware> implements DidSaveTextDocumentFeatureShape {
|
94 | private _includeText;
|
95 | constructor(client: FeatureClient<TextDocumentSynchronizationMiddleware>);
|
96 | get registrationType(): RegistrationType<TextDocumentSaveRegistrationOptions>;
|
97 | fillClientCapabilities(capabilities: ClientCapabilities): void;
|
98 | initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
|
99 | register(data: RegistrationData<TextDocumentSaveRegistrationOptions>): void;
|
100 | protected getTextDocument(data: TextDocument): TextDocument;
|
101 | }
|