Skip to content

Commit 22f5dbd

Browse files
authored
Merge pull request #2 from krassowski/master
Update Master
2 parents 0ca4164 + 76f59d5 commit 22f5dbd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1095
-403
lines changed

.github/workflows/job.test.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,16 @@ jobs:
214214
include:
215215
# if using 3.6, use an old node
216216
- python: 3.6
217-
# Node 10 end-of-life: April 2021
218-
nodejs: '>=10,<11.0.0.a0'
219-
# if using 3.7, use newer node, etc...
220-
- python: 3.7
221217
# Node 12 end-of-life: April 2022
222218
nodejs: '>=12,<13.0.0.a0'
223-
- python: 3.8
219+
# if using 3.7, use newer node, etc...
220+
- python: 3.7
224221
# Node 14 end-of-life: April 2023
225222
nodejs: '>=14,<15.0.0.a0'
223+
- python: 3.8
224+
# TODO: switch to Node 16 once gets merged https://github.com/conda-forge/nodejs-feedstock/pull/189
225+
# Node 15 end-of-life: June 2021
226+
nodejs: '>=15,<16.0.0.a0'
226227
# TODO: remove when mambaforge just works on setup-miniconda
227228
- os: ubuntu
228229
mambaforge: Linux-x86_64.sh

CHANGELOG.md

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,45 @@
1-
## CHANGELOG
1+
## Changelog
22

