Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions packages/jupyterlab-lsp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import { ILoggerRegistry } from '@jupyterlab/logconsole';
import {
ILSPDocumentConnectionManager,
DocumentConnectionManager,
ILanguageServerManager
ILanguageServerManager,
TLanguageServerId
} from '@jupyterlab/lsp';
import { ISettingRegistry } from '@jupyterlab/settingregistry';
import { IStatusBar } from '@jupyterlab/statusbar';
Expand Down Expand Up @@ -175,7 +176,22 @@ export class LSPExtension {

const previousInitialConfig = this._connectionManager.initialConfigurations;
this._connectionManager.initialConfigurations = languageServerSettings;
// TODO: if priorities changed reset connections

const prioritiesChanged = Object.keys(languageServerSettings).some(
(key: TLanguageServerId) => {
const prevConfig = previousInitialConfig?.[key];
const newConfig = languageServerSettings[key];
return prevConfig && newConfig && prevConfig.rank !== newConfig.rank;
}
);

if (prioritiesChanged) {
this.connectionManager.adapters.forEach(adapter => {
if (adapter.virtualDocument) {
adapter['reloadConnection']();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we would want to make it public upstream?

Or we could make a public method which calls the protected one here in:

export class NotebookAdapter extends UpstreamNotebookAdapter {

and in

export class FileEditorAdapter extends UpstreamFileEditorAdapter {

but frankly I think it does not need to be protected.

}
});
}

// update the server-independent part of configuration immediately
this.connectionManager.updateConfiguration(languageServerSettings);
Expand Down
Loading