Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix statusbar message pooling data from all editors #329

Merged
merged 5 commits into from
Aug 31, 2020
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@
- pressing "Cancel" rename during rename now correctly aborts the rename operation ([#318])
- when a language server for a foreign document is not available an explanation is displayed (rather than the "Connecting..." status as before) ([4e5b2ad])
- when jump target is not found a message is now shown instead of raising an exception ([00448d0])
- fixed status message expiration and replacement ([8798f2d])
- fixed status message expiration and replacement ([8798f2d]), ([#329])
- fixed some context command rank issues introduced after an attempt of migration to nulls ([#318])

[#301]: https://github.com/krassowski/jupyterlab-lsp/pull/301
[#315]: https://github.com/krassowski/jupyterlab-lsp/pull/315
[#318]: https://github.com/krassowski/jupyterlab-lsp/pull/318
[#319]: https://github.com/krassowski/jupyterlab-lsp/pull/319
[#322]: https://github.com/krassowski/jupyterlab-lsp/pull/322
[#329]: https://github.com/krassowski/jupyterlab-lsp/pull/329
[00448d0]: https://github.com/krassowski/jupyterlab-lsp/pull/318/commits/00448d0c55e7f9a1e7e0a5322f17610daac47dfe
[bacc006]: https://github.com/krassowski/jupyterlab-lsp/pull/318/commits/bacc0066da0727ff7397574914bf0401e4d8f7cb
[4e5b2ad]: https://github.com/krassowski/jupyterlab-lsp/pull/318/commits/4e5b2adf655120458cc8be4b453fe9a78c98e061
Expand Down
17 changes: 17 additions & 0 deletions atest/04_Interface/Statusbar.robot
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,20 @@ Statusbar Popup Opens
Element Should Contain ${POPOVER} python
Element Should Contain ${POPOVER} initialized
[Teardown] Clean Up After Working With File Python.ipynb

Status Changes Correctly Between Editors
Prepare File for Editing Python status example.py
Wait Until Fully Initialized
Open File example.plain
Wait Until Element Contains ${STATUSBAR} Initialized (additional servers needed) timeout=60s
Capture Page Screenshot 01-both-open.png
Switch To Tab example.py
Wait Until Fully Initialized
Switch To Tab example.plain
Wait Until Element Contains ${STATUSBAR} Initialized (additional servers needed) timeout=60s
[Teardown] Clean Up After Working With File example.plain

*** Keywords ***
Switch To Tab
[Arguments] ${file}
Click Element ${JLAB XP DOCK TAB}\[contains(., '${file}')]
6 changes: 5 additions & 1 deletion atest/Keywords.robot
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,12 @@ Prepare File for Editing
[Arguments] ${Language} ${Screenshots} ${file}
Set Tags language:${Language.lower()}
Set Screenshot Directory ${OUTPUT DIR}${/}screenshots${/}${Screenshots}${/}${Language.lower()}
Copy File examples${/}${file} ${OUTPUT DIR}${/}home${/}${file}
Try to Close All Tabs
Open File ${file}

Open File
[Arguments] ${file}
Copy File examples${/}${file} ${OUTPUT DIR}${/}home${/}${file}
Open ${file} in ${MENU EDITOR}
Capture Page Screenshot 00-opened.png

Expand Down
2 changes: 2 additions & 0 deletions atest/examples/example.plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
There is nothing interesting in here.
It is here just to test how the extension works with files for which there is no associated language support.
20 changes: 17 additions & 3 deletions packages/jupyterlab-lsp/src/components/statusbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,7 @@ const classByStatus: StatusIconClass = {
const shortMessageByStatus: StatusMap = {
waiting: 'Waiting...',
initialized: 'Fully initialized',
initialized_but_some_missing:
'Initialized (additional servers can be installed)',
initialized_but_some_missing: 'Initialized (additional servers needed)',
initializing: 'Partially initialized',
connecting: 'Connecting...'
};
Expand Down Expand Up @@ -436,7 +435,22 @@ export namespace LSPStatus {
}

get status(): IStatus {
const detected_documents = this._connection_manager.documents;
let detected_documents: Map<string, VirtualDocument>;

if (!this.adapter?.virtual_editor) {
detected_documents = new Map();
} else {
let main_document = this.adapter.virtual_editor.virtual_document;
const all_documents = this._connection_manager.documents;
// detected documents that are open in the current virtual editor
const detected_documents_set = collect_documents(main_document);
detected_documents = new Map(
[...all_documents].filter(([id, doc]) =>
detected_documents_set.has(doc)
)
);
}

let connected_documents = new Set<VirtualDocument>();
let initialized_documents = new Set<VirtualDocument>();
let absent_documents = new Set<VirtualDocument>();
Expand Down