Skip to content

Commit ce18086

Browse files
authored
Merge branch 'krassowski:master' into master
2 parents b76b05e + bba7fd1 commit ce18086

File tree

44 files changed

+765
-118
lines changed

Some content is hidden

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

44 files changed

+765
-118
lines changed

.github/workflows/job.test.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ jobs:
185185
python setup.py sdist bdist_wheel
186186
cd ../jupyterlab_lsp
187187
python setup.py sdist bdist_wheel
188+
cd ../klingon_ls_specification
189+
python setup.py sdist bdist_wheel
188190
189191
- name: Collect distributions
190192
run: |
@@ -298,8 +300,13 @@ jobs:
298300
- name: Install python packages
299301
run: python -m pip install --find-links=dist --no-index --ignore-installed --no-deps jupyter_lsp jupyterlab_lsp
300302

303+
- name: Install Klingon file type extension and server specification (for testing languages without language servers)
304+
run: python -m pip install --find-links=dist --no-index --ignore-installed --no-deps klingon_ls_specification
305+
301306
- name: Pip check
302-
run: python -m pip check
307+
run: |
308+
python -m pip check
309+
python -m pip list | grep -ie klingon-ls-specification
303310
304311
- name: List server extensions
305312
run: |
@@ -312,7 +319,10 @@ jobs:
312319
jupyter serverextension list 2>&1 | grep -ie "jupyter_lsp.*enabled" -
313320
314321
- name: List frontend extensions
315-
run: jupyter labextension list
322+
run: |
323+
jupyter labextension list
324+
jupyter labextension list 2>&1 | grep -ie "jupyterlab-lsp.*enabled" -
325+
jupyter labextension list 2>&1 | grep -ie "jupyterlab-lsp-klingon-integration.*enabled" -
316326
317327
- name: install node-based language servers
318328
if: steps.cache-node-modules.outputs.cache-hit != 'true'

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
## Changelog
22

3-
### `@krassowski/jupyterlab-lsp 3.7.1` (unreleased)
3+
### `@krassowski/jupyterlab-lsp 3.8.0` (2021-07-04)
44

55
- improvements:
66

