Skip to content

Commit 01ea6a9

Browse files
authored
Merge pull request #329 from krassowski/fix-statusbar-status
Fix statusbar message pooling data from all editors
2 parents 19123a1 + d69b102 commit 01ea6a9

File tree

5 files changed

+43
-5
lines changed

5 files changed

+43
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@
3636
- pressing "Cancel" rename during rename now correctly aborts the rename operation ([#318])
3737
- when a language server for a foreign document is not available an explanation is displayed (rather than the "Connecting..." status as before) ([4e5b2ad])
3838
- when jump target is not found a message is now shown instead of raising an exception ([00448d0])
39-
- fixed status message expiration and replacement ([8798f2d])
39+
- fixed status message expiration and replacement ([8798f2d]), ([#329])
4040
- fixed some context command rank issues introduced after an attempt of migration to nulls ([#318])
4141

4242
[#301]: https://github.com/krassowski/jupyterlab-lsp/pull/301
4343
[#315]: https://github.com/krassowski/jupyterlab-lsp/pull/315
4444
[#318]: https://github.com/krassowski/jupyterlab-lsp/pull/318
4545
[#319]: https://github.com/krassowski/jupyterlab-lsp/pull/319
4646
[#322]: https://github.com/krassowski/jupyterlab-lsp/pull/322
47+
[#329]: https://github.com/krassowski/jupyterlab-lsp/pull/329
4748
[00448d0]: https://github.com/krassowski/jupyterlab-lsp/pull/318/commits/00448d0c55e7f9a1e7e0a5322f17610daac47dfe
4849
[bacc006]: https://github.com/krassowski/jupyterlab-lsp/pull/318/commits/bacc0066da0727ff7397574914bf0401e4d8f7cb
4950
[4e5b2ad]: https://github.com/krassowski/jupyterlab-lsp/pull/318/commits/4e5b2adf655120458cc8be4b453fe9a78c98e061

atest/04_Interface/Statusbar.robot

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,20 @@ Statusbar Popup Opens
1818
Element Should Contain ${POPOVER} python
1919
Element Should Contain ${POPOVER} initialized
2020
[Teardown] Clean Up After Working With File Python.ipynb
21+
22+
Status Changes Correctly Between Editors
23+
Prepare File for Editing Python status example.py
24+
Wait Until Fully Initialized
25+
Open File example.plain
26+
Wait Until Element Contains ${STATUSBAR} Initialized (additional servers needed) timeout=60s
27+
Capture Page Screenshot 01-both-open.png
28+
Switch To Tab example.py
29+
Wait Until Fully Initialized
30+
Switch To Tab example.plain
31+
Wait Until Element Contains ${STATUSBAR} Initialized (additional servers needed) timeout=60s
32+
[Teardown] Clean Up After Working With File example.plain
33+
34+
*** Keywords ***
35+
Switch To Tab
36+
[Arguments] ${file}
37+
Click Element ${JLAB XP DOCK TAB}\[contains(., '${file}')]

atest/Keywords.robot

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,12 @@ Prepare File for Editing
285285
[Arguments] ${Language} ${Screenshots} ${file}
286286
Set Tags language:${Language.lower()}
287287
Set Screenshot Directory ${OUTPUT DIR}${/}screenshots${/}${Screenshots}${/}${Language.lower()}
288-
Copy File examples${/}${file} ${OUTPUT DIR}${/}home${/}${file}
289288
Try to Close All Tabs
289+
Open File ${file}
290+
291+
Open File
292+
[Arguments] ${file}
293+
Copy File examples${/}${file} ${OUTPUT DIR}${/}home${/}${file}
290294
Open ${file} in ${MENU EDITOR}
291295
Capture Page Screenshot 00-opened.png
292296

atest/examples/example.plain

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
There is nothing interesting in here.
2+
It is here just to test how the extension works with files for which there is no associated language support.

packages/jupyterlab-lsp/src/components/statusbar.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,7 @@ const classByStatus: StatusIconClass = {
322322
const shortMessageByStatus: StatusMap = {
323323
waiting: 'Waiting...',
324324
initialized: 'Fully initialized',
325-
initialized_but_some_missing:
326-
'Initialized (additional servers can be installed)',
325+
initialized_but_some_missing: 'Initialized (additional servers needed)',
327326
initializing: 'Partially initialized',
328327
connecting: 'Connecting...'
329328
};
@@ -436,7 +435,22 @@ export namespace LSPStatus {
436435
}
437436

438437
get status(): IStatus {
439-
const detected_documents = this._connection_manager.documents;
438+
let detected_documents: Map<string, VirtualDocument>;
439+
440+
if (!this.adapter?.virtual_editor) {
441+
detected_documents = new Map();
442+
} else {
443+
let main_document = this.adapter.virtual_editor.virtual_document;
444+
const all_documents = this._connection_manager.documents;
445+
// detected documents that are open in the current virtual editor
446+
const detected_documents_set = collect_documents(main_document);
447+
detected_documents = new Map(
448+
[...all_documents].filter(([id, doc]) =>
449+
detected_documents_set.has(doc)
450+
)
451+
);
452+
}
453+
440454
let connected_documents = new Set<VirtualDocument>();
441455
let initialized_documents = new Set<VirtualDocument>();
442456
let absent_documents = new Set<VirtualDocument>();

0 commit comments

Comments
 (0)