Skip to content

Commit ab923bc

Browse files
author
Travis James Smith
committed
Configure using server spec rather than language name
1 parent 178af6b commit ab923bc

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

packages/jupyterlab-lsp/src/connection_manager.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { sleep, until_ready } from './utils';
88
// Name-only import so as to not trigger inclusion in main bundle
99
import * as ConnectionModuleType from './connection';
1010
import { TLanguageServerId, ILanguageServerManager } from './tokens';
11-
import { ClientConfigurationSchema } from './_schema'
1211

1312
export interface IDocumentConnectionData {
1413
virtual_document: VirtualDocument;
@@ -131,7 +130,7 @@ export class DocumentConnectionManager {
131130
const language_server_id = this.language_server_manager.getServerId({
132131
language
133132
});
134-
133+
console.log("LS ID: ", language_server_id)
135134
// lazily load 1) the underlying library (1.5mb) and/or 2) a live WebSocket-
136135
// like connection: either already connected or potentiailly in the process
137136
// of connecting.
@@ -151,15 +150,12 @@ export class DocumentConnectionManager {
151150

152151
public async updateServerConfigurations(
153152
//TODO: define types for server configurations
154-
options: any
153+
settings: any
155154
) {
156-
for (let language in options) {
157-
let connection = this.connections.get(language)
158-
159-
if (connection) {
160-
const config = options[language].config
161-
await connection.sendConfigurationChange(config)
162-
}
155+
console.log(this.language_server_manager)
156+
for (let language_server_id in settings) {
157+
const config = settings[language_server_id].config
158+
await Private.updateServerConfiguration(language_server_id, config)
163159
}
164160
}
165161

@@ -263,7 +259,6 @@ export class DocumentConnectionManager {
263259
}
264260
}
265261

266-
// Travis: per language configuration here?
267262
async connect(options: ISocketConnectionOptions) {
268263
console.log('LSP: connection requested', options);
269264
let connection = await this.connect_socket(options);
@@ -389,4 +384,14 @@ namespace Private {
389384

390385
return connection;
391386
}
387+
388+
export async function updateServerConfiguration(
389+
language_server_id: any,
390+
settings: any
391+
): Promise<any> {
392+
const connection = _connections.get(language_server_id)
393+
if (connection) {
394+
await connection.sendConfigurationChange(settings)
395+
}
396+
}
392397
}

packages/jupyterlab-lsp/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
235235
notebook_command_manager.add(lsp_commands);
236236

237237
function updateOptions(settings: ISettingRegistry.ISettings): void {
238+
console.log(connection_manager)
238239
const options = settings.composite;
239240

240241
// Object.keys(options).forEach((key) => {

0 commit comments

Comments
 (0)