1 import { 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, TextDocumentContentChangeEvent, TextDocumentSaveReason, Event, MessageSignature, ApplyWorkspaceEditParams, ApplyWorkspaceEditResponse, WorkDoneProgressParams, PartialResultParams, RegistrationType, RequestType0, RequestType, NotificationType0, NotificationType } from 'vscode-languageserver-protocol';
2 import { WorkDoneProgressReporter, ResultProgressReporter, WindowProgress } from './progress';
3 import { Configuration } from './configuration';
4 import { WorkspaceFolders } from './workspaceFolders';
5 import { CallHierarchy } from './callHierarchy';
6 import { SemanticTokensFeatureShape } from './semanticTokens';
7 import { ShowDocumentFeatureShape } from './showDocument';
8 import { FileOperationsFeatureShape } from './fileOperations';
9 import { LinkedEditingRangeFeatureShape } from './linkedEditingRange';
10 import { MonikerFeatureShape } from './moniker';
11 export interface TextDocumentsConfiguration<T> {
12 create(uri: string, languageId: string, version: number, content: string): T;
13 update(document: T, changes: TextDocumentContentChangeEvent[], version: number): T;
16 * Event to signal changes to a text document.
18 export interface TextDocumentChangeEvent<T> {
20 * The document that has changed.
25 * Event to signal that a document will be saved.
27 export interface TextDocumentWillSaveEvent<T> {
29 * The document that will be saved
33 * The reason why save was triggered.
35 reason: TextDocumentSaveReason;
38 * A manager for simple text documents
40 export declare class TextDocuments<T> {
41 private _configuration;
43 private _onDidChangeContent;
48 private _willSaveWaitUntil;
50 * Create a new text document manager.
52 constructor(configuration: TextDocumentsConfiguration<T>);
54 * An event that fires when a text document managed by this manager
55 * has been opened or the content changes.
57 get onDidChangeContent(): Event<TextDocumentChangeEvent<T>>;
59 * An event that fires when a text document managed by this manager
62 get onDidOpen(): Event<TextDocumentChangeEvent<T>>;
64 * An event that fires when a text document managed by this manager
67 get onWillSave(): Event<TextDocumentWillSaveEvent<T>>;
69 * Sets a handler that will be called if a participant wants to provide
70 * edits during a text document save.
72 onWillSaveWaitUntil(handler: RequestHandler<TextDocumentWillSaveEvent<T>, TextEdit[], void>): void;
74 * An event that fires when a text document managed by this manager
77 get onDidSave(): Event<TextDocumentChangeEvent<T>>;
79 * An event that fires when a text document managed by this manager
82 get onDidClose(): Event<TextDocumentChangeEvent<T>>;
84 * Returns the document for the given URI. Returns undefined if
85 * the document is not managed by this instance.
87 * @param uri The text document's URI to retrieve.
88 * @return the text document or `undefined`.
90 get(uri: string): T | undefined;
92 * Returns all text documents managed by this instance.
94 * @return all text documents.
98 * Returns the URIs of all text documents managed by this instance.
100 * @return the URI's of all text documents.
104 * Listens for `low level` notification on the given connection to
105 * update the text documents managed by this instance.
107 * Please note that the connection only provides handlers not an event model. Therefore
108 * listening on a connection will overwrite the following handlers on a connection:
109 * `onDidOpenTextDocument`, `onDidChangeTextDocument`, `onDidCloseTextDocument`,
110 * `onWillSaveTextDocument`, `onWillSaveTextDocumentWaitUntil` and `onDidSaveTextDocument`.
112 * Use the corresponding events on the TextDocuments instance instead.
114 * @param connection The connection to listen on.
116 listen(connection: Connection): void;
119 * Helps tracking error message. Equal occurrences of the same
120 * message are only stored once. This class is for example
121 * useful if text documents are validated in a loop and equal
122 * error message should be folded into one.
124 export declare class ErrorMessageTracker {
128 * Add a message to the tracker.
130 * @param message The message to add.
132 add(message: string): void;
134 * Send all tracked messages to the connection's window.
136 * @param connection The connection established between client and server.
138 sendErrors(connection: {
139 window: RemoteWindow;
147 * Attach the remote to the given connection.
149 * @param connection The connection this remote is operating on.
151 attach(connection: Connection): void;
153 * The connection this remote is attached to.
155 connection: Connection;
157 * Called to initialize the remote with the given
158 * client capabilities
160 * @param capabilities The client capabilities
162 initialize(capabilities: ClientCapabilities): void;
164 * Called to fill in the server capabilities this feature implements.
166 * @param capabilities The server capabilities to fill.
168 fillServerCapabilities(capabilities: ServerCapabilities): void;
171 * The RemoteConsole interface contains all functions to interact with
172 * the tools / clients console or log system. Internally it used `window/logMessage`
175 export interface RemoteConsole {
177 * The connection this remote is attached to.
179 connection: Connection;
181 * Show an error message.
183 * @param message The message to show.
185 error(message: string): void;
187 * Show a warning message.
189 * @param message The message to show.
191 warn(message: string): void;
193 * Show an information message.
195 * @param message The message to show.
197 info(message: string): void;
201 * @param message The message to log.
203 log(message: string): void;
206 * The RemoteWindow interface contains all functions to interact with
207 * the visual window of VS Code.
209 export interface _RemoteWindow {
211 * The connection this remote is attached to.
213 connection: Connection;
215 * Shows an error message in the client's user interface. Depending on the client this might
216 * be a modal dialog with a confirmation button or a notification in a notification center
218 * @param message The message to show.
219 * @param actions Possible additional actions presented in the user interface. The selected action
220 * will be the value of the resolved promise
222 showErrorMessage(message: string): void;
223 showErrorMessage<T extends MessageActionItem>(message: string, ...actions: T[]): Promise<T | undefined>;
225 * Shows a warning message in the client's user interface. Depending on the client this might
226 * be a modal dialog with a confirmation button or a notification in a notification center
228 * @param message The message to show.
229 * @param actions Possible additional actions presented in the user interface. The selected action
230 * will be the value of the resolved promise
232 showWarningMessage(message: string): void;
233 showWarningMessage<T extends MessageActionItem>(message: string, ...actions: T[]): Promise<T | undefined>;
235 * Shows an information message in the client's user interface. Depending on the client this might
236 * be a modal dialog with a confirmation button or a notification in a notification center
238 * @param message The message to show.
239 * @param actions Possible additional actions presented in the user interface. The selected action
240 * will be the value of the resolved promise
242 showInformationMessage(message: string): void;
243 showInformationMessage<T extends MessageActionItem>(message: string, ...actions: T[]): Promise<T | undefined>;
245 export declare type RemoteWindow = _RemoteWindow & WindowProgress & ShowDocumentFeatureShape;
247 * A bulk registration manages n single registration to be able to register
248 * for n notifications or requests using one register request.
250 export interface BulkRegistration {
252 * Adds a single registration.
253 * @param type the notification type to register for.
254 * @param registerParams special registration parameters.
256 add<RO>(type: ProtocolNotificationType0<RO>, registerParams: RO): void;
257 add<P, RO>(type: ProtocolNotificationType<P, RO>, registerParams: RO): void;
259 * Adds a single registration.
260 * @param type the request type to register for.
261 * @param registerParams special registration parameters.
263 add<R, PR, E, RO>(type: ProtocolRequestType0<R, PR, E, RO>, registerParams: RO): void;
264 add<P, PR, R, E, RO>(type: ProtocolRequestType<P, PR, R, E, RO>, registerParams: RO): void;
266 * Adds a single registration.
267 * @param type the notification type to register for.
268 * @param registerParams special registration parameters.
270 add<RO>(type: RegistrationType<RO>, registerParams: RO): void;
272 export declare namespace BulkRegistration {
274 * Creates a new bulk registration.
275 * @return an empty bulk registration.
277 function create(): BulkRegistration;
280 * A `BulkUnregistration` manages n unregistrations.
282 export interface BulkUnregistration extends Disposable {
284 * Disposes a single registration. It will be removed from the
285 * `BulkUnregistration`.
287 disposeSingle(arg: string | MessageSignature): boolean;
289 export declare namespace BulkUnregistration {
290 function create(): BulkUnregistration;
293 * Interface to register and unregister `listeners` on the client / tools side.
295 export interface RemoteClient {
297 * The connection this remote is attached to.
299 connection: Connection;
301 * Registers a listener for the given request.
303 * @param type the request type to register for.
304 * @param registerParams special registration parameters.
305 * @return a `Disposable` to unregister the listener again.
307 register<P, RO>(type: ProtocolNotificationType<P, RO>, registerParams?: RO): Promise<Disposable>;
308 register<RO>(type: ProtocolNotificationType0<RO>, registerParams?: RO): Promise<Disposable>;
310 * Registers a listener for the given request.
312 * @param unregisteration the unregistration to add a corresponding unregister action to.
313 * @param type the request type to register for.
314 * @param registerParams special registration parameters.
315 * @return the updated unregistration.
317 register<P, RO>(unregisteration: BulkUnregistration, type: ProtocolNotificationType<P, RO>, registerParams?: RO): Promise<Disposable>;
318 register<RO>(unregisteration: BulkUnregistration, type: ProtocolNotificationType0<RO>, registerParams?: RO): Promise<Disposable>;
320 * Registers a listener for the given request.
322 * @param type the request type to register for.
323 * @param registerParams special registration parameters.
324 * @return a `Disposable` to unregister the listener again.
326 register<P, R, PR, E, RO>(type: ProtocolRequestType<P, R, PR, E, RO>, registerParams?: RO): Promise<Disposable>;
327 register<R, PR, E, RO>(type: ProtocolRequestType0<R, PR, E, RO>, registerParams?: RO): Promise<Disposable>;
329 * Registers a listener for the given request.
331 * @param unregisteration the unregistration to add a corresponding unregister action to.
332 * @param type the request type to register for.
333 * @param registerParams special registration parameters.
334 * @return the updated unregistration.
336 register<P, R, PR, E, RO>(unregisteration: BulkUnregistration, type: ProtocolRequestType<P, R, PR, E, RO>, registerParams?: RO): Promise<Disposable>;
337 register<R, PR, E, RO>(unregisteration: BulkUnregistration, type: ProtocolRequestType0<R, PR, E, RO>, registerParams?: RO): Promise<Disposable>;
339 * Registers a listener for the given registration type.
341 * @param type the registration type.
342 * @param registerParams special registration parameters.
343 * @return a `Disposable` to unregister the listener again.
345 register<RO>(type: RegistrationType<RO>, registerParams?: RO): Promise<Disposable>;
347 * Registers a listener for the given registration type.
349 * @param unregisteration the unregistration to add a corresponding unregister action to.
350 * @param type the registration type.
351 * @param registerParams special registration parameters.
352 * @return the updated unregistration.
354 register<RO>(unregisteration: BulkUnregistration, type: RegistrationType<RO>, registerParams?: RO): Promise<Disposable>;
356 * Registers a set of listeners.
357 * @param registrations the bulk registration
358 * @return a `Disposable` to unregister the listeners again.
360 register(registrations: BulkRegistration): Promise<BulkUnregistration>;
363 * Represents the workspace managed by the client.
365 export interface _RemoteWorkspace {
367 * The connection this remote is attached to.
369 connection: Connection;
371 * Applies a `WorkspaceEdit` to the workspace
372 * @param param the workspace edit params.
373 * @return a thenable that resolves to the `ApplyWorkspaceEditResponse`.
375 applyEdit(paramOrEdit: ApplyWorkspaceEditParams | WorkspaceEdit): Promise<ApplyWorkspaceEditResponse>;
377 export declare type RemoteWorkspace = _RemoteWorkspace & Configuration & WorkspaceFolders & FileOperationsFeatureShape;
379 * Interface to log telemetry events. The events are actually send to the client
380 * and the client needs to feed the event into a proper telemetry system.
382 export interface Telemetry {
384 * The connection this remote is attached to.
386 connection: Connection;
388 * Log the given data to telemetry.
390 * @param data The data to log. Must be a JSON serializable object.
392 logEvent(data: any): void;
395 * Interface to log traces to the client. The events are sent to the client and the
396 * client needs to log the trace events.
398 export interface RemoteTracer {
400 * The connection this remote is attached to.
402 connection: Connection;
404 * Log the given data to the trace Log
406 log(message: string, verbose?: string): void;
408 export interface _Languages {
409 connection: Connection;
410 attachWorkDoneProgress(params: WorkDoneProgressParams): WorkDoneProgressReporter;
411 attachPartialResultProgress<PR>(type: ProgressType<PR>, params: PartialResultParams): ResultProgressReporter<PR> | undefined;
413 export declare class _LanguagesImpl implements Remote, _Languages {
416 attach(connection: Connection): void;
417 get connection(): Connection;
418 initialize(_capabilities: ClientCapabilities): void;
419 fillServerCapabilities(_capabilities: ServerCapabilities): void;
420 attachWorkDoneProgress(params: WorkDoneProgressParams): WorkDoneProgressReporter;
421 attachPartialResultProgress<PR>(_type: ProgressType<PR>, params: PartialResultParams): ResultProgressReporter<PR> | undefined;
423 export declare type Languages = _Languages & CallHierarchy & SemanticTokensFeatureShape & LinkedEditingRangeFeatureShape & MonikerFeatureShape;
425 * An empty interface for new proposed API.
429 export interface ServerRequestHandler<P, R, PR, E> {
430 (params: P, token: CancellationToken, workDoneProgress: WorkDoneProgressReporter, resultProgress?: ResultProgressReporter<PR>): HandlerResult<R, E>;
433 * Interface to describe the shape of the server connection.
435 export interface _Connection<PConsole = _, PTracer = _, PTelemetry = _, PClient = _, PWindow = _, PWorkspace = _, PLanguages = _> {
437 * Start listening on the input stream for messages to process.
441 * Installs a request handler described by the given [RequestType](#RequestType).
443 * @param type The [RequestType](#RequestType) describing the request.
444 * @param handler The handler to install
446 onRequest<R, PR, E, RO>(type: ProtocolRequestType0<R, PR, E, RO>, handler: RequestHandler0<R, E>): void;
447 onRequest<P, R, PR, E, RO>(type: ProtocolRequestType<P, R, PR, E, RO>, handler: RequestHandler<P, R, E>): void;
448 onRequest<R, PR, E, RO>(type: RequestType0<R, E>, handler: RequestHandler0<R, E>): void;
449 onRequest<P, R, E>(type: RequestType<P, R, E>, handler: RequestHandler<P, R, E>): void;
451 * Installs a request handler for the given method.
453 * @param method The method to register a request handler for.
454 * @param handler The handler to install.
456 onRequest<R, E>(method: string, handler: GenericRequestHandler<R, E>): void;
458 * Installs a request handler that is invoked if no specific request handler can be found.
460 * @param handler a handler that handles all requests.
462 onRequest(handler: StarRequestHandler): void;
464 * Send a request to the client.
466 * @param type The [RequestType](#RequestType) describing the request.
467 * @param params The request's parameters.
469 sendRequest<R, PR, E, RO>(type: ProtocolRequestType0<R, PR, E, RO>, token?: CancellationToken): Promise<R>;
470 sendRequest<P, R, PR, E, RO>(type: ProtocolRequestType<P, R, PR, E, RO>, params: P, token?: CancellationToken): Promise<R>;
471 sendRequest<R, E>(type: RequestType0<R, E>, token?: CancellationToken): Promise<R>;
472 sendRequest<P, R, E>(type: RequestType<P, R, E>, params: P, token?: CancellationToken): Promise<R>;
474 * Send a request to the client.
476 * @param method The method to invoke on the client.
477 * @param params The request's parameters.
479 sendRequest<R>(method: string, token?: CancellationToken): Promise<R>;
480 sendRequest<R>(method: string, params: any, token?: CancellationToken): Promise<R>;
482 * Installs a notification handler described by the given [NotificationType](#NotificationType).
484 * @param type The [NotificationType](#NotificationType) describing the notification.
485 * @param handler The handler to install.
487 onNotification<RO>(type: ProtocolNotificationType0<RO>, handler: NotificationHandler0): void;
488 onNotification<P, RO>(type: ProtocolNotificationType<P, RO>, handler: NotificationHandler<P>): void;
489 onNotification(type: NotificationType0, handler: NotificationHandler0): void;
490 onNotification<P>(type: NotificationType<P>, handler: NotificationHandler<P>): void;
492 * Installs a notification handler for the given method.
494 * @param method The method to register a request handler for.
495 * @param handler The handler to install.
497 onNotification(method: string, handler: GenericNotificationHandler): void;
499 * Installs a notification handler that is invoked if no specific notification handler can be found.
501 * @param handler a handler that handles all notifications.
503 onNotification(handler: StarNotificationHandler): void;
505 * Send a notification to the client.
507 * @param type The [NotificationType](#NotificationType) describing the notification.
508 * @param params The notification's parameters.
510 sendNotification<RO>(type: ProtocolNotificationType0<RO>): void;
511 sendNotification<P, RO>(type: ProtocolNotificationType<P, RO>, params: P): void;
512 sendNotification(type: NotificationType0): void;
513 sendNotification<P>(type: NotificationType<P>, params: P): void;
515 * Send a notification to the client.
517 * @param method The method to invoke on the client.
518 * @param params The notification's parameters.
520 sendNotification(method: string, params?: any): void;
522 * Installs a progress handler for a given token.
523 * @param type the progress type
524 * @param token the token
525 * @param handler the handler
527 onProgress<P>(type: ProgressType<P>, token: string | number, handler: NotificationHandler<P>): Disposable;
530 * @param type the progress type
531 * @param token the token to use
532 * @param value the progress value
534 sendProgress<P>(type: ProgressType<P>, token: string | number, value: P): void;
536 * Installs a handler for the initialize request.
538 * @param handler The initialize handler.
540 onInitialize(handler: ServerRequestHandler<InitializeParams, InitializeResult, never, InitializeError>): void;
542 * Installs a handler for the initialized notification.
544 * @param handler The initialized handler.
546 onInitialized(handler: NotificationHandler<InitializedParams>): void;
548 * Installs a handler for the shutdown request.
550 * @param handler The initialize handler.
552 onShutdown(handler: RequestHandler0<void, void>): void;
554 * Installs a handler for the exit notification.
556 * @param handler The exit handler.
558 onExit(handler: NotificationHandler0): void;
560 * A property to provide access to console specific features.
562 console: RemoteConsole & PConsole;
564 * A property to provide access to tracer specific features.
566 tracer: RemoteTracer & PTracer;
568 * A property to provide access to telemetry specific features.
570 telemetry: Telemetry & PTelemetry;
572 * A property to provide access to client specific features like registering
573 * for requests or notifications.
575 client: RemoteClient & PClient;
577 * A property to provide access to windows specific features.
579 window: RemoteWindow & PWindow;
581 * A property to provide access to workspace specific features.
583 workspace: RemoteWorkspace & PWorkspace;
585 * A property to provide access to language specific features.
587 languages: Languages & PLanguages;
589 * Installs a handler for the `DidChangeConfiguration` notification.
591 * @param handler The corresponding handler.
593 onDidChangeConfiguration(handler: NotificationHandler<DidChangeConfigurationParams>): void;
595 * Installs a handler for the `DidChangeWatchedFiles` notification.
597 * @param handler The corresponding handler.
599 onDidChangeWatchedFiles(handler: NotificationHandler<DidChangeWatchedFilesParams>): void;
601 * Installs a handler for the `DidOpenTextDocument` notification.
603 * @param handler The corresponding handler.
605 onDidOpenTextDocument(handler: NotificationHandler<DidOpenTextDocumentParams>): void;
607 * Installs a handler for the `DidChangeTextDocument` notification.
609 * @param handler The corresponding handler.
611 onDidChangeTextDocument(handler: NotificationHandler<DidChangeTextDocumentParams>): void;
613 * Installs a handler for the `DidCloseTextDocument` notification.
615 * @param handler The corresponding handler.
617 onDidCloseTextDocument(handler: NotificationHandler<DidCloseTextDocumentParams>): void;
619 * Installs a handler for the `WillSaveTextDocument` notification.
621 * Note that this notification is opt-in. The client will not send it unless
622 * your server has the `textDocumentSync.willSave` capability or you've
623 * dynamically registered for the `textDocument/willSave` method.
625 * @param handler The corresponding handler.
627 onWillSaveTextDocument(handler: NotificationHandler<WillSaveTextDocumentParams>): void;
629 * Installs a handler for the `WillSaveTextDocumentWaitUntil` request.
631 * Note that this request is opt-in. The client will not send it unless
632 * your server has the `textDocumentSync.willSaveWaitUntil` capability,
633 * or you've dynamically registered for the `textDocument/willSaveWaitUntil`
636 * @param handler The corresponding handler.
638 onWillSaveTextDocumentWaitUntil(handler: RequestHandler<WillSaveTextDocumentParams, TextEdit[] | undefined | null, void>): void;
640 * Installs a handler for the `DidSaveTextDocument` notification.
642 * @param handler The corresponding handler.
644 onDidSaveTextDocument(handler: NotificationHandler<DidSaveTextDocumentParams>): void;
646 * Sends diagnostics computed for a given document to VSCode to render them in the
649 * @param params The diagnostic parameters.
651 sendDiagnostics(params: PublishDiagnosticsParams): void;
653 * Installs a handler for the `Hover` request.
655 * @param handler The corresponding handler.
657 onHover(handler: ServerRequestHandler<HoverParams, Hover | undefined | null, never, void>): void;
659 * Installs a handler for the `Completion` request.
661 * @param handler The corresponding handler.
663 onCompletion(handler: ServerRequestHandler<CompletionParams, CompletionItem[] | CompletionList | undefined | null, CompletionItem[], void>): void;
665 * Installs a handler for the `CompletionResolve` request.
667 * @param handler The corresponding handler.
669 onCompletionResolve(handler: RequestHandler<CompletionItem, CompletionItem, void>): void;
671 * Installs a handler for the `SignatureHelp` request.
673 * @param handler The corresponding handler.
675 onSignatureHelp(handler: ServerRequestHandler<SignatureHelpParams, SignatureHelp | undefined | null, never, void>): void;
677 * Installs a handler for the `Declaration` request.
679 * @param handler The corresponding handler.
681 onDeclaration(handler: ServerRequestHandler<DeclarationParams, Declaration | DeclarationLink[] | undefined | null, Location[] | DeclarationLink[], void>): void;
683 * Installs a handler for the `Definition` request.
685 * @param handler The corresponding handler.
687 onDefinition(handler: ServerRequestHandler<DefinitionParams, Definition | DefinitionLink[] | undefined | null, Location[] | DefinitionLink[], void>): void;
689 * Installs a handler for the `Type Definition` request.
691 * @param handler The corresponding handler.
693 onTypeDefinition(handler: ServerRequestHandler<TypeDefinitionParams, Definition | DefinitionLink[] | undefined | null, Location[] | DefinitionLink[], void>): void;
695 * Installs a handler for the `Implementation` request.
697 * @param handler The corresponding handler.
699 onImplementation(handler: ServerRequestHandler<ImplementationParams, Definition | DefinitionLink[] | undefined | null, Location[] | DefinitionLink[], void>): void;
701 * Installs a handler for the `References` request.
703 * @param handler The corresponding handler.
705 onReferences(handler: ServerRequestHandler<ReferenceParams, Location[] | undefined | null, Location[], void>): void;
707 * Installs a handler for the `DocumentHighlight` request.
709 * @param handler The corresponding handler.
711 onDocumentHighlight(handler: ServerRequestHandler<DocumentHighlightParams, DocumentHighlight[] | undefined | null, DocumentHighlight[], void>): void;
713 * Installs a handler for the `DocumentSymbol` request.
715 * @param handler The corresponding handler.
717 onDocumentSymbol(handler: ServerRequestHandler<DocumentSymbolParams, SymbolInformation[] | DocumentSymbol[] | undefined | null, SymbolInformation[] | DocumentSymbol[], void>): void;
719 * Installs a handler for the `WorkspaceSymbol` request.
721 * @param handler The corresponding handler.
723 onWorkspaceSymbol(handler: ServerRequestHandler<WorkspaceSymbolParams, SymbolInformation[] | undefined | null, SymbolInformation[], void>): void;
725 * Installs a handler for the `CodeAction` request.
727 * @param handler The corresponding handler.
729 onCodeAction(handler: ServerRequestHandler<CodeActionParams, (Command | CodeAction)[] | undefined | null, (Command | CodeAction)[], void>): void;
731 * Installs a handler for the `CodeAction` resolve request.
733 * @param handler The corresponding handler.
735 onCodeActionResolve(handler: RequestHandler<CodeAction, CodeAction, void>): void;
737 * Compute a list of [lenses](#CodeLens). This call should return as fast as possible and if
738 * computing the commands is expensive implementers should only return code lens objects with the
739 * range set and handle the resolve request.
741 * @param handler The corresponding handler.
743 onCodeLens(handler: ServerRequestHandler<CodeLensParams, CodeLens[] | undefined | null, CodeLens[], void>): void;
745 * This function will be called for each visible code lens, usually when scrolling and after
746 * the onCodeLens has been called.
748 * @param handler The corresponding handler.
750 onCodeLensResolve(handler: RequestHandler<CodeLens, CodeLens, void>): void;
752 * Installs a handler for the document formatting request.
754 * @param handler The corresponding handler.
756 onDocumentFormatting(handler: ServerRequestHandler<DocumentFormattingParams, TextEdit[] | undefined | null, never, void>): void;
758 * Installs a handler for the document range formatting request.
760 * @param handler The corresponding handler.
762 onDocumentRangeFormatting(handler: ServerRequestHandler<DocumentRangeFormattingParams, TextEdit[] | undefined | null, never, void>): void;
764 * Installs a handler for the document on type formatting request.
766 * @param handler The corresponding handler.
768 onDocumentOnTypeFormatting(handler: RequestHandler<DocumentOnTypeFormattingParams, TextEdit[] | undefined | null, void>): void;
770 * Installs a handler for the rename request.
772 * @param handler The corresponding handler.
774 onRenameRequest(handler: ServerRequestHandler<RenameParams, WorkspaceEdit | undefined | null, never, void>): void;
776 * Installs a handler for the prepare rename request.
778 * @param handler The corresponding handler.
780 onPrepareRename(handler: RequestHandler<PrepareRenameParams, Range | {
783 } | undefined | null, void>): void;
785 * Installs a handler for the document links request.
787 * @param handler The corresponding handler.
789 onDocumentLinks(handler: ServerRequestHandler<DocumentLinkParams, DocumentLink[] | undefined | null, DocumentLink[], void>): void;
791 * Installs a handler for the document links resolve request.
793 * @param handler The corresponding handler.
795 onDocumentLinkResolve(handler: RequestHandler<DocumentLink, DocumentLink | undefined | null, void>): void;
797 * Installs a handler for the document color request.
799 * @param handler The corresponding handler.
801 onDocumentColor(handler: ServerRequestHandler<DocumentColorParams, ColorInformation[] | undefined | null, ColorInformation[], void>): void;
803 * Installs a handler for the document color request.
805 * @param handler The corresponding handler.
807 onColorPresentation(handler: ServerRequestHandler<ColorPresentationParams, ColorPresentation[] | undefined | null, ColorPresentation[], void>): void;
809 * Installs a handler for the folding ranges request.
811 * @param handler The corresponding handler.
813 onFoldingRanges(handler: ServerRequestHandler<FoldingRangeParams, FoldingRange[] | undefined | null, FoldingRange[], void>): void;
815 * Installs a handler for the selection ranges request.
817 * @param handler The corresponding handler.
819 onSelectionRanges(handler: ServerRequestHandler<SelectionRangeParams, SelectionRange[] | undefined | null, SelectionRange[], void>): void;
821 * Installs a handler for the execute command request.
823 * @param handler The corresponding handler.
825 onExecuteCommand(handler: ServerRequestHandler<ExecuteCommandParams, any | undefined | null, never, void>): void;
827 * Disposes the connection
831 export interface Connection extends _Connection {
833 export interface Feature<B, P> {
834 (Base: new () => B): new () => B & P;
836 export declare type ConsoleFeature<P> = Feature<RemoteConsole, P>;
837 export declare function combineConsoleFeatures<O, T>(one: ConsoleFeature<O>, two: ConsoleFeature<T>): ConsoleFeature<O & T>;
838 export declare type TelemetryFeature<P> = Feature<Telemetry, P>;
839 export declare function combineTelemetryFeatures<O, T>(one: TelemetryFeature<O>, two: TelemetryFeature<T>): TelemetryFeature<O & T>;
840 export declare type TracerFeature<P> = Feature<RemoteTracer, P>;
841 export declare function combineTracerFeatures<O, T>(one: TracerFeature<O>, two: TracerFeature<T>): TracerFeature<O & T>;
842 export declare type ClientFeature<P> = Feature<RemoteClient, P>;
843 export declare function combineClientFeatures<O, T>(one: ClientFeature<O>, two: ClientFeature<T>): ClientFeature<O & T>;
844 export declare type WindowFeature<P> = Feature<_RemoteWindow, P>;
845 export declare function combineWindowFeatures<O, T>(one: WindowFeature<O>, two: WindowFeature<T>): WindowFeature<O & T>;
846 export declare type WorkspaceFeature<P> = Feature<_RemoteWorkspace, P>;
847 export declare function combineWorkspaceFeatures<O, T>(one: WorkspaceFeature<O>, two: WorkspaceFeature<T>): WorkspaceFeature<O & T>;
848 export declare type LanguagesFeature<P> = Feature<_Languages, P>;
849 export declare function combineLanguagesFeatures<O, T>(one: LanguagesFeature<O>, two: LanguagesFeature<T>): LanguagesFeature<O & T>;
850 export interface Features<PConsole = _, PTracer = _, PTelemetry = _, PClient = _, PWindow = _, PWorkspace = _, PLanguages = _> {
852 console?: ConsoleFeature<PConsole>;
853 tracer?: TracerFeature<PTracer>;
854 telemetry?: TelemetryFeature<PTelemetry>;
855 client?: ClientFeature<PClient>;
856 window?: WindowFeature<PWindow>;
857 workspace?: WorkspaceFeature<PWorkspace>;
858 languages?: LanguagesFeature<PLanguages>;
860 export declare function combineFeatures<OConsole, OTracer, OTelemetry, OClient, OWindow, OWorkspace, TConsole, TTracer, TTelemetry, TClient, TWindow, TWorkspace>(one: Features<OConsole, OTracer, OTelemetry, OClient, OWindow, OWorkspace>, two: Features<TConsole, TTracer, TTelemetry, TClient, TWindow, TWorkspace>): Features<OConsole & TConsole, OTracer & TTracer, OTelemetry & TTelemetry, OClient & TClient, OWindow & TWindow, OWorkspace & TWorkspace>;
861 export interface WatchDog {
862 shutdownReceived: boolean;
863 initialize(params: InitializeParams): void;
864 exit(code: number): void;
866 export declare function createConnection<PConsole = _, PTracer = _, PTelemetry = _, PClient = _, PWindow = _, PWorkspace = _, PLanguages = _>(connectionFactory: (logger: Logger) => ProtocolConnection, watchDog: WatchDog, factories?: Features<PConsole, PTracer, PTelemetry, PClient, PWindow, PWorkspace, PLanguages>): _Connection<PConsole, PTracer, PTelemetry, PClient, PWindow, PWorkspace, PLanguages>;