Skip to content

Commit c2a8283

Browse files
authored
Merge pull request #689 from jupyter-lsp/allow-to-disable-features
Allow to disable specific features
2 parents 9e8f577 + b3c72fc commit c2a8283

File tree

12 files changed

+232
-152
lines changed

12 files changed

+232
-152
lines changed

CHANGELOG.md

Lines changed: 142 additions & 140 deletions
Large diffs are not rendered by default.

packages/jupyterlab-lsp/schema/completion.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@
130130
]
131131
}
132132
}
133+
},
134+
"disable": {
135+
"title": "Disable",
136+
"type": "boolean",
137+
"default": false,
138+
"description": "Disable this feature. Requires reloading JupyterLab to apply changes."
133139
}
134140
},
135141
"jupyter.lab.shortcuts": []

packages/jupyterlab-lsp/schema/diagnostics.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
},
3030
"default": [],
3131
"description": "Regular expressions matching messages of diagnostics which should not be shown in the panel nor highlighted in the editor."
32+
},
33+
"disable": {
34+
"title": "Disable",
35+
"type": "boolean",
36+
"default": false,
37+
"description": "Disable this feature. Requires reloading JupyterLab to apply changes."
3238
}
3339
},
3440
"jupyter.lab.shortcuts": []

packages/jupyterlab-lsp/schema/highlights.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
"type": "boolean",
1717
"default": false,
1818
"description": "Whether the highlights should disappear after the focus leaves the editor/cell"
19+
},
20+
"disable": {
21+
"title": "Disable",
22+
"type": "boolean",
23+
"default": false,
24+
"description": "Disable this feature. Requires reloading JupyterLab to apply changes."
1925
}
2026
},
2127
"jupyter.lab.shortcuts": []

packages/jupyterlab-lsp/schema/hover.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
"type": "number",
2424
"default": 25,
2525
"description": "Up to how many hover responses should be cached at any given time. The cache being is invalidated after any change in the editor."
26+
},
27+
"disable": {
28+
"title": "Disable",
29+
"type": "boolean",
30+
"default": false,
31+
"description": "Disable this feature. Requires reloading JupyterLab to apply changes."
2632
}
2733
},
2834
"jupyter.lab.shortcuts": []

packages/jupyterlab-lsp/schema/jump_to.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
"enum": ["Alt", "Control", "Shift", "Meta", "AltGraph", "Accel"],
1212
"default": "Alt",
1313
"description": "Keyboard key which needs to be pressed with click to jump. The allowed keys are Alt, Control, Shift, Accel, and AltGraph. Accel corresponds to Control or Meta (Command on Mac). Linux user: Meta key is also supported. Safari users: Meta key is also supported, AltGraph is not supported. To see which physical keys are mapped, visit: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState"
14+
},
15+
"disable": {
16+
"title": "Disable",
17+
"type": "boolean",
18+
"default": false,
19+
"description": "Disable this feature. Requires reloading JupyterLab to apply changes."
1420
}
1521
},
1622
"jupyter.lab.shortcuts": [

packages/jupyterlab-lsp/schema/rename.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@
44
"title": "Code Rename",
55
"description": "LSP Rename settings.",
66
"type": "object",
7-
"properties": {},
7+
"properties": {
8+
"disable": {
9+
"title": "Disable",
10+
"type": "boolean",
11+
"default": false,
12+
"description": "Disable this feature. Requires reloading JupyterLab to apply changes."
13+
}
14+
},
815
"jupyter.lab.shortcuts": [
916
{
1017
"command": "lsp:rename-symbol-notebook",

packages/jupyterlab-lsp/schema/signature.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
"type": "number",
2020
"default": 12,
2121
"description": "The number of documentation lines to show without collapsing into the details section."
22+
},
23+
"disable": {
24+
"title": "Disable",
25+
"type": "boolean",
26+
"default": false,
27+
"description": "Disable this feature. Requires reloading JupyterLab to apply changes."
2228
}
2329
},
2430
"jupyter.lab.shortcuts": []

packages/jupyterlab-lsp/schema/syntax_highlighting.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
"type": "number",
1111
"default": 0.5,
1212
"description": "If a code editor includes a code fragment in another language (for example a %%markdown magic in IPython) with appropriate foreign code extractor defined, and the extend of this code (coverage of the editor) passes the threshold, the syntax highlighting (i.e. the mode) will change to provide highlighting for the language of the foreign code."
13+
},
14+
"disable": {
15+
"title": "Disable",
16+
"type": "boolean",
17+
"default": false,
18+
"description": "Disable this feature. Requires reloading JupyterLab to apply changes."
1319
}
1420
},
1521
"jupyter.lab.shortcuts": []

packages/jupyterlab-lsp/src/feature.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@ export interface IFeatureCommand {
5656
export interface IFeatureSettings<T> {
5757
readonly composite: T;
5858
readonly changed: Signal<IFeatureSettings<T>, void>;
59+
readonly ready?: Promise<void>;
5960

6061
set(setting: keyof T, value: any): void;
6162
}
6263

6364
export class FeatureSettings<T> implements IFeatureSettings<T> {
6465
protected settings: ISettingRegistry.ISettings;
6566
public changed: Signal<FeatureSettings<T>, void>;
67+
public ready: Promise<void>;
6668

6769
constructor(protected settingRegistry: ISettingRegistry, featureID: string) {
6870
this.changed = new Signal(this);
@@ -71,17 +73,20 @@ export class FeatureSettings<T> implements IFeatureSettings<T> {
7173
`${featureID} settings schema could not be found and was not loaded`
7274
);
7375
} else {
74-
settingRegistry
75-
.load(featureID)
76-
.then(settings => {
77-
this.settings = settings;
78-
this.changed.emit();
79-
settings.changed.connect(() => {
76+
this.ready = new Promise(accept => {
77+
settingRegistry
78+
.load(featureID)
79+
.then(settings => {
8080
this.settings = settings;
81+
accept();
8182
this.changed.emit();
82-
});
83-
})
84-
.catch(console.warn);
83+
settings.changed.connect(() => {
84+
this.settings = settings;
85+
this.changed.emit();
86+
});
87+
})
88+
.catch(console.warn);
89+
});
8590
}
8691
}
8792

0 commit comments

Comments
 (0)