Skip to content

Commit e0325cf

Browse files
author
Travis James Smith
committed
Add flow from the SettingRegistry to the individual web sockets
1 parent cc532fa commit e0325cf

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

packages/jupyterlab-lsp/src/connection.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from 'lsp-ws-connection';
1212
import { until_ready } from './utils';
1313

14-
interface ILSPOptions extends ILspOptions {}
14+
interface ILSPOptions extends ILspOptions { }
1515

1616
export class LSPConnection extends LspWsConnection {
1717
protected documentsToOpen: IDocumentInfo[];
@@ -30,7 +30,13 @@ export class LSPConnection extends LspWsConnection {
3030
}
3131

3232
protected onServerInitialized(params: lsProtocol.InitializeResult) {
33-
super.onServerInitialized(params);
33+
const settings = {
34+
"yaml.schemas": {
35+
"http://json.schemastore.org/composer": "/*"
36+
}
37+
}
38+
const initParams = { ...params, settings }
39+
super.onServerInitialized(initParams);
3440
while (this.documentsToOpen.length) {
3541
this.sendOpen(this.documentsToOpen.pop());
3642
}

packages/jupyterlab-lsp/src/connection_manager.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,14 @@ export class DocumentConnectionManager {
148148
return connection;
149149
}
150150

151+
public updateServerConfigurations(
152+
options?: {}
153+
) {
154+
for (let [, connection] of this.connections) {
155+
connection.sendConfigurationChange(options)
156+
}
157+
}
158+
151159
/**
152160
* Fired the first time a connection is opened. These _should_ be the only
153161
* invocation of `.on` (once remaining LSPFeature.connection_handlers are made

packages/jupyterlab-lsp/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,15 @@ const plugin: JupyterFrontEndPlugin<void> = {
235235
notebook_command_manager.add(lsp_commands);
236236

237237
function updateOptions(settings: ISettingRegistry.ISettings): void {
238-
// let options = settings.composite;
238+
const options = settings.composite;
239239
// Object.keys(options).forEach((key) => {
240240
// if (key === 'modifier') {
241241
// // let modifier = options[key] as KeyModifier;
242242
// CodeMirrorExtension.modifierKey = modifier;
243243
// }
244244
// });
245+
console.log(connection_manager)
246+
connection_manager.updateServerConfigurations(options)
245247
}
246248

247249
settingRegistry

packages/lsp-ws-connection/src/ws-connection.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,20 @@ export class LspWsConnection extends events.EventEmitter
268268
);
269269
}
270270

271+
public sendConfigurationChange(
272+
options?: any
273+
) {
274+
console.log(`Updated server configuration: ${JSON.stringify(options)}`)
275+
if (!this.isReady) {
276+
return;
277+
}
278+
279+
this.connection.sendNotification(
280+
'workspace/didChangeConfiguration',
281+
options
282+
)
283+
}
284+
271285
public async getHoverTooltip(
272286
location: IPosition,
273287
documentInfo: IDocumentInfo,
@@ -605,6 +619,7 @@ export class LspWsConnection extends events.EventEmitter
605619
}
606620

607621
protected onServerInitialized(params: protocol.InitializeResult) {
622+
console.log("MODIFIED SERVER INIT 4", params)
608623
this.isInitialized = true;
609624
this.serverCapabilities = params.capabilities;
610625
this.connection.sendNotification('initialized');

0 commit comments

Comments
 (0)