Skip to content

Commit 95116b9

Browse files
committed
Merge branch 'master' into yunair-fix_completion_case_sensitive
2 parents 167199e + bf6589b commit 95116b9

25 files changed

+726
-93
lines changed

CHANGELOG.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@
1616
[#129](https://github.com/krassowski/jupyterlab-lsp/pull/129)
1717
)
1818
- added a widget panel with diagnostics (inspections), allowing to
19-
sort and explore diagnostics, and to go-to the respective location
20-
in code (on click); accessible from the context menu (
19+
sort and explore diagnostics, and to go to the respective location
20+
in code (with a click); accessible from the context menu (
2121
[#127](https://github.com/krassowski/jupyterlab-lsp/pull/127)
2222
)
23+
- all commands are now accessible from the command palette (
24+
[#142](https://github.com/krassowski/jupyterlab-lsp/pull/142)
25+
)
26+
- bash LSP now also covers `%%bash` magic cell in addition to `%%sh` (
27+
[#144](https://github.com/krassowski/jupyterlab-lsp/pull/144)
28+
)
2329
- bugfixes
2430
- diagnostics in foreign documents are now correctly updated (
2531
[133fd3d](https://github.com/krassowski/jupyterlab-lsp/pull/129/commits/133fd3d71401c7e5affc0a8637ee157de65bef62)
@@ -28,6 +34,12 @@
2834
- the workaround for relative root path is now also applied on Mac (
2935
[#139](https://github.com/krassowski/jupyterlab-lsp/pull/139)
3036
)
37+
- fixed LSP of R in Python (`%%R` magic cell from rpy2) (
38+
[#144](https://github.com/krassowski/jupyterlab-lsp/pull/144)
39+
)
40+
- completion now work properly when the kernel is shut down (
41+
[#146](https://github.com/krassowski/jupyterlab-lsp/pull/146)
42+
)
3143

3244
## `lsp-ws-connection 0.3.0`
3345

atest/01_Editor.robot

Lines changed: 16 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@ Resource Keywords.robot
55

66
*** Variables ***
77
${MENU EDITOR} xpath://div[contains(@class, 'p-Menu-itemLabel')][contains(., "Editor")]
8-
${MENU OPEN WITH} xpath://div[contains(@class, 'p-Menu-itemLabel')][contains(text(), "Open With")]
98
${MENU JUMP} xpath://div[contains(@class, 'p-Menu-itemLabel')][contains(text(), "Jump to definition")]
10-
${MENU RENAME} xpath://div[contains(@class, 'p-Menu-itemLabel')][contains(text(), "Rename")]
119
${CM CURSOR} css:.CodeMirror-cursor
1210
${CM CURSORS} css:.CodeMirror-cursors:not([style='visibility: hidden'])
13-
${DIALOG WINDOW} css:.jp-Dialog
14-
${DIALOG INPUT} css:.jp-Input-Dialog input
1511

1612
*** Test Cases ***
1713
Bash
@@ -72,7 +68,7 @@ Editor Shows Features for Language
7268
Set Screenshot Directory ${OUTPUT DIR}${/}screenshots${/}editor${/}${Language.lower()}
7369
Copy File examples${/}${file} ${OUTPUT DIR}${/}home${/}${file}
7470
Lab Command Close All Tabs
75-
Open ${file} in Editor
71+
Open ${file} in ${MENU EDITOR}
7672
Capture Page Screenshot 00-opened.png
7773
FOR ${f} IN @{features}
7874
Run Keyword If "${f}" == "Diagnostics" Editor Should Show Diagnostics ${features["${f}"]}
@@ -82,30 +78,16 @@ Editor Shows Features for Language
8278
Capture Page Screenshot 99-done.png
8379
[Teardown] Clean Up After Working With File ${file}
8480

85-
Clean Up After Working With File
86-
[Arguments] ${file}
87-
Remove File ${OUTPUT DIR}${/}home${/}${file}
88-
Reset Application State
89-
90-
Open ${file} in Editor
91-
Ensure File Browser is Open
92-
Click Element css:button[title="Refresh File List"]
93-
Open Context Menu css:.jp-DirListing-item[title="${file}"]
94-
Mouse Over ${MENU OPEN WITH}
95-
Wait Until Page Contains Element ${MENU EDITOR}
96-
Mouse Over ${MENU EDITOR}
97-
Click Element ${MENU EDITOR}
98-
99-
Ensure File Browser is Open
100-
${sel} = Set Variable css:.p-TabBar-tab[data-id="filebrowser"]:not(.p-mod-current)
101-
${els} = Get WebElements ${sel}
102-
Run Keyword If ${els.__len__()} Click Element ${sel}
103-
10481
Editor Should Show Diagnostics
10582
[Arguments] ${diagnostic}
10683
Set Tags feature:diagnostics
10784
Wait Until Page Contains Element css:.cm-lsp-diagnostic[title*="${diagnostic}"] timeout=20s
10885
Capture Page Screenshot 01-diagnostics.png
86+
Open Diagnostics Panel
87+
Capture Page Screenshot 02-diagnostics.png
88+
${count} = Count Diagnostics In Panel
89+
Should Be True ${count} >= 1
90+
Close Diagnostics Panel
10991

11092
Editor Should Jump To Definition
11193
[Arguments] ${symbol}
@@ -130,20 +112,19 @@ Measure Cursor Position
130112
${position} = Wait Until Keyword Succeeds 20 x 0.05s Get Vertical Position ${CM CURSOR}
131113
[Return] ${position}
132114

133-
Wait For Dialog
134-
Wait Until Page Contains Element ${DIALOG WINDOW} timeout=180s
135-
136115
Open Context Menu Over
137116
[Arguments] ${sel}
138-
Mouse Over ${sel}
139-
Sleep 10s
140-
Mouse Over ${sel}
117+
Wait Until Keyword Succeeds 10 x 0.1 s Mouse Over ${sel}
141118
Wait Until Keyword Succeeds 10 x 0.1 s Click Element ${sel}
142119
Wait Until Keyword Succeeds 10 x 0.1 s Open Context Menu ${sel}
143120

121+
Get Editor Content
122+
${content} Execute JavaScript return document.querySelector('.CodeMirror').CodeMirror.getValue()
123+
[Return] ${content}
124+
144125
Editor Content Changed
145126
[Arguments] ${old_content}
146-
${new_content} Execute JavaScript return document.querySelector('.CodeMirror').CodeMirror.getValue()
127+
${new_content} Get Editor Content
147128
Should Not Be Equal ${old_content} ${new_content}
148129
[Return] ${new_content}
149130

@@ -152,18 +133,14 @@ Editor Should Rename
152133
Set Tags feature:rename
153134
${sel} = Set Variable If "${symbol}".startswith(("xpath", "css")) ${symbol} xpath:(//span[@role="presentation"][contains(., "${symbol}")])[last()]
154135
Open Context Menu Over ${sel}
155-
${old_content} Execute JavaScript return document.querySelector('.CodeMirror').CodeMirror.getValue()
136+
${old_content} Get Editor Content
156137
Capture Page Screenshot 03-rename-0.png
157138
Mouse Over ${MENU RENAME}
158139
Capture Page Screenshot 03-rename-1.png
159140
Click Element ${MENU RENAME}
160-
Wait For Dialog
161-
Click Element ${DIALOG INPUT}
162-
Capture Page Screenshot 03-rename-3.png
163-
Input Text ${DIALOG INPUT} new_name
164-
Capture Page Screenshot 03-rename-4.png
165-
Click Element css:button.jp-Dialog-button.jp-mod-accept
141+
Capture Page Screenshot 03-rename-2.png
142+
Input Into Dialog new_name
166143
Sleep 2s
167-
Capture Page Screenshot 03-rename-5.png
144+
Capture Page Screenshot 03-rename-3.png
168145
${new_content} Wait Until Keyword Succeeds 10 x 0.1 s Editor Content Changed ${old_content}
169146
Should Be True "new_name" in """${new_content}"""

atest/03_Notebook.robot

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
*** Settings ***
2+
Suite Setup Setup Suite For Screenshots notebook
3+
Resource Keywords.robot
4+
5+
*** Test Cases ***
6+
Python
7+
[Setup] Reset Application State
8+
Setup Notebook Python Python.ipynb
9+
Capture Page Screenshot 01-python.png
10+
${diagnostic} = Set Variable W291 trailing whitespace (pycodestyle)
11+
Wait Until Page Contains Element css:.cm-lsp-diagnostic[title="${diagnostic}"] timeout=20s
12+
Capture Page Screenshot 02-python.png
13+
Clean Up After Working With File Python.ipynb
14+
15+
Foregin Extractors
16+
[Setup] Reset Application State
17+
Setup Notebook Python Foreign extractors.ipynb
18+
@{diagnostics} = Create List Failed to parse expression undefined name 'valid' (pyflakes) Trailing whitespace is superfluous. (lintr)
19+
FOR ${diagnostic} IN @{diagnostics}
20+
Wait Until Page Contains Element css:.cm-lsp-diagnostic[title="${diagnostic}"] timeout=30s
21+
Capture Page Screenshot 0x-${diagnostic}.png
22+
END
23+
Clean Up After Working With File Foreign Extractors.ipynb
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
*** Settings ***
2+
Suite Setup Setup Suite For Screenshots diagnostics_panel
3+
Resource ../Keywords.robot
4+
5+
*** Variables ***
6+
${EXPECTED_COUNT} 1
7+
${DIAGNOSTIC} W291 trailing whitespace (pycodestyle)
8+
9+
*** Test Cases ***
10+
Diagnostics Panel Opens
11+
[Setup] Gently Reset Workspace
12+
Open Notebook And Panel Panel.ipynb
13+
Capture Page Screenshot 03-panel-opens.png
14+
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count
15+
[Teardown] Clean Up After Working With File Panel.ipynb
16+
17+
Diagnostics Panel Works After Rename
18+
[Documentation] Test for #141 bug (diagnostics were not cleared after rename)
19+
[Setup] Gently Reset Workspace
20+
Open Notebook And Panel Panel.ipynb
21+
Rename Jupyter File Panel.ipynb PanelRenamed.ipynb
22+
Close Diagnostics Panel
23+
Wait Until Page Contains Element css:.cm-lsp-diagnostic[title*="${DIAGNOSTIC}"] timeout=20s
24+
Capture Page Screenshot 00-panel-rename.png
25+
Open Diagnostics Panel
26+
Capture Page Screenshot 01-panel-rename.png
27+
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count
28+
Clean Up After Working With File PanelRenamed.ipynb
29+
[Teardown] Clean Up After Working With File Panel.ipynb
30+
31+
Diagnostics Panel Can Be Restored
32+
[Setup] Gently Reset Workspace
33+
Open Notebook And Panel Panel.ipynb
34+
Close Diagnostics Panel
35+
Open Diagnostics Panel
36+
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count
37+
[Teardown] Clean Up After Working With File Panel.ipynb
38+
39+
*** Keywords ***
40+
Gently Reset Workspace
41+
Lab Command Close All Tabs
42+
43+
Open Notebook And Panel
44+
[Arguments] ${notebook}
45+
Setup Notebook Python ${notebook}
46+
Capture Page Screenshot 00-notebook-and-panel-openeing.png
47+
Wait Until Page Contains Element css:.cm-lsp-diagnostic[title*="${DIAGNOSTIC}"] timeout=20s
48+
Open Diagnostics Panel
49+
Capture Page Screenshot 00-notebook-and-panel-opened.png
50+
51+
Should Have Expected Rows Count
52+
${count} = Count Diagnostics In Panel
53+
Should Be True ${count} == ${EXPECTED_COUNT}

atest/04_Interface/Statusbar.robot

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
*** Settings ***
2+
Suite Setup Setup Suite For Screenshots statusbar
3+
Resource ../Keywords.robot
4+
5+
*** Variables ***
6+
${STATUSBAR} css:div.lsp-statusbar-item
7+
${DIAGNOSTIC} W291 trailing whitespace (pycodestyle)
8+
${POPOVER} css:.lsp-popover
9+
10+
*** Test Cases ***
11+
Statusbar Popup Opens
12+
Setup Notebook Python Python.ipynb
13+
Wait Until Page Contains Element css:.cm-lsp-diagnostic[title*="${DIAGNOSTIC}"] timeout=20s
14+
Element Should Contain ${STATUSBAR} Fully initialized
15+
Click Element ${STATUSBAR}
16+
Wait Until Page Contains Element ${POPOVER} timeout=10s
17+
Capture Page Screenshot 01-statusbar.png
18+
Element Should Contain ${POPOVER} python
19+
Element Should Contain ${POPOVER} initialized

atest/05_Features/Completion.robot

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
*** Settings ***
2+
Suite Setup Setup Suite For Screenshots completion
3+
Resource ../Keywords.robot
4+
5+
*** Variables ***
6+
${STATUSBAR} css:div.lsp-statusbar-item
7+
${COMPLETER_BOX} css:.jp-Completer.jp-HoverBox
8+
9+
*** Test Cases ***
10+
Works With Kernel Running
11+
[Documentation] The suggestions from kernel and LSP should get integrated.
12+
Setup Notebook Python Completion.ipynb
13+
Wait Until Element Contains ${STATUSBAR} Fully initialized timeout=20s
14+
Enter Cell Editor 1 line=2
15+
Capture Page Screenshot 01-entered-cell.png
16+
Trigger Completer
17+
Capture Page Screenshot 02-completions-shown.png
18+
# lowercase and uppercase suggestions:
19+
Completer Should Suggest TabError
20+
# this comes from LSP:
21+
Completer Should Suggest test
22+
# this comes from kernel
23+
Completer Should Suggest %%timeit
24+
Press Keys None ENTER
25+
Capture Page Screenshot 03-completion-confirmed.png
26+
${content} = Get Cell Editor Content 1
27+
Should Contain ${content} TabError
28+
[Teardown] Clean Up After Working With File Completion.ipynb
29+
30+
Works When Kernel Is Shut Down
31+
Setup Notebook Python Completion.ipynb
32+
Lab Command Shut Down All Kernels…
33+
Capture Page Screenshot 01-shutting-kernels.png
34+
Accept Default Dialog Option
35+
Capture Page Screenshot 02-kernels-shut.png
36+
Enter Cell Editor 1 line=2
37+
Trigger Completer
38+
Capture Page Screenshot 03-completions-shown.png
39+
# this comes from LSP:
40+
Completer Should Suggest test
41+
# this comes from kernel:
42+
Completer Should Not Suggest %%timeit
43+
[Teardown] Clean Up After Working With File Completion.ipynb
44+
45+
Autocompletes If Only One Option
46+
Setup Notebook Python Completion.ipynb
47+
Enter Cell Editor 3 line=1
48+
Press Keys None cle
49+
Press Keys None TAB
50+
Wait Until Keyword Succeeds 20x 0.5s Cell Editor Should Equal 3 list.clear
51+
[Teardown] Clean Up After Working With File Completion.ipynb
52+
53+
*** Keywords ***
54+
Enter Cell Editor
55+
[Arguments] ${cell_nr} ${line}=1
56+
Click Element css:.jp-CodeCell:nth-child(${cell_nr}) .CodeMirror-line:nth-child(${line})
57+
Wait Until Page Contains Element css:.jp-CodeCell:nth-child(${cell_nr}) .CodeMirror-focused
58+
59+
Get Cell Editor Content
60+
[Arguments] ${cell_nr}
61+
${content} Execute JavaScript return document.querySelector('.jp-CodeCell:nth-child(${cell_nr}) .CodeMirror').CodeMirror.getValue()
62+
[Return] ${content}
63+
64+
Cell Editor Should Equal
65+
[Arguments] ${cell} ${value}
66+
${content} = Get Cell Editor Content ${cell}
67+
Should Be Equal ${content} ${value}
68+
69+
Completer Should Suggest
70+
[Arguments] ${text}
71+
Page Should Contain Element ${COMPLETER_BOX} .jp-Completer-item[data-value="${text}"]
72+
73+
Completer Should Not Suggest
74+
[Arguments] ${text}
75+
Page Should Not Contain Element ${COMPLETER_BOX} .jp-Completer-item[data-value="${text}"]
76+
77+
Trigger Completer
78+
Press Keys None TAB
79+
Wait Until Page Contains Element ${COMPLETER_BOX} timeout=6s

atest/Keywords.robot

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,64 @@ Open With JupyterLab Menu
126126
FOR ${submenu} IN @{submenus}
127127
Click JupyterLab Menu Item ${submenu}
128128
END
129+
130+
Ensure File Browser is Open
131+
${sel} = Set Variable css:.p-TabBar-tab[data-id="filebrowser"]:not(.p-mod-current)
132+
${els} = Get WebElements ${sel}
133+
Run Keyword If ${els.__len__()} Click Element ${sel}
134+
135+
Rename Jupyter File
136+
[Arguments] ${old} ${new}
137+
Ensure File Browser is Open
138+
Click Element css:button[title="Refresh File List"]
139+
Open Context Menu //span[@class='jp-DirListing-itemText']\[text() = '${old}']
140+
Mouse Over ${MENU RENAME}
141+
Click Element ${MENU RENAME}
142+
Press Keys None CTRL+a
143+
Press Keys None ${new}
144+
Press Keys None RETURN
145+
146+
Input Into Dialog
147+
[Arguments] ${text}
148+
Wait For Dialog
149+
Click Element ${DIALOG INPUT}
150+
Input Text ${DIALOG INPUT} ${text}
151+
Click Element ${DIALOG ACCEPT}
152+
153+
Open ${file} in ${editor}
154+
Ensure File Browser is Open
155+
Click Element css:button[title="Refresh File List"]
156+
Open Context Menu css:.jp-DirListing-item[title="${file}"]
157+
Mouse Over ${MENU OPEN WITH}
158+
Wait Until Page Contains Element ${editor}
159+
Mouse Over ${editor}
160+
Click Element ${editor}
161+
162+
Clean Up After Working With File
163+
[Arguments] ${file}
164+
Remove File ${OUTPUT DIR}${/}home${/}${file}
165+
Reset Application State
166+
167+
Setup Notebook
168+
[Arguments] ${Language} ${file}
169+
Set Tags language:${Language.lower()}
170+
Set Screenshot Directory ${OUTPUT DIR}${/}screenshots${/}notebook${/}${file.lower()}
171+
Copy File examples${/}${file} ${OUTPUT DIR}${/}home${/}${file}
172+
Lab Command Close All Tabs
173+
Open ${file} in ${MENU NOTEBOOK}
174+
Capture Page Screenshot 00-opened.png
175+
176+
Open Diagnostics Panel
177+
Lab Command Show Diagnostics Panel
178+
Wait Until Page Contains Element ${DIAGNOSTICS PANEL} timeout=20s
179+
180+
Count Diagnostics In Panel
181+
${count} = Get Element Count css:.lsp-diagnostics-listing tbody tr
182+
[Return] ${count}
183+
184+
Close Diagnostics Panel
185+
Mouse Over ${DIAGNOSTIC PANEL CLOSE}
186+
Click Element ${DIAGNOSTIC PANEL CLOSE}
187+
188+
Wait For Dialog
189+
Wait Until Page Contains Element ${DIALOG WINDOW} timeout=180s

0 commit comments

Comments
 (0)