3-
### `@krassowski/jupyterlab-lsp 3.5.1` (unreleased)
3+
### `@krassowski/jupyterlab-lsp 3.7.0` (unreleased)
4+
5+
- features:
6+
7+
- add ability to deactivate Kernel completions or LSP completion through the settings ([#586], thanks @Carreau)
8+
- allow to set a priority for LSP server, allowing to choose which server to use when multiple servers are installed ([#588])
9+
- add auto-detection of pyright server ([#587], thanks @yuntan)
10+
11+
- bug fixes:
12+
13+
- workaround url-parse issue causing problems when using JupyterLab 3.0.15 ([#599])
14+
15+
- other changes:
16+
- drop Node 10 (EOL 2 weeks ago) testing on CI, add Node 15 ([#587])
17+
18+
[#586]: https://github.com/krassowski/jupyterlab-lsp/pull/586
19+
[#587]: https://github.com/krassowski/jupyterlab-lsp/pull/587
20+
[#588]: https://github.com/krassowski/jupyterlab-lsp/pull/588
21+
[#599]: https://github.com/krassowski/jupyterlab-lsp/pull/599
22+
23+
### `jupyter-lsp 1.2.0` (2021-04-26)
24+
25+
- features:
26+
27+
- add support for python-lsp-server, a community fork of pyls ([#584] and [#582], thanks @maresb)
28+
29+
- bug fixes:
30+
- fix encoding on Windows for non-conda installs ([#580], thanks @stonebig)
31+
32+
[#580]: https://github.com/krassowski/jupyterlab-lsp/pull/580
33+
[#582]: https://github.com/krassowski/jupyterlab-lsp/pull/582
34+
[#584]: https://github.com/krassowski/jupyterlab-lsp/pull/584
35+
36+
### `@krassowski/code-jumpers 1.1.0` (2021-04-26)
37+
38+
- features:
39+
40+
- added translation support ([#557], thanks @JessicaBarh)
41+
42+
### `@krassowski/jupyterlab-lsp 3.6.0` (2021-04-26)
443

544
- features:
645

@@ -15,7 +54,7 @@
1554
[#570]: https://github.com/krassowski/jupyterlab-lsp/pull/570
1655
[#576]: https://github.com/krassowski/jupyterlab-lsp/pull/576
1756

18-
### `@krassowski/jupyterlab-lsp 3.5.0` (2020-03-22)
57+
### `@krassowski/jupyterlab-lsp 3.5.0` (2021-03-22)
1958

2059
- features:
2160

@@ -42,7 +81,7 @@
4281
[#560]: https://github.com/krassowski/jupyterlab-lsp/pull/560
4382
[#562]: https://github.com/krassowski/jupyterlab-lsp/pull/562
4483

45-
### `jupyter-lsp 1.1.4` (2020-02-21)
84+
### `jupyter-lsp 1.1.4` (2021-02-21)
4685

4786
- bug fixes:
4887

@@ -53,15 +92,15 @@
5392

5493
[#535]: https://github.com/krassowski/jupyterlab-lsp/pull/535
5594

56-
### `@krassowski/jupyterlab-lsp 3.4.1` (2020-02-16)
95+
### `@krassowski/jupyterlab-lsp 3.4.1` (2021-02-16)
5796

5897
- bug fixes:
5998

6099
- fixed installation of the source version of the extension (causing build error if classic was not installed) ([#526])
61100

62101
[#526]: https://github.com/krassowski/jupyterlab-lsp/pull/526
63102

64-
### `@krassowski/jupyterlab-lsp 3.4.0` (2020-02-14)
103+
### `@krassowski/jupyterlab-lsp 3.4.0` (2021-02-14)
65104

66105
- features:
67106

@@ -86,7 +125,7 @@
86125
[#523]: https://github.com/krassowski/jupyterlab-lsp/pull/523
87126
[#524]: https://github.com/krassowski/jupyterlab-lsp/pull/524
88127

89-
### `@krassowski/jupyterlab-lsp 3.3.1` (2020-02-07)
128+
### `@krassowski/jupyterlab-lsp 3.3.1` (2021-02-07)
90129

91130
- bug fixes:
92131

CONTRIBUTING.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Contribute to jupyterlab-lsp and jupyter-lsp :heart:
1+
## Contributing
22

33
`jupyter-lsp` and `jupyterlab-lsp` are [open source][license] software, and
44
all contributions conforming to good sense, good taste, and the
@@ -19,9 +19,11 @@ You can contribute to the project through:
1919
- improving testing
2020
- reviewing pull requests
2121

22+
Thank you for all your contributions :heart:
23+
2224
[license]: https://github.com/krassowski/jupyterlab-lsp/blob/master/LICENSE
23-
[extending]: ./docs/Extending.ipynb
24-
[roadmap]: ./docs/Roadmap.ipynb
25+
[extending]: ./docs/Extending.html
26+
[roadmap]: ./docs/Roadmap.html
2527
[jupyterlab-lsp]: https://github.com/krassowski/jupyterlab-lsp.git
2628
[code-of-conduct]: https://github.com/jupyter/governance/blob/master/conduct/code_of_conduct.md
2729

@@ -328,7 +330,7 @@ python scripts/lint.py
328330

329331
### Specs
330332

331-
While language servers can be configured by the user using a simple JSON or Python [configuration file](./Configuring.ipynb#language_servers),
333+
While language servers can be configured by the user using a simple JSON or Python [configuration file](./Configuring.html#language-servers),
332334
it is preferable to provide users with an option that does not require manual configuration. The language server specifications (specs)
333335
wrap the configuration (as would be defined by the user) into a Python class or function that can be either:
334336

@@ -357,7 +359,7 @@ A spec is a Python callable (a function, or a class with `__call__` method) that
357359

358360
The above example is only intended as an illustration and not as an up-to-date guide.
359361
For details on the dictionary contents, see the [schema][] definition and [built-in specs][].
360-
Basic concepts (meaning of the `argv` and `languages` arguments) are also explained in the [configuration files](./Configuring.ipynb#language_servers) documentation.
362+
Basic concepts (meaning of the `argv` and `languages` arguments) are also explained in the [configuration files](./Configuring.html#language-servers) documentation.
361363

362364
When contributing a specification we recommend to make use of the helper classes and other [utilities][] that take care of the common use-cases:
363365

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
> _This project is still maturing, but you are welcome to check it out, leave feedback and/or a PR_
88
9-
Quick Links: **[Installation](#installation) | [Configuring](./docs/Configuring.ipynb) | [Updating](#updating) | [Changelog](./CHANGELOG.md) | [Roadmap](./docs/Roadmap.ipynb) | [Contributing](./CONTRIBUTING.md) | [Extending](./docs/Extending.ipynb)**
9+
Quick Links: **[Installation](#installation) | [Configuring](./docs/Configuring.ipynb) | [Changelog](./CHANGELOG.md) | [Roadmap](./docs/Roadmap.ipynb) | [Contributing](./CONTRIBUTING.md) | [Extending](./docs/Extending.ipynb)**
1010

1111
## Features
1212

@@ -66,6 +66,10 @@ from the Language Server (in notebook).
6666
If the kernel is too slow to respond promptly only the Language Server suggestions will be shown (default threshold: 0.6s).
6767
You can configure the completer to not attempt to fetch the kernel completions if the kernel is busy (skipping the 0.6s timeout).
6868

69+
You can deactivate the kernel suggestions by adding `"Kernel"` to the `disableCompletionsFrom` in the `completion` section
70+
of _Advanced Settings_. Alternatively if you _only_ want kernel completions you can add `"LSP"` to the same
71+
setting; Or add both if you like to code in hardcore mode and get no completions, or if another provider has been added.
72+
6973
### Rename
7074

7175
Rename variables, functions and more, in both: notebooks and the file editor.
@@ -119,19 +123,19 @@ Use of a python `virtualenv` or a conda env is also recommended.
119123
> or `jupyter-lsp-r` to install both the server extension and the language server.
120124
121125
1. install LSP servers for languages of your choice; for example, for Python
122-
([pyls](https://github.com/palantir/python-language-server)) and
126+
([pylsp](https://github.com/python-lsp/python-lsp-server)) and
123127
R ([languageserver](https://github.com/REditorSupport/languageserver)) servers:
124128

125129
```bash
126130
# note: you may want to use our fork of python-language-server instead (see below)
127-
pip install 'python-language-server[all]'
131+
pip install 'python-lsp-server[all]'
128132
R -e 'install.packages("languageserver")'
129133
```
130134

131135
or from `conda-forge`
132136

133137
```bash
134-
conda install -c conda-forge python-language-server r-languageserver
138+
conda install -c conda-forge python-lsp-server r-languageserver
135139
```
136140

137141
Please see our full list of
@@ -188,6 +192,8 @@ Use of a python `virtualenv` or a conda env is also recommended.
188192

189193
Server configurations can be edited using the Advanced Settings editor in JupyterLab (_Settings > Advanced Settings Editor_). For settings specific to each server, please see the [table of language servers][language-servers]. Example settings might include:
190194

195+
> Note: for the new (currently recommended) python-lsp-server replace `pyls` occurrences with `pyslp`
196+
191197
```json
192198
{
193199
"language_servers": {

atest/01_Editor.robot

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ Less
4343
Markdown
4444
Editor Shows Features for Language Markdown example.md Diagnostics=`Color` is misspelt
4545

46-
Python
46+
Python (pylsp)
4747
${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'fib')])[last()]
48-
Editor Shows Features for Language Python example.py Diagnostics=multiple spaces after keyword Jump to Definition=${def} Rename=${def}
48+
Editor Shows Features for Server pylsp Python example.py Diagnostics=undefined name 'result' (pyflakes) Jump to Definition=${def} Rename=${def}
49+
50+
Python (pyright)
51+
${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'fib')])[last()]
52+
Editor Shows Features for Server pyright Python example.py Diagnostics=is not defined (Pyright) Jump to Definition=${def}
4953

5054
R
5155
${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'fib')])[last()]
@@ -70,6 +74,12 @@ YAML
7074
Editor Shows Features for Language YAML example.yaml Diagnostics=duplicate key
7175

7276
*** Keywords ***
77+
Editor Shows Features for Server
78+
[Arguments] ${server} ${Language} ${file} &{features}
79+
Configure JupyterLab Plugin
80+
... {"language_servers": {"${server}": {"priority": 10000}}}
81+
Editor Shows Features for Language ${Language} ${file} &{features}
82+
7383
Editor Shows Features for Language
7484
[Arguments] ${Language} ${file} &{features}
7585
Prepare File for Editing ${Language} editor ${file}

atest/03_Notebook.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Moving Cells Around
4747
Foreign Extractors
4848
${file} = Set Variable Foreign extractors.ipynb
4949
Configure JupyterLab Plugin
50-
... {"language_servers": {"texlab": {"serverSettings": {"latex.lint.onChange": true}}, "bash-langauge-server": {"bashIde.highlightParsingErrors": true}}}
50+
... {"language_servers": {"texlab": {"serverSettings": {"latex.lint.onChange": true}}, "bash-langauge-server": {"bashIde.highlightParsingErrors": true}}, "pylsp": {"priority": 1000}}
5151
Capture Page Screenshot 10-configured.png
5252
Reset Application State
5353
Setup Notebook Python ${file}

atest/05_Features/Completion.robot

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ Completion Works For Tokens Separated By Space
187187
Wait Until Keyword Succeeds 40x 0.5s Cell Editor Should Equal 13 from statistics import
188188

189189
Kernel And LSP Completions Merge Prefix Conflicts Are Resolved
190-
[Documentation] Reconciliate Python kernel returning prefixed completions and LSP (pyls) not-prefixed ones
190+
[Documentation] Reconciliate Python kernel returning prefixed completions and LSP (pylsp) not-prefixed ones
191191
Configure JupyterLab Plugin {"kernelResponseTimeout": -1, "waitForBusyKernel": false} plugin id=${COMPLETION PLUGIN ID}
192192
# For more details see: https://github.com/krassowski/jupyterlab-lsp/issues/30#issuecomment-576003987
193193
# `import os.pat<tab>` → `import os.pathsep`
@@ -267,7 +267,7 @@ Completes Correctly With R Double And Triple Colon
267267
Completer Should Suggest .print.via.format
268268
Select Completer Suggestion .print.via.format
269269
Wait Until Keyword Succeeds 40x 0.5s File Editor Line Should Equal 1 tools::.print.via.format
270-
# tripple colon
270+
# triple colon
271271
Place Cursor In File Editor At 4 11
272272
Trigger Completer
273273
Completer Should Suggest .packageName
@@ -289,6 +289,8 @@ Shows Documentation With CompletionItem Resolve
289289
Wait Until Fully Initialized
290290
Trigger Completer
291291
Completer Should Suggest print.data.frame
292+
# if data.frame is not active, activate it (it should be in top 10 on any platform)
293+
Activate Completer Suggestion print.data.frame max_steps_down=10
292294
Completer Should Include Documentation Print a data frame.
293295
# should remain visible after typing:
294296
Press Keys None efa
@@ -342,6 +344,21 @@ File Editor Line Should Equal
342344
${line} = Get Line ${content} ${line}
343345
Should Be Equal ${line} ${value}
344346

347+
Activate Completer Suggestion
348+
[Arguments] ${text} ${max_steps_down}=100
349+
${suggestion} = Set Variable css:.jp-Completer-item[data-value="${text}"]
350+
Wait Until Page Contains Element ${suggestion}
351+
${active_suggestion} = Set Variable css:.jp-mod-active.jp-Completer-item[data-value="${text}"]
352+
FOR ${i} IN RANGE ${max_steps_down}
353+
Capture Page Screenshot ${i}-completions.png
354+
${matching_active_elements} = Get Element Count ${active_suggestion}
355+
LOG ${matching_active_elements}
356+
Exit For Loop If ${matching_active_elements} == 1
357+
Press Keys None DOWN
358+
Sleep 0.1s
359+
END
360+
Wait Until Page Contains Element ${active_suggestion}
361+
345362
Select Completer Suggestion
346363
[Arguments] ${text}
347364
${suggestion} = Set Variable css:.jp-Completer-item[data-value="${text}"]

atest/07_Configuration.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Resource ./Keywords.robot
77
*** Test Cases ***
88
Python
99
[Documentation] pyflakes is enabled by default, but flake8 is not
10-
Settings Should Change Editor Diagnostics Python style.py pyls
11-
... {"pyls": {"plugins": {"flake8": {"enabled": true},"pyflakes": {"enabled": false}}}}
10+
Settings Should Change Editor Diagnostics Python style.py pylsp
11+
... {"pylsp": {"plugins": {"flake8": {"enabled": true},"pyflakes": {"enabled": false}}}}
1212
... undefined name 'foo' (pyflakes)
1313
... undefined name 'foo' (flake8)
1414

atest/Keywords.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ Configure JupyterLab Plugin
375375
Set Editor Content ${settings json} ${CSS USER SETTINGS}
376376
Wait Until Page Contains No errors found
377377
Click Element css:button[title\='Save User Settings']
378+
Wait Until Page Contains No errors found
378379
Click Element ${JLAB XP CLOSE SETTINGS}
379380

380381
Clean Up After Working with File and Settings

atest/Variables.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ ${JLAB XP CLOSE SETTINGS} ${JLAB XP DOCK TAB}\[contains(., 'Settings')]/*[con
5454
${CSS DIAGNOSTIC} css:.cm-lsp-diagnostic
5555
# log messages
5656
@{KNOWN BAD ERRORS}
57-
... pyls_jsonrpc.endpoint - Failed to handle notification
58-
... pyls_jsonrpc.endpoint - Failed to handle request
57+
... pylsp_jsonrpc.endpoint - Failed to handle notification
58+
... pylsp_jsonrpc.endpoint - Failed to handle request

0 commit comments

Comments
 (0)