Skip to content

Commit 3bf1509

Browse files
committed
Shim workspace/configuration to support new YAML server version
1 parent 478739f commit 3bf1509

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

packages/jupyterlab-lsp/src/connection.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ export namespace Method {
5454
export enum ServerRequest {
5555
REGISTER_CAPABILITY = 'client/registerCapability',
5656
SHOW_MESSAGE_REQUEST = 'window/showMessageRequest',
57-
UNREGISTER_CAPABILITY = 'client/unregisterCapability'
57+
UNREGISTER_CAPABILITY = 'client/unregisterCapability',
58+
WORKSPACE_CONFIGURATION = 'workspace/configuration'
5859
}
5960

6061
/** Client requests */
@@ -95,12 +96,14 @@ export interface IServerRequestParams {
9596
[Method.ServerRequest.REGISTER_CAPABILITY]: lsp.RegistrationParams;
9697
[Method.ServerRequest.SHOW_MESSAGE_REQUEST]: lsp.ShowMessageRequestParams;
9798
[Method.ServerRequest.UNREGISTER_CAPABILITY]: lsp.UnregistrationParams;
99+
[Method.ServerRequest.WORKSPACE_CONFIGURATION]: lsp.ConfigurationParams;
98100
}
99101

100102
export interface IServerResult {
101103
[Method.ServerRequest.REGISTER_CAPABILITY]: void;
102104
[Method.ServerRequest.SHOW_MESSAGE_REQUEST]: lsp.MessageActionItem | null;
103105
[Method.ServerRequest.UNREGISTER_CAPABILITY]: void;
106+
[Method.ServerRequest.WORKSPACE_CONFIGURATION]: any[];
104107
}
105108

106109
export interface IClientRequestParams {
@@ -464,6 +467,17 @@ export class LSPConnection extends LspWsConnection {
464467
);
465468
}
466469
);
470+
471+
this.serverRequests['workspace/configuration'].setHandler(async params => {
472+
return params.items.map(item => {
473+
// LSP: "If the client can’t provide a configuration setting for a given scope
474+
// then `null` needs to be present in the returned array."
475+
476+
// for now we do not support configuration, but yaml server does not respect
477+
// client capability so we have a handler just for that
478+
return null;
479+
});
480+
});
467481
}
468482

469483
public sendSelectiveChange(

0 commit comments

Comments
 (0)