Skip to content

Commit 56e121f

Browse files
authored
Merge pull request #330 from krassowski/diagnostics-panel-improvements
Diagnostics panel improvements: copy, ignore (filter), jump from context menu
2 parents 75a90e8 + 95cf138 commit 56e121f

File tree

9 files changed

+272
-190
lines changed

9 files changed

+272
-190
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
- refactored the codebase with a new architecture which allows dynamic feature, document widget adapter, and code editor registration ([#318])
2929
- the document in the connections list in the statusbar popover are now represented by easy-to-understand DocumentLocator (breadcrumbs) widget rather than an internal id ([bacc006])
3030
- syntax highlighting mode is adjusted to the language with the majority of the code in an editor ([#319])
31+
- copy diagnostics message and filter diagnostics from context menu of Diagnostic Panel ([#330])
3132

3233
- bug fixes
3334

@@ -45,6 +46,7 @@
4546
[#319]: https://github.com/krassowski/jupyterlab-lsp/pull/319
4647
[#322]: https://github.com/krassowski/jupyterlab-lsp/pull/322
4748
[#329]: https://github.com/krassowski/jupyterlab-lsp/pull/329
49+
[#330]: https://github.com/krassowski/jupyterlab-lsp/pull/330
4850
[00448d0]: https://github.com/krassowski/jupyterlab-lsp/pull/318/commits/00448d0c55e7f9a1e7e0a5322f17610daac47dfe
4951
[bacc006]: https://github.com/krassowski/jupyterlab-lsp/pull/318/commits/bacc0066da0727ff7397574914bf0401e4d8f7cb
5052
[4e5b2ad]: https://github.com/krassowski/jupyterlab-lsp/pull/318/commits/4e5b2adf655120458cc8be4b453fe9a78c98e061
Lines changed: 68 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,95 @@
11
*** Settings ***
22
Suite Setup Setup Suite For Screenshots diagnostics_panel
33
Resource ../Keywords.robot
4-
Test Setup Gently Reset Workspace
4+
Test Setup Set Up
5+
Test Teardown Clean Up
56

67
*** Variables ***
78
${EXPECTED_COUNT} 1
89
${DIAGNOSTIC} W291 trailing whitespace (pycodestyle)
910
${DIAGNOSTIC MESSAGE} trailing whitespace
10-
${MENU COLUMNS} xpath://div[contains(@class, 'p-Menu-itemLabel')][contains(text(), "columns")]
11-
${MENU COLUMN MESSAGE} xpath://div[contains(@class, 'p-Menu-itemLabel')][contains(text(), "Message")]
11+
${MENU COLUMNS} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "columns")]
12+
${LAB MENU} css:.lm-Menu
1213

1314
*** Test Cases ***
1415
Diagnostics Panel Opens
15-
Open Notebook And Panel Panel.ipynb
1616
Capture Page Screenshot 03-panel-opens.png
17-
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count
18-
[Teardown] Clean Up After Working With File Panel.ipynb
17+
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count ${EXPECTED_COUNT}
1918

2019
Diagnostics Panel Works After Rename
2120
[Documentation] Test for #141 bug (diagnostics were not cleared after rename)
22-
Open Notebook And Panel Panel.ipynb
2321
Rename Jupyter File Panel.ipynb PanelRenamed.ipynb
2422
Close Diagnostics Panel
2523
Wait Until Page Contains Element css:.cm-lsp-diagnostic[title*="${DIAGNOSTIC}"] timeout=20s
2624
Capture Page Screenshot 00-panel-rename.png
2725
Open Diagnostics Panel
2826
Capture Page Screenshot 01-panel-rename.png
29-
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count
27+
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count ${EXPECTED_COUNT}
3028
Clean Up After Working With File PanelRenamed.ipynb
31-
[Teardown] Clean Up After Working With File Panel.ipynb
3229

3330
Diagnostics Panel Can Be Restored
34-
Open Notebook And Panel Panel.ipynb
3531
Close Diagnostics Panel
3632
Open Diagnostics Panel
37-
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count
38-
[Teardown] Clean Up After Working With File Panel.ipynb
33+
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count ${EXPECTED_COUNT}
3934

4035
Columns Can Be Hidden
41-
Open Notebook And Panel Panel.ipynb
4236
Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL} ${DIAGNOSTIC MESSAGE}
4337
Open Context Menu Over css:.lsp-diagnostics-listing th
4438
Capture Page Screenshot 01-menu-visible.png
45-
Mouse Over ${MENU COLUMNS}
46-
Wait Until Page Contains Element ${MENU COLUMN MESSAGE} timeout=10s
47-
Mouse Over ${MENU COLUMN MESSAGE}
48-
Capture Page Screenshot 02-message-column-visible.png
49-
Click Element ${MENU COLUMN MESSAGE}
39+
Expand Menu Entry columns
40+
Select Menu Entry Message
5041
Capture Page Screenshot 03-message-column-toggled.png
5142
Wait Until Keyword Succeeds 10 x 1s Element Should Not Contain ${DIAGNOSTICS PANEL} ${DIAGNOSTIC MESSAGE}
52-
[Teardown] Clean Up After Working With File Panel.ipynb
43+
44+
Diagnostics Can Be Ignored By Code
45+
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count 1
46+
Open Context Menu Over css:.lsp-diagnostics-listing tbody tr
47+
Expand Menu Entry Ignore diagnostics
48+
Select Menu Entry code
49+
Open in Advanced Settings ${DIAGNOSTICS PLUGIN ID}
50+
Capture Page Screenshot 02-code-pressed.png
51+
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count 0
52+
53+
Diagnostics Can Be Ignored By Message
54+
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count 1
55+
Open Context Menu Over css:.lsp-diagnostics-listing tbody tr
56+
Expand Menu Entry Ignore diagnostics
57+
Capture Page Screenshot 02-menu-visible.png
58+
Select Menu Entry Ignore diagnostics with "W291 trailing whitespace" message
59+
Open in Advanced Settings ${DIAGNOSTICS PLUGIN ID}
60+
Capture Page Screenshot 02-message-pressed.png
61+
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count 0
62+
63+
Diagnostic Message Can Be Copied
64+
Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL} ${DIAGNOSTIC MESSAGE}
65+
Open Context Menu Over css:.lsp-diagnostics-listing tbody tr
66+
Select Menu Entry Copy diagnostic
67+
Close Diagnostics Panel
68+
Wait Until Element Contains css:.lsp-statusbar-item Successfully copied timeout=10s
5369

5470
*** Keywords ***
71+
Expand Menu Entry
72+
[Arguments] ${label}
73+
${entry} = Set Variable xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "${label}")]
74+
Wait Until Page Contains Element ${entry} timeout=10s
75+
${menus before} = Get Element Count ${LAB MENU}
76+
Mouse Over ${entry}
77+
${expected menus} = Evaluate ${menus before} + 1
78+
Wait Until Keyword Succeeds 10 x 1s Menus Count Equal ${expected menus}
79+
80+
Menus Count Equal
81+
[Arguments] ${count}
82+
${menus count} = Get Element Count ${LAB MENU}
83+
Should Be Equal ${menus count} ${count}
84+
85+
Select Menu Entry
86+
[Arguments] ${label}
87+
${entry} Set Variable xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), '${label}')]
88+
Wait Until Page Contains Element ${entry} timeout=10s
89+
Mouse Over ${entry}
90+
Click Element ${entry}
91+
Wait Until Page Does Not Contain Element ${entry} timeout=10s
92+
5593
Open Notebook And Panel
5694
[Arguments] ${notebook}
5795
Setup Notebook Python ${notebook}
@@ -61,5 +99,15 @@ Open Notebook And Panel
6199
Capture Page Screenshot 00-notebook-and-panel-opened.png
62100

63101
Should Have Expected Rows Count
102+
[Arguments] ${expected_count}
64103
${count} = Count Diagnostics In Panel
65-
Should Be True ${count} == ${EXPECTED_COUNT}
104+
Should Be True ${count} == ${expected_count}
105+
106+
Set Up
107+
Gently Reset Workspace
108+
Open Notebook And Panel Panel.ipynb
109+
110+
Clean Up
111+
Clean Up After Working With File Panel.ipynb
112+
Reset Plugin Settings plugin=diagnostics
113+
Reset Application State

atest/05_Features/Completion.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Select Completer Suggestion
199199

200200
Completer Should Suggest
201201
[Arguments] ${text}
202-
Wait Until Page Contains Element ${COMPLETER_BOX} .jp-Completer-item[data-value="${text}"]
202+
Wait Until Page Contains Element ${COMPLETER_BOX} .jp-Completer-item[data-value="${text}"] timeout=10s
203203
Capture Page Screenshot ${text.replace(' ', '_')}.png
204204

205205
Completer Should Include Icon

atest/Keywords.robot

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Initialize User Settings
5858
Create File ${SETTINGS DIR}${/}@jupyterlab${/}codemirror-extension${/}commands.jupyterlab-settings {"styleActiveLine": true}
5959

6060
Reset Plugin Settings
61+
[Arguments] ${package}=jupyterlab-lsp ${plugin}=plugin
62+
${LSP PLUGIN SETTINGS FILE} = Set Variable @krassowski${/}${package}${/}${plugin}.jupyterlab-settings
6163
Create File ${SETTINGS DIR}${/}${LSP PLUGIN SETTINGS FILE} {}
6264

6365
Tear Down Everything
@@ -278,7 +280,6 @@ Wait Until Fully Initialized
278280
Open Context Menu Over
279281
[Arguments] ${sel}
280282
Wait Until Keyword Succeeds 10 x 0.1 s Mouse Over ${sel}
281-
Wait Until Keyword Succeeds 10 x 0.1 s Click Element ${sel}
282283
Wait Until Keyword Succeeds 10 x 0.1 s Open Context Menu ${sel}
283284

284285
Prepare File for Editing

atest/Variables.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ${CM CURSORS} css:.CodeMirror-cursors:not([style='visibility: hidden'])
3434
# settings
3535
${LSP PLUGIN ID} @krassowski/jupyterlab-lsp:plugin
3636
${COMPLETION PLUGIN ID} @krassowski/jupyterlab-lsp:completion
37-
${LSP PLUGIN SETTINGS FILE} @krassowski${/}jupyterlab-lsp${/}plugin.jupyterlab-settings
37+
${DIAGNOSTICS PLUGIN ID} @krassowski/jupyterlab-lsp:diagnostics
3838
${CSS USER SETTINGS} .jp-SettingsRawEditor-user
3939
${JLAB XP CLOSE SETTINGS} ${JLAB XP DOCK TAB}\[contains(., 'Settings')]/*[contains(@class, 'm-TabBar-tabCloseIcon')]
4040
# diagnostics

atest/examples/Diagnostic.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"name": "python",
6767
"nbconvert_exporter": "python",
6868
"pygments_lexer": "ipython3",
69-
"version": "3.7.6"
69+
"version": "3.7.5"
7070
}
7171
},
7272
"nbformat": 4,

atest/examples/Panel.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"name": "python",
3636
"nbconvert_exporter": "python",
3737
"pygments_lexer": "ipython3",
38-
"version": "3.8.0"
38+
"version": "3.7.5"
3939
}
4040
},
4141
"nbformat": 4,

0 commit comments

Comments
 (0)