UNPKG

37.2 kBTypeScriptView Raw
1import { CancellationToken, ProtocolRequestType0, RequestHandler0, ProtocolRequestType, RequestHandler, GenericRequestHandler, StarRequestHandler, HandlerResult, ProtocolNotificationType0, NotificationHandler0, ProtocolNotificationType, NotificationHandler, GenericNotificationHandler, StarNotificationHandler, ProgressType, Disposable, InitializeParams, InitializeResult, InitializeError, InitializedParams, DidChangeConfigurationParams, DidChangeWatchedFilesParams, DidOpenTextDocumentParams, DidChangeTextDocumentParams, DidCloseTextDocumentParams, WillSaveTextDocumentParams, TextEdit, DidSaveTextDocumentParams, PublishDiagnosticsParams, HoverParams, Hover, CompletionParams, CompletionItem, CompletionList, SignatureHelpParams, SignatureHelp, DeclarationParams, Declaration, DeclarationLink, Location, DefinitionParams, Definition, DefinitionLink, TypeDefinitionParams, ImplementationParams, ReferenceParams, DocumentHighlightParams, DocumentHighlight, DocumentSymbolParams, SymbolInformation, DocumentSymbol, WorkspaceSymbolParams, CodeActionParams, Command, CodeAction, CodeLensParams, CodeLens, DocumentFormattingParams, DocumentRangeFormattingParams, DocumentOnTypeFormattingParams, RenameParams, WorkspaceEdit, PrepareRenameParams, Range, DocumentLinkParams, DocumentLink, DocumentColorParams, ColorInformation, ColorPresentationParams, ColorPresentation, FoldingRangeParams, FoldingRange, SelectionRangeParams, SelectionRange, ExecuteCommandParams, MessageActionItem, ClientCapabilities, ServerCapabilities, Logger, ProtocolConnection, MessageSignature, ApplyWorkspaceEditParams, ApplyWorkspaceEditResponse, WorkDoneProgressParams, PartialResultParams, RegistrationType, RequestType0, RequestType, NotificationType0, NotificationType, WorkspaceSymbol } from 'vscode-languageserver-protocol';
2import { WorkDoneProgressReporter, ResultProgressReporter, WindowProgress } from './progress';
3import { Configuration } from './configuration';
4import { WorkspaceFolders } from './workspaceFolder';
5import { CallHierarchy } from './callHierarchy';
6import { SemanticTokensFeatureShape } from './semanticTokens';
7import { ShowDocumentFeatureShape } from './showDocument';
8import { FileOperationsFeatureShape } from './fileOperations';
9import { LinkedEditingRangeFeatureShape } from './linkedEditingRange';
10import { TypeHierarchyFeatureShape } from './typeHierarchy';
11import { InlineValueFeatureShape } from './inlineValue';
12import { FoldingRangeFeatureShape } from './foldingRange';
13import { InlayHintFeatureShape } from './inlayHint';
14import { DiagnosticFeatureShape } from './diagnostic';
15import { NotebookSyncFeatureShape } from './notebook';
16import { MonikerFeatureShape } from './moniker';
17/**
18 * Helps tracking error message. Equal occurrences of the same
19 * message are only stored once. This class is for example
20 * useful if text documents are validated in a loop and equal
21 * error message should be folded into one.
22 */
23export declare class ErrorMessageTracker {
24 private _messages;
25 constructor();
26 /**
27 * Add a message to the tracker.
28 *
29 * @param message The message to add.
30 */
31 add(message: string): void;
32 /**
33 * Send all tracked messages to the connection's window.
34 *
35 * @param connection The connection established between client and server.
36 */
37 sendErrors(connection: {
38 window: RemoteWindow;
39 }): void;
40}
41export interface FeatureBase {
42 /**
43 * Called to initialize the remote with the given
44 * client capabilities
45 *
46 * @param capabilities The client capabilities
47 */
48 initialize(capabilities: ClientCapabilities): void;
49 /**
50 * Called to fill in the server capabilities this feature implements.
51 *
52 * @param capabilities The server capabilities to fill.
53 */
54 fillServerCapabilities(capabilities: ServerCapabilities): void;
55}
56interface Remote extends FeatureBase {
57 /**
58 * Attach the remote to the given connection.
59 *
60 * @param connection The connection this remote is operating on.
61 */
62 attach(connection: Connection): void;
63 /**
64 * The connection this remote is attached to.
65 */
66 connection: Connection;
67}
68/**
69 * The RemoteConsole interface contains all functions to interact with
70 * the tools / clients console or log system. Internally it used `window/logMessage`
71 * notifications.
72 */
73export interface RemoteConsole extends FeatureBase {
74 /**
75 * The connection this remote is attached to.
76 */
77 connection: Connection;
78 /**
79 * Show an error message.
80 *
81 * @param message The message to show.
82 */
83 error(message: string): void;
84 /**
85 * Show a warning message.
86 *
87 * @param message The message to show.
88 */
89 warn(message: string): void;
90 /**
91 * Show an information message.
92 *
93 * @param message The message to show.
94 */
95 info(message: string): void;
96 /**
97 * Log a message.
98 *
99 * @param message The message to log.
100 */
101 log(message: string): void;
102 /**
103 * Log a debug message.
104 *
105 * @param message The message to log.
106 *
107 * @since 3.18.0
108 */
109 debug(message: string): void;
110}
111/**
112 * The RemoteWindow interface contains all functions to interact with
113 * the visual window of VS Code.
114 */
115export interface _RemoteWindow extends FeatureBase {
116 /**
117 * The connection this remote is attached to.
118 */
119 connection: Connection;
120 /**
121 * Shows an error message in the client's user interface. Depending on the client this might
122 * be a modal dialog with a confirmation button or a notification in a notification center
123 *
124 * @param message The message to show.
125 * @param actions Possible additional actions presented in the user interface. The selected action
126 * will be the value of the resolved promise
127 */
128 showErrorMessage(message: string): void;
129 showErrorMessage<T extends MessageActionItem>(message: string, ...actions: T[]): Promise<T | undefined>;
130 /**
131 * Shows a warning message in the client's user interface. Depending on the client this might
132 * be a modal dialog with a confirmation button or a notification in a notification center
133 *
134 * @param message The message to show.
135 * @param actions Possible additional actions presented in the user interface. The selected action
136 * will be the value of the resolved promise
137 */
138 showWarningMessage(message: string): void;
139 showWarningMessage<T extends MessageActionItem>(message: string, ...actions: T[]): Promise<T | undefined>;
140 /**
141 * Shows an information message in the client's user interface. Depending on the client this might
142 * be a modal dialog with a confirmation button or a notification in a notification center
143 *
144 * @param message The message to show.
145 * @param actions Possible additional actions presented in the user interface. The selected action
146 * will be the value of the resolved promise
147 */
148 showInformationMessage(message: string): void;
149 showInformationMessage<T extends MessageActionItem>(message: string, ...actions: T[]): Promise<T | undefined>;
150}
151export type RemoteWindow = _RemoteWindow & WindowProgress & ShowDocumentFeatureShape;
152/**
153 * A bulk registration manages n single registration to be able to register
154 * for n notifications or requests using one register request.
155 */
156export interface BulkRegistration {
157 /**
158 * Adds a single registration.
159 * @param type the notification type to register for.
160 * @param registerParams special registration parameters.
161 */
162 add<RO>(type: ProtocolNotificationType0<RO>, registerParams: RO): void;
163 add<P, RO>(type: ProtocolNotificationType<P, RO>, registerParams: RO): void;
164 /**
165 * Adds a single registration.
166 * @param type the request type to register for.
167 * @param registerParams special registration parameters.
168 */
169 add<R, PR, E, RO>(type: ProtocolRequestType0<R, PR, E, RO>, registerParams: RO): void;
170 add<P, PR, R, E, RO>(type: ProtocolRequestType<P, PR, R, E, RO>, registerParams: RO): void;
171 /**
172 * Adds a single registration.
173 * @param type the notification type to register for.
174 * @param registerParams special registration parameters.
175 */
176 add<RO>(type: RegistrationType<RO>, registerParams: RO): void;
177}
178export declare namespace BulkRegistration {
179 /**
180 * Creates a new bulk registration.
181 * @return an empty bulk registration.
182 */
183 function create(): BulkRegistration;
184}
185/**
186 * A `BulkUnregistration` manages n unregistrations.
187 */
188export interface BulkUnregistration extends Disposable {
189 /**
190 * Disposes a single registration. It will be removed from the
191 * `BulkUnregistration`.
192 */
193 disposeSingle(arg: string | MessageSignature): boolean;
194}
195export declare namespace BulkUnregistration {
196 function create(): BulkUnregistration;
197}
198/**
199 * Interface to register and unregister `listeners` on the client / tools side.
200 */
201export interface RemoteClient extends FeatureBase {
202 /**
203 * The connection this remote is attached to.
204 */
205 connection: Connection;
206 /**
207 * Registers a listener for the given request.
208 *
209 * @param type the request type to register for.
210 * @param registerParams special registration parameters.
211 * @return a `Disposable` to unregister the listener again.
212 */
213 register<P, RO>(type: ProtocolNotificationType<P, RO>, registerParams?: RO): Promise<Disposable>;
214 register<RO>(type: ProtocolNotificationType0<RO>, registerParams?: RO): Promise<Disposable>;
215 /**
216 * Registers a listener for the given request.
217 *
218 * @param unregisteration the unregistration to add a corresponding unregister action to.
219 * @param type the request type to register for.
220 * @param registerParams special registration parameters.
221 * @return the updated unregistration.
222 */
223 register<P, RO>(unregisteration: BulkUnregistration, type: ProtocolNotificationType<P, RO>, registerParams?: RO): Promise<Disposable>;
224 register<RO>(unregisteration: BulkUnregistration, type: ProtocolNotificationType0<RO>, registerParams?: RO): Promise<Disposable>;
225 /**
226 * Registers a listener for the given request.
227 *
228 * @param type the request type to register for.
229 * @param registerParams special registration parameters.
230 * @return a `Disposable` to unregister the listener again.
231 */
232 register<P, R, PR, E, RO>(type: ProtocolRequestType<P, R, PR, E, RO>, registerParams?: RO): Promise<Disposable>;
233 register<R, PR, E, RO>(type: ProtocolRequestType0<R, PR, E, RO>, registerParams?: RO): Promise<Disposable>;
234 /**
235 * Registers a listener for the given request.
236 *
237 * @param unregisteration the unregistration to add a corresponding unregister action to.
238 * @param type the request type to register for.
239 * @param registerParams special registration parameters.
240 * @return the updated unregistration.
241 */
242 register<P, R, PR, E, RO>(unregisteration: BulkUnregistration, type: ProtocolRequestType<P, R, PR, E, RO>, registerParams?: RO): Promise<Disposable>;
243 register<R, PR, E, RO>(unregisteration: BulkUnregistration, type: ProtocolRequestType0<R, PR, E, RO>, registerParams?: RO): Promise<Disposable>;
244 /**
245 * Registers a listener for the given registration type.
246 *
247 * @param type the registration type.
248 * @param registerParams special registration parameters.
249 * @return a `Disposable` to unregister the listener again.
250 */
251 register<RO>(type: RegistrationType<RO>, registerParams?: RO): Promise<Disposable>;
252 /**
253 * Registers a listener for the given registration type.
254 *
255 * @param unregisteration the unregistration to add a corresponding unregister action to.
256 * @param type the registration type.
257 * @param registerParams special registration parameters.
258 * @return the updated unregistration.
259 */
260 register<RO>(unregisteration: BulkUnregistration, type: RegistrationType<RO>, registerParams?: RO): Promise<Disposable>;
261 /**
262 * Registers a set of listeners.
263 * @param registrations the bulk registration
264 * @return a `Disposable` to unregister the listeners again.
265 */
266 register(registrations: BulkRegistration): Promise<BulkUnregistration>;
267}
268/**
269 * Represents the workspace managed by the client.
270 */
271export interface _RemoteWorkspace extends FeatureBase {
272 /**
273 * The connection this remote is attached to.
274 */
275 connection: Connection;
276 /**
277 * Applies a `WorkspaceEdit` to the workspace
278 * @param param the workspace edit params.
279 * @return a thenable that resolves to the `ApplyWorkspaceEditResponse`.
280 */
281 applyEdit(paramOrEdit: ApplyWorkspaceEditParams | WorkspaceEdit): Promise<ApplyWorkspaceEditResponse>;
282}
283export type RemoteWorkspace = _RemoteWorkspace & Configuration & WorkspaceFolders & FileOperationsFeatureShape;
284/**
285 * Interface to log telemetry events. The events are actually send to the client
286 * and the client needs to feed the event into a proper telemetry system.
287 */
288export interface Telemetry extends FeatureBase {
289 /**
290 * The connection this remote is attached to.
291 */
292 connection: Connection;
293 /**
294 * Log the given data to telemetry.
295 *
296 * @param data The data to log. Must be a JSON serializable object.
297 */
298 logEvent(data: any): void;
299}
300/**
301 * Interface to log traces to the client. The events are sent to the client and the
302 * client needs to log the trace events.
303 */
304export interface RemoteTracer extends FeatureBase {
305 /**
306 * The connection this remote is attached to.
307 */
308 connection: Connection;
309 /**
310 * Log the given data to the trace Log
311 */
312 log(message: string, verbose?: string): void;
313}
314export interface _Languages extends FeatureBase {
315 connection: Connection;
316 attachWorkDoneProgress(params: WorkDoneProgressParams): WorkDoneProgressReporter;
317 attachPartialResultProgress<PR>(type: ProgressType<PR>, params: PartialResultParams): ResultProgressReporter<PR> | undefined;
318}
319export declare class _LanguagesImpl implements Remote, _Languages {
320 private _connection;
321 constructor();
322 attach(connection: Connection): void;
323 get connection(): Connection;
324 initialize(_capabilities: ClientCapabilities): void;
325 fillServerCapabilities(_capabilities: ServerCapabilities): void;
326 attachWorkDoneProgress(params: WorkDoneProgressParams): WorkDoneProgressReporter;
327 attachPartialResultProgress<PR>(_type: ProgressType<PR>, params: PartialResultParams): ResultProgressReporter<PR> | undefined;
328}
329export type Languages = _Languages & CallHierarchy & SemanticTokensFeatureShape & LinkedEditingRangeFeatureShape & TypeHierarchyFeatureShape & InlineValueFeatureShape & InlayHintFeatureShape & DiagnosticFeatureShape & MonikerFeatureShape & FoldingRangeFeatureShape;
330export interface _Notebooks extends FeatureBase {
331 connection: Connection;
332 attachWorkDoneProgress(params: WorkDoneProgressParams): WorkDoneProgressReporter;
333 attachPartialResultProgress<PR>(type: ProgressType<PR>, params: PartialResultParams): ResultProgressReporter<PR> | undefined;
334}
335export declare class _NotebooksImpl implements Remote, _Notebooks {
336 private _connection;
337 constructor();
338 attach(connection: Connection): void;
339 get connection(): Connection;
340 initialize(_capabilities: ClientCapabilities): void;
341 fillServerCapabilities(_capabilities: ServerCapabilities): void;
342 attachWorkDoneProgress(params: WorkDoneProgressParams): WorkDoneProgressReporter;
343 attachPartialResultProgress<PR>(_type: ProgressType<PR>, params: PartialResultParams): ResultProgressReporter<PR> | undefined;
344}
345export type Notebooks = _Notebooks & NotebookSyncFeatureShape;
346/**
347 * An empty interface for new proposed API.
348 */
349export interface _ {
350}
351export interface ServerRequestHandler<P, R, PR, E> {
352 (params: P, token: CancellationToken, workDoneProgress: WorkDoneProgressReporter, resultProgress?: ResultProgressReporter<PR>): HandlerResult<R, E>;
353}
354/**
355 * Interface to describe the shape of the server connection.
356 */
357export interface _Connection<PConsole = _, PTracer = _, PTelemetry = _, PClient = _, PWindow = _, PWorkspace = _, PLanguages = _, PNotebooks = _> {
358 /**
359 * Start listening on the input stream for messages to process.
360 */
361 listen(): void;
362 /**
363 * Installs a request handler described by the given {@link RequestType}.
364 *
365 * @param type The {@link RequestType} describing the request.
366 * @param handler The handler to install
367 */
368 onRequest<R, PR, E, RO>(type: ProtocolRequestType0<R, PR, E, RO>, handler: RequestHandler0<R, E>): Disposable;
369 onRequest<P, R, PR, E, RO>(type: ProtocolRequestType<P, R, PR, E, RO>, handler: RequestHandler<P, R, E>): Disposable;
370 onRequest<R, PR, E, RO>(type: RequestType0<R, E>, handler: RequestHandler0<R, E>): Disposable;
371 onRequest<P, R, E>(type: RequestType<P, R, E>, handler: RequestHandler<P, R, E>): Disposable;
372 /**
373 * Installs a request handler for the given method.
374 *
375 * @param method The method to register a request handler for.
376 * @param handler The handler to install.
377 */
378 onRequest<R, E>(method: string, handler: GenericRequestHandler<R, E>): Disposable;
379 /**
380 * Installs a request handler that is invoked if no specific request handler can be found.
381 *
382 * @param handler a handler that handles all requests.
383 */
384 onRequest(handler: StarRequestHandler): Disposable;
385 /**
386 * Send a request to the client.
387 *
388 * @param type The {@link RequestType} describing the request.
389 * @param params The request's parameters.
390 */
391 sendRequest<R, PR, E, RO>(type: ProtocolRequestType0<R, PR, E, RO>, token?: CancellationToken): Promise<R>;
392 sendRequest<P, R, PR, E, RO>(type: ProtocolRequestType<P, R, PR, E, RO>, params: P, token?: CancellationToken): Promise<R>;
393 sendRequest<R, E>(type: RequestType0<R, E>, token?: CancellationToken): Promise<R>;
394 sendRequest<P, R, E>(type: RequestType<P, R, E>, params: P, token?: CancellationToken): Promise<R>;
395 /**
396 * Send a request to the client.
397 *
398 * @param method The method to invoke on the client.
399 * @param params The request's parameters.
400 */
401 sendRequest<R>(method: string, token?: CancellationToken): Promise<R>;
402 sendRequest<R>(method: string, params: any, token?: CancellationToken): Promise<R>;
403 /**
404 * Installs a notification handler described by the given {@link NotificationType}.
405 *
406 * @param type The {@link NotificationType} describing the notification.
407 * @param handler The handler to install.
408 */
409 onNotification<RO>(type: ProtocolNotificationType0<RO>, handler: NotificationHandler0): Disposable;
410 onNotification<P, RO>(type: ProtocolNotificationType<P, RO>, handler: NotificationHandler<P>): Disposable;
411 onNotification(type: NotificationType0, handler: NotificationHandler0): Disposable;
412 onNotification<P>(type: NotificationType<P>, handler: NotificationHandler<P>): Disposable;
413 /**
414 * Installs a notification handler for the given method.
415 *
416 * @param method The method to register a request handler for.
417 * @param handler The handler to install.
418 */
419 onNotification(method: string, handler: GenericNotificationHandler): Disposable;
420 /**
421 * Installs a notification handler that is invoked if no specific notification handler can be found.
422 *
423 * @param handler a handler that handles all notifications.
424 */
425 onNotification(handler: StarNotificationHandler): Disposable;
426 /**
427 * Send a notification to the client.
428 *
429 * @param type The {@link NotificationType} describing the notification.
430 * @param params The notification's parameters.
431 */
432 sendNotification<RO>(type: ProtocolNotificationType0<RO>): Promise<void>;
433 sendNotification<P, RO>(type: ProtocolNotificationType<P, RO>, params: P): Promise<void>;
434 sendNotification(type: NotificationType0): Promise<void>;
435 sendNotification<P>(type: NotificationType<P>, params: P): Promise<void>;
436 /**
437 * Send a notification to the client.
438 *
439 * @param method The method to invoke on the client.
440 * @param params The notification's parameters.
441 */
442 sendNotification(method: string, params?: any): Promise<void>;
443 /**
444 * Installs a progress handler for a given token.
445 * @param type the progress type
446 * @param token the token
447 * @param handler the handler
448 */
449 onProgress<P>(type: ProgressType<P>, token: string | number, handler: NotificationHandler<P>): Disposable;
450 /**
451 * Sends progress.
452 * @param type the progress type
453 * @param token the token to use
454 * @param value the progress value
455 */
456 sendProgress<P>(type: ProgressType<P>, token: string | number, value: P): Promise<void>;
457 /**
458 * Installs a handler for the initialize request.
459 *
460 * @param handler The initialize handler.
461 */
462 onInitialize(handler: ServerRequestHandler<InitializeParams, InitializeResult, never, InitializeError>): Disposable;
463 /**
464 * Installs a handler for the initialized notification.
465 *
466 * @param handler The initialized handler.
467 */
468 onInitialized(handler: NotificationHandler<InitializedParams>): Disposable;
469 /**
470 * Installs a handler for the shutdown request.
471 *
472 * @param handler The initialize handler.
473 */
474 onShutdown(handler: RequestHandler0<void, void>): Disposable;
475 /**
476 * Installs a handler for the exit notification.
477 *
478 * @param handler The exit handler.
479 */
480 onExit(handler: NotificationHandler0): Disposable;
481 /**
482 * A property to provide access to console specific features.
483 */
484 console: RemoteConsole & PConsole;
485 /**
486 * A property to provide access to tracer specific features.
487 */
488 tracer: RemoteTracer & PTracer;
489 /**
490 * A property to provide access to telemetry specific features.
491 */
492 telemetry: Telemetry & PTelemetry;
493 /**
494 * A property to provide access to client specific features like registering
495 * for requests or notifications.
496 */
497 client: RemoteClient & PClient;
498 /**
499 * A property to provide access to windows specific features.
500 */
501 window: RemoteWindow & PWindow;
502 /**
503 * A property to provide access to workspace specific features.
504 */
505 workspace: RemoteWorkspace & PWorkspace;
506 /**
507 * A property to provide access to language specific features.
508 */
509 languages: Languages & PLanguages;
510 /**
511 * A property to provide access to notebook specific features.
512 */
513 notebooks: Notebooks & PNotebooks;
514 /**
515 * Installs a handler for the `DidChangeConfiguration` notification.
516 *
517 * @param handler The corresponding handler.
518 */
519 onDidChangeConfiguration(handler: NotificationHandler<DidChangeConfigurationParams>): Disposable;
520 /**
521 * Installs a handler for the `DidChangeWatchedFiles` notification.
522 *
523 * @param handler The corresponding handler.
524 */
525 onDidChangeWatchedFiles(handler: NotificationHandler<DidChangeWatchedFilesParams>): Disposable;
526 /**
527 * Installs a handler for the `DidOpenTextDocument` notification.
528 *
529 * @param handler The corresponding handler.
530 */
531 onDidOpenTextDocument(handler: NotificationHandler<DidOpenTextDocumentParams>): Disposable;
532 /**
533 * Installs a handler for the `DidChangeTextDocument` notification.
534 *
535 * @param handler The corresponding handler.
536 */
537 onDidChangeTextDocument(handler: NotificationHandler<DidChangeTextDocumentParams>): Disposable;
538 /**
539 * Installs a handler for the `DidCloseTextDocument` notification.
540 *
541 * @param handler The corresponding handler.
542 */
543 onDidCloseTextDocument(handler: NotificationHandler<DidCloseTextDocumentParams>): Disposable;
544 /**
545 * Installs a handler for the `WillSaveTextDocument` notification.
546 *
547 * Note that this notification is opt-in. The client will not send it unless
548 * your server has the `textDocumentSync.willSave` capability or you've
549 * dynamically registered for the `textDocument/willSave` method.
550 *
551 * @param handler The corresponding handler.
552 */
553 onWillSaveTextDocument(handler: NotificationHandler<WillSaveTextDocumentParams>): Disposable;
554 /**
555 * Installs a handler for the `WillSaveTextDocumentWaitUntil` request.
556 *
557 * Note that this request is opt-in. The client will not send it unless
558 * your server has the `textDocumentSync.willSaveWaitUntil` capability,
559 * or you've dynamically registered for the `textDocument/willSaveWaitUntil`
560 * method.
561 *
562 * @param handler The corresponding handler.
563 */
564 onWillSaveTextDocumentWaitUntil(handler: RequestHandler<WillSaveTextDocumentParams, TextEdit[] | undefined | null, void>): Disposable;
565 /**
566 * Installs a handler for the `DidSaveTextDocument` notification.
567 *
568 * @param handler The corresponding handler.
569 */
570 onDidSaveTextDocument(handler: NotificationHandler<DidSaveTextDocumentParams>): Disposable;
571 /**
572 * Sends diagnostics computed for a given document to VSCode to render them in the
573 * user interface.
574 *
575 * @param params The diagnostic parameters.
576 */
577 sendDiagnostics(params: PublishDiagnosticsParams): Promise<void>;
578 /**
579 * Installs a handler for the `Hover` request.
580 *
581 * @param handler The corresponding handler.
582 */
583 onHover(handler: ServerRequestHandler<HoverParams, Hover | undefined | null, never, void>): Disposable;
584 /**
585 * Installs a handler for the `Completion` request.
586 *
587 * @param handler The corresponding handler.
588 */
589 onCompletion(handler: ServerRequestHandler<CompletionParams, CompletionItem[] | CompletionList | undefined | null, CompletionItem[], void>): Disposable;
590 /**
591 * Installs a handler for the `CompletionResolve` request.
592 *
593 * @param handler The corresponding handler.
594 */
595 onCompletionResolve(handler: RequestHandler<CompletionItem, CompletionItem, void>): Disposable;
596 /**
597 * Installs a handler for the `SignatureHelp` request.
598 *
599 * @param handler The corresponding handler.
600 */
601 onSignatureHelp(handler: ServerRequestHandler<SignatureHelpParams, SignatureHelp | undefined | null, never, void>): Disposable;
602 /**
603 * Installs a handler for the `Declaration` request.
604 *
605 * @param handler The corresponding handler.
606 */
607 onDeclaration(handler: ServerRequestHandler<DeclarationParams, Declaration | DeclarationLink[] | undefined | null, Location[] | DeclarationLink[], void>): Disposable;
608 /**
609 * Installs a handler for the `Definition` request.
610 *
611 * @param handler The corresponding handler.
612 */
613 onDefinition(handler: ServerRequestHandler<DefinitionParams, Definition | DefinitionLink[] | undefined | null, Location[] | DefinitionLink[], void>): Disposable;
614 /**
615 * Installs a handler for the `Type Definition` request.
616 *
617 * @param handler The corresponding handler.
618 */
619 onTypeDefinition(handler: ServerRequestHandler<TypeDefinitionParams, Definition | DefinitionLink[] | undefined | null, Location[] | DefinitionLink[], void>): Disposable;
620 /**
621 * Installs a handler for the `Implementation` request.
622 *
623 * @param handler The corresponding handler.
624 */
625 onImplementation(handler: ServerRequestHandler<ImplementationParams, Definition | DefinitionLink[] | undefined | null, Location[] | DefinitionLink[], void>): Disposable;
626 /**
627 * Installs a handler for the `References` request.
628 *
629 * @param handler The corresponding handler.
630 */
631 onReferences(handler: ServerRequestHandler<ReferenceParams, Location[] | undefined | null, Location[], void>): Disposable;
632 /**
633 * Installs a handler for the `DocumentHighlight` request.
634 *
635 * @param handler The corresponding handler.
636 */
637 onDocumentHighlight(handler: ServerRequestHandler<DocumentHighlightParams, DocumentHighlight[] | undefined | null, DocumentHighlight[], void>): Disposable;
638 /**
639 * Installs a handler for the `DocumentSymbol` request.
640 *
641 * @param handler The corresponding handler.
642 */
643 onDocumentSymbol(handler: ServerRequestHandler<DocumentSymbolParams, SymbolInformation[] | DocumentSymbol[] | undefined | null, SymbolInformation[] | DocumentSymbol[], void>): Disposable;
644 /**
645 * Installs a handler for the `WorkspaceSymbol` request.
646 *
647 * @param handler The corresponding handler.
648 */
649 onWorkspaceSymbol(handler: ServerRequestHandler<WorkspaceSymbolParams, SymbolInformation[] | WorkspaceSymbol[] | undefined | null, SymbolInformation[], void>): Disposable;
650 /**
651 * Installs a handler for the `WorkspaceSymbol` request.
652 *
653 * @param handler The corresponding handler.
654 */
655 onWorkspaceSymbolResolve(handler: RequestHandler<WorkspaceSymbol, WorkspaceSymbol, void>): Disposable;
656 /**
657 * Installs a handler for the `CodeAction` request.
658 *
659 * @param handler The corresponding handler.
660 */
661 onCodeAction(handler: ServerRequestHandler<CodeActionParams, (Command | CodeAction)[] | undefined | null, (Command | CodeAction)[], void>): Disposable;
662 /**
663 * Installs a handler for the `CodeAction` resolve request.
664 *
665 * @param handler The corresponding handler.
666 */
667 onCodeActionResolve(handler: RequestHandler<CodeAction, CodeAction, void>): Disposable;
668 /**
669 * Compute a list of {@link CodeLens lenses}. This call should return as fast as possible and if
670 * computing the commands is expensive implementers should only return code lens objects with the
671 * range set and handle the resolve request.
672 *
673 * @param handler The corresponding handler.
674 */
675 onCodeLens(handler: ServerRequestHandler<CodeLensParams, CodeLens[] | undefined | null, CodeLens[], void>): Disposable;
676 /**
677 * This function will be called for each visible code lens, usually when scrolling and after
678 * the onCodeLens has been called.
679 *
680 * @param handler The corresponding handler.
681 */
682 onCodeLensResolve(handler: RequestHandler<CodeLens, CodeLens, void>): Disposable;
683 /**
684 * Installs a handler for the document formatting request.
685 *
686 * @param handler The corresponding handler.
687 */
688 onDocumentFormatting(handler: ServerRequestHandler<DocumentFormattingParams, TextEdit[] | undefined | null, never, void>): Disposable;
689 /**
690 * Installs a handler for the document range formatting request.
691 *
692 * @param handler The corresponding handler.
693 */
694 onDocumentRangeFormatting(handler: ServerRequestHandler<DocumentRangeFormattingParams, TextEdit[] | undefined | null, never, void>): Disposable;
695 /**
696 * Installs a handler for the document on type formatting request.
697 *
698 * @param handler The corresponding handler.
699 */
700 onDocumentOnTypeFormatting(handler: RequestHandler<DocumentOnTypeFormattingParams, TextEdit[] | undefined | null, void>): Disposable;
701 /**
702 * Installs a handler for the rename request.
703 *
704 * @param handler The corresponding handler.
705 */
706 onRenameRequest(handler: ServerRequestHandler<RenameParams, WorkspaceEdit | undefined | null, never, void>): Disposable;
707 /**
708 * Installs a handler for the prepare rename request.
709 *
710 * @param handler The corresponding handler.
711 */
712 onPrepareRename(handler: RequestHandler<PrepareRenameParams, Range | {
713 range: Range;
714 placeholder: string;
715 } | {
716 defaultBehavior: boolean;
717 } | undefined | null, void>): Disposable;
718 /**
719 * Installs a handler for the document links request.
720 *
721 * @param handler The corresponding handler.
722 */
723 onDocumentLinks(handler: ServerRequestHandler<DocumentLinkParams, DocumentLink[] | undefined | null, DocumentLink[], void>): Disposable;
724 /**
725 * Installs a handler for the document links resolve request.
726 *
727 * @param handler The corresponding handler.
728 */
729 onDocumentLinkResolve(handler: RequestHandler<DocumentLink, DocumentLink | undefined | null, void>): Disposable;
730 /**
731 * Installs a handler for the document color request.
732 *
733 * @param handler The corresponding handler.
734 */
735 onDocumentColor(handler: ServerRequestHandler<DocumentColorParams, ColorInformation[] | undefined | null, ColorInformation[], void>): Disposable;
736 /**
737 * Installs a handler for the document color request.
738 *
739 * @param handler The corresponding handler.
740 */
741 onColorPresentation(handler: ServerRequestHandler<ColorPresentationParams, ColorPresentation[] | undefined | null, ColorPresentation[], void>): Disposable;
742 /**
743 * Installs a handler for the folding ranges request.
744 *
745 * @param handler The corresponding handler.
746 */
747 onFoldingRanges(handler: ServerRequestHandler<FoldingRangeParams, FoldingRange[] | undefined | null, FoldingRange[], void>): Disposable;
748 /**
749 * Installs a handler for the selection ranges request.
750 *
751 * @param handler The corresponding handler.
752 */
753 onSelectionRanges(handler: ServerRequestHandler<SelectionRangeParams, SelectionRange[] | undefined | null, SelectionRange[], void>): Disposable;
754 /**
755 * Installs a handler for the execute command request.
756 *
757 * @param handler The corresponding handler.
758 */
759 onExecuteCommand(handler: ServerRequestHandler<ExecuteCommandParams, any | undefined | null, never, void>): Disposable;
760 /**
761 * Disposes the connection
762 */
763 dispose(): void;
764}
765export interface Connection extends _Connection {
766}
767export interface Feature<B extends FeatureBase, P> {
768 (Base: new () => B): new () => B & P;
769}
770export type ConsoleFeature<P> = Feature<RemoteConsole, P>;
771export declare function combineConsoleFeatures<O, T>(one: ConsoleFeature<O>, two: ConsoleFeature<T>): ConsoleFeature<O & T>;
772export type TelemetryFeature<P> = Feature<Telemetry, P>;
773export declare function combineTelemetryFeatures<O, T>(one: TelemetryFeature<O>, two: TelemetryFeature<T>): TelemetryFeature<O & T>;
774export type TracerFeature<P> = Feature<RemoteTracer, P>;
775export declare function combineTracerFeatures<O, T>(one: TracerFeature<O>, two: TracerFeature<T>): TracerFeature<O & T>;
776export type ClientFeature<P> = Feature<RemoteClient, P>;
777export declare function combineClientFeatures<O, T>(one: ClientFeature<O>, two: ClientFeature<T>): ClientFeature<O & T>;
778export type WindowFeature<P> = Feature<_RemoteWindow, P>;
779export declare function combineWindowFeatures<O, T>(one: WindowFeature<O>, two: WindowFeature<T>): WindowFeature<O & T>;
780export type WorkspaceFeature<P> = Feature<_RemoteWorkspace, P>;
781export declare function combineWorkspaceFeatures<O, T>(one: WorkspaceFeature<O>, two: WorkspaceFeature<T>): WorkspaceFeature<O & T>;
782export type LanguagesFeature<P> = Feature<_Languages, P>;
783export declare function combineLanguagesFeatures<O, T>(one: LanguagesFeature<O>, two: LanguagesFeature<T>): LanguagesFeature<O & T>;
784export type NotebooksFeature<P> = Feature<_Notebooks, P>;
785export declare function combineNotebooksFeatures<O, T>(one: NotebooksFeature<O>, two: NotebooksFeature<T>): NotebooksFeature<O & T>;
786export interface Features<PConsole = _, PTracer = _, PTelemetry = _, PClient = _, PWindow = _, PWorkspace = _, PLanguages = _, PNotebooks = _> {
787 __brand: 'features';
788 console?: ConsoleFeature<PConsole>;
789 tracer?: TracerFeature<PTracer>;
790 telemetry?: TelemetryFeature<PTelemetry>;
791 client?: ClientFeature<PClient>;
792 window?: WindowFeature<PWindow>;
793 workspace?: WorkspaceFeature<PWorkspace>;
794 languages?: LanguagesFeature<PLanguages>;
795 notebooks?: NotebooksFeature<PNotebooks>;
796}
797export declare function combineFeatures<OConsole, OTracer, OTelemetry, OClient, OWindow, OWorkspace, OLanguages, ONotebooks, TConsole, TTracer, TTelemetry, TClient, TWindow, TWorkspace, TLanguages, TNotebooks>(one: Features<OConsole, OTracer, OTelemetry, OClient, OWindow, OWorkspace, OLanguages, ONotebooks>, two: Features<TConsole, TTracer, TTelemetry, TClient, TWindow, TWorkspace, TLanguages, TNotebooks>): Features<OConsole & TConsole, OTracer & TTracer, OTelemetry & TTelemetry, OClient & TClient, OWindow & TWindow, OWorkspace & TWorkspace, OLanguages & TLanguages, ONotebooks & TNotebooks>;
798export interface WatchDog {
799 shutdownReceived: boolean;
800 initialize(params: InitializeParams): void;
801 exit(code: number): void;
802}
803export declare function createConnection<PConsole = _, PTracer = _, PTelemetry = _, PClient = _, PWindow = _, PWorkspace = _, PLanguages = _, PNotebooks = _>(connectionFactory: (logger: Logger) => ProtocolConnection, watchDog: WatchDog, factories?: Features<PConsole, PTracer, PTelemetry, PClient, PWindow, PWorkspace, PLanguages, PNotebooks>): _Connection<PConsole, PTracer, PTelemetry, PClient, PWindow, PWorkspace, PLanguages, PNotebooks>;
804export {};