Skip to content

Commit c93d8e8

Browse files
committed
Do not leak renamed settings back to settings store/editor
1 parent b207aa8 commit c93d8e8

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/jupyterlab-lsp/src/index.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export * as SCHEMA from './_schema';
99
/** Component- and feature-specific APIs */
1010
export * from './api';
1111

12+
import { JSONExt } from '@lumino/coreutils';
1213
import { COMPLETION_THEME_MANAGER } from '@jupyter-lsp/completion-theme';
1314
import { plugin as THEME_MATERIAL } from '@jupyter-lsp/theme-material';
1415
import { plugin as THEME_VSCODE } from '@jupyter-lsp/theme-vscode';
@@ -158,13 +159,16 @@ export class LSPExtension {
158159
let languageServerSettings = (options.language_servers ||
159160
{}) as TLanguageServerConfigurations;
160161

161-
// Add `configuration` as a copy of `serverSettings` to work with changed name upstream
162-
// Add `rank` as a copy of priority for the same reason.
162+
// Rename `serverSettings` to `configuration` to work with changed name upstream,
163+
// rename `priority` to `rank` for the same reason.
163164
languageServerSettings = Object.fromEntries(
164165
Object.entries(languageServerSettings).map(([key, value]) => {
165-
value.configuration = value.serverSettings;
166-
value.rank = value.priority;
167-
return [key, value];
166+
const copy = JSONExt.deepCopy(value);
167+
copy.configuration = copy.serverSettings;
168+
copy.rank = copy.priority;
169+
delete copy.priority;
170+
delete copy.serverSettings;
171+
return [key, copy];
168172
})
169173
);
170174

0 commit comments

Comments
 (0)