77
- add a note on manually enabling backend extension ([#621], thanks @icankeep)
8+
- in-app troubleshooting/installation help is now offered for servers which are needed but could not be detected
9+
(if auto-detection specification for those is present) ([#634])
810

911
- bug fixes:
1012
- fix rename shortcut registration in file editor ([#614])
@@ -15,6 +17,26 @@
1517
[#621]: https://github.com/krassowski/jupyterlab-lsp/pull/621
1618
[#625]: https://github.com/krassowski/jupyterlab-lsp/pull/625
1719
[#630]: https://github.com/krassowski/jupyterlab-lsp/pull/630
20+
[#634]: https://github.com/krassowski/jupyterlab-lsp/pull/634
21+
22+
### `jupyter-lsp 1.4.0` (2021-07-04)
23+
24+
- features:
25+
26+
- `troubleshoot` property was added to the language server spec, allowing to describe auto-detection troubleshooting
27+
([#634])
28+
- new endpoint `specs` will list all language server specifications known to `jupyter-lsp` allowing frontends
29+
to suggest installation of specific language servers ([#634])
30+
31+
- changes:
32+
- `ShellSpec.is_installed()` signature changed; it now accepts the `LanguageServerManagerAPI` rather than the resolved
33+
command location (of `str` type); the specs using only `is_installed_args` are not affected; as this method was only
34+
used by internally by the `__call__` implementation (which was adjusted accordingly) this change should not break
35+
existing specs unless any of these methods were overridden in sub-classes.
36+
- `SpecBase` was moved to `types.py`; it can still be imported from `utils`, but doing so is discouraged
37+
- `ShellSpec.solve()` was added to facilitate discovery of command location
38+
39+
[#634]: https://github.com/krassowski/jupyterlab-lsp/pull/634
1840

1941
### `jupyter-lsp 1.3.0` (2021-06-02)
2042

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ to JupyterLab for development:
8484
```bash
8585
jlpm bootstrap
8686
# if you installed `jupyterlab_lsp` before uninstall it before running the next line
87-
jupyter labextension develop python_packages/jupyterlab_lsp/ --overwrite
87+
jupyter labextension develop python_packages/jupyterlab_lsp/jupyterlab_lsp/ --overwrite
88+
# optional, only needed for running a few tests for behaviour with missing language servers
89+
jupyter labextension develop python_packages/klingon_ls_specification/ --overwrite
8890
```
8991

9092
> Note: on Windows you may need to enable Developer Mode first, as discussed in [jupyterlab#9564](https://github.com/jupyterlab/jupyterlab/issues/9564)

atest/04_Interface/Statusbar.robot

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Resource ../Keywords.robot
66
${STATUSBAR} css:div.lsp-statusbar-item
77
${DIAGNOSTIC} W291 trailing whitespace (pycodestyle)
88
${POPOVER} css:.lsp-popover
9+
${HELP_BUTTON} css:.lsp-popover .lsp-help-button
910

1011
*** Test Cases ***
1112
Statusbar Popup Opens
@@ -19,6 +20,29 @@ Statusbar Popup Opens
1920
Element Should Contain ${POPOVER} initialized
2021
[Teardown] Clean Up After Working With File Python.ipynb
2122

23+
Troubleshooting And Help Is Offered For Known Non-Installed Servers
24+
[Documentation] When specification of a language server has been configured or provided, but the server is not installed (or detected) the user should get help on installation and/or troubleshooting
25+
Prepare File for Editing Python status example.klingon
26+
Wait Until Element Contains ${STATUSBAR} Initialized (additional servers needed) timeout=60s
27+
Click Element ${STATUSBAR}
28+
Wait Until Page Contains Element ${POPOVER} timeout=10s
29+
Page Should Contain Element ${HELP_BUTTON}
30+
# sanity check
31+
Page Should Not Contain run-klingon-language-server not found.
32+
Click Element ${HELP_BUTTON}
33+
Wait For Dialog
34+
# info message should get generated
35+
Page Should Contain There is 1 language server you can easily install that supports klingon.
36+
# provided links should be shown
37+
Page Should Contain https://en.wikipedia.org/wiki/Klingon_language
38+
# automated shellspec troubleshooting should get generates
39+
Page Should Contain run-klingon-language-server not found.
40+
# specification-provided troubeshooting should be shown too
41+
Page Should Contain This is just a test language server.
42+
# installation command should be shown
43+
Page Should Contain echo "This language server cannot be installed."
44+
[Teardown] Clean Up After Working With File example.klingon
45+
2246
Status Changes Between Notebooks
2347
Setup Notebook Python Python.ipynb
2448
Wait Until Fully Initialized

atest/Keywords.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ Open JupyterLab
113113
Set Environment Variable MOZ_HEADLESS ${HEADLESS}
114114
${firefox} = Get Firefox Binary
115115
${geckodriver} = Which geckodriver
116+
Should Not Be Equal As Strings ${geckodriver} None geckodriver not found, do you need to install firefox-geckodriver?
116117
${service args} = Create List --log debug
117118
Create WebDriver Firefox
118119
... executable_path=${geckodriver}

atest/examples/example.ancient_klingon

Whitespace-only changes.

atest/examples/example.klingon

Whitespace-only changes.

binder/environment.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ dependencies:
1616
- flake8 >=3.5
1717
- pip
1818
- pylint
19-
- pyls-black
20-
- pyls-isort
21-
- pyls-mypy
19+
# pyls-black was not migrated to pylsp yet
20+
# - pyls-black
21+
# pyls-isort already migrated to pylsp but there is no point enabling
22+
# it right now as we do not support actions support yet (PRs welcome)
23+
# - pyls-isort
24+
- pylsp-mypy
2225
- python-lsp-server
2326
- ruamel_yaml
2427
# for R language server and kernel

docs/Configuring.ipynb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@
7474
" element of [kernel_info][] response (with fallback on to cell metadata if\n",
7575
" missing from kernel response)\n",
7676
" - for files the implementation is frontend-specific; in JupyterLab the MIME\n",
77-
" type is obtained from the MIME type registry.\n",
77+
" type is obtained from: a) the code editor MIME type registry, which is by\n",
78+
" default using the CodeMirror mode as for JupyterLab 3.x, or if no specific\n",
79+
" MIME type is found there, then b) from the `DocumentRegistry` file type by\n",
80+
" matching the `contentsModel` against the registered file types using\n",
81+
" `getFileTypeForModel()` method (if multiple MIME types are present, the\n",
82+
" first one will be used).\n",
7883
"\n",
7984
"```python\n",
8085
"# ./jupyter_server_config.json ---------- unique! -----------\n",
@@ -315,7 +320,7 @@
315320
],
316321
"metadata": {
317322
"kernelspec": {
318-
"display_name": "Python 3",
323+
"display_name": "Python 3 (ipykernel)",
319324
"language": "python",
320325
"name": "python3"
321326
},

docs/Language Servers.ipynb

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
" \"jedi-language-server\",\n",
161161
"]\n",
162162
"lang_server_table(\n",
163-
" {key: spec for key, spec in mgr.language_servers.items() if key in nb_langs}\n",
163+
" {key: spec for key, spec in mgr.all_language_servers.items() if key in nb_langs}\n",
164164
")"
165165
]
166166
},
@@ -206,7 +206,7 @@
206206
"lang_server_table(\n",
207207
" {\n",
208208
" key: spec\n",
209-
" for key, spec in mgr.language_servers.items()\n",
209+
" for key, spec in mgr.all_language_servers.items()\n",
210210
" if \"npm\" in spec[\"install\"]\n",
211211
" }\n",
212212
")"
@@ -287,7 +287,7 @@
287287
"source": [
288288
"sci_langs = [\"texlab\"]\n",
289289
"lang_server_table(\n",
290-
" {key: spec for key, spec in mgr.language_servers.items() if key in sci_langs}\n",
290+
" {key: spec for key, spec in mgr.all_language_servers.items() if key in sci_langs}\n",
291291
")"
292292
]
293293
},
@@ -309,11 +309,53 @@
309309
" reference navigation\n",
310310
"- `chktex`, a `.tex` style checker"
311311
]
312+
},
313+
{
314+
"cell_type": "markdown",
315+
"metadata": {},
316+
"source": [
317+
"### Troubleshooting"
318+
]
319+
},
320+
{
321+
"cell_type": "code",
322+
"execution_count": null,
323+
"metadata": {
324+
"tags": [
325+
"remove-input",
326+
"wide-table"
327+
]
328+
},
329+
"outputs": [],
330+
"source": [
331+
"troubleshooting_data = {\n",
332+
" key: spec\n",
333+
" for key, spec in mgr.all_language_servers.items()\n",
334+
" if (\n",
335+
" \"troubleshoot\" in spec\n",
336+
" # ignore trivial Node.js advice if only this is present\n",
337+
" and spec[\"troubleshoot\"] != \"Node.js is required to install this server.\"\n",
338+
" # ignore trivial shell advice if only this is present\n",
339+
" and spec[\"troubleshoot\"] != f\"{spec['argv'][0]} not found.\"\n",
340+
" )\n",
341+
"}\n",
342+
"\n",
343+
"IPython.display.HTML(\n",
344+
" Template(\n",
345+
" \"\"\"\n",
346+
" {% for key, spec in specs.items() %}\n",
347+
" <h4>{{ key }}</h4>\n",
348+
" <p style=\"white-space: pre-wrap\">{{ spec.troubleshoot }}</p>\n",
349+
" {% endfor %}\n",
350+
" \"\"\"\n",
351+
" ).render(specs=troubleshooting_data)\n",
352+
")"
353+
]
312354
}
313355
],
314356
"metadata": {
315357
"kernelspec": {
316-
"display_name": "Python 3",
358+
"display_name": "Python 3 (ipykernel)",
317359
"language": "python",
318360
"name": "python3"
319361
},

0 commit comments

Comments
 (0)