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

JupyterLab 4.0 migration #949

Merged
merged 83 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
857b593
WIP JupyterLab 4.0 migration
krassowski Jun 18, 2023
81ca55f
More WIP (hover, rename, signature)
krassowski Jun 18, 2023
425df9c
More WIP
krassowski Jul 1, 2023
12ddee3
WIP jumpers
krassowski Jul 1, 2023
d299648
Add diagnostics WIP feature
krassowski Jul 1, 2023
d2bed30
WIP migrate code jumpers keybindings
krassowski Jul 2, 2023
1b50ce7
Migrate example extractor
krassowski Jul 2, 2023
c6fdefc
WIP completion, diagnostics, comment out others
krassowski Jul 2, 2023
3298679
Remove custom connection manager subclass, various fixes
krassowski Jul 2, 2023
b541f17
Fix eslint
krassowski Jul 2, 2023
2972037
Update yarn lock after restoring `npm-run-all`
krassowski Jul 2, 2023
94cfde9
Lint
krassowski Jul 2, 2023
274de85
Fix up hover
krassowski Jul 2, 2023
d2e960c
Set version range for 4.0
krassowski Jul 2, 2023
99def20
Remove option no longer supported by yarn
krassowski Jul 3, 2023
cfc00cd
Update yarn.lock
krassowski Jul 3, 2023
01f95e1
Implement tags, add document length guard, remove type cast
krassowski Jul 3, 2023
b13280c
Remove commented out code and correct optional tokens use
krassowski Jul 5, 2023
d5779ae
Work-in-progress on porting jump-to
krassowski Jul 5, 2023
0775874
Update types import after renaming settings (added `s`)
krassowski Jul 6, 2023
1fafc45
Fix `positionFromCoordinates`
krassowski Jul 6, 2023
8c64a96
Finish first pass on jump-to feature
krassowski Jul 6, 2023
57170ff
Fix position in local jump
krassowski Jul 6, 2023
79df8d7
Update yarn command for yarn 3
krassowski Jul 6, 2023
4f95e85
Update caching and versions
krassowski Jul 6, 2023
8fe2d88
Try with '.yarn/cache'
krassowski Jul 6, 2023
66aa65c
Switch to `portal:` protocol for metapackage setup to fix immutable
krassowski Jul 6, 2023
17b886c
Switch to workspaces after all cause lerna does not support portals
krassowski Jul 6, 2023
17423f4
Revert attempts to switch protocol as these break other things.
krassowski Jul 6, 2023
0fbc50d
Disable immutable installs for now
krassowski Jul 6, 2023
d4c8090
Update versions
krassowski Jul 6, 2023
5c2ffd6
Update lerna (we need 6.4.0 to fix CI)
krassowski Jul 6, 2023
ad4aadb
lerna 6.6 has similar issue, pinning 6.5; see:
krassowski Jul 6, 2023
bc723da
Drop `jest` from metapackage complier options
krassowski Jul 6, 2023
da7ab8f
Port highlights feature, improve hover, WIP syntax highlighting
krassowski Jul 8, 2023
78b3e70
Finish syntax highlighting port
krassowski Jul 8, 2023
cd962d7
Highlights: remove outdated comments, add micro benchmarking result
krassowski Jul 8, 2023
8b0795e
Fix focusing on editor, remove deprecated function
krassowski Jul 8, 2023
674d47e
Fix offsets in assembler
krassowski Jul 8, 2023
f283329
Fix redundant non-null assertion
krassowski Jul 8, 2023
15e4984
Fix diagnostics in notebook across cells, allow to enable gutter
krassowski Jul 8, 2023
837af5e
Fix floating promises
krassowski Jul 8, 2023
7295761
Port highlighting of code and current parameter in signature
krassowski Jul 8, 2023
cb19dec
Finish porting rename, expose diagnostics database via token
krassowski Jul 8, 2023
7322569
Rename file with `ContextAssembler` to reflect its new content
krassowski Jul 8, 2023
790d382
Harmonise completion items (override default providers)
krassowski Jul 8, 2023
7db712c
Restore LSP completions transformation,
krassowski Jul 8, 2023
5482fb7
Add new yarnrc, try skipLibCheck
krassowski Jul 9, 2023
9353e34
Remove yarn2 options
krassowski Jul 9, 2023
1523526
Remove interactive upgrade plugin
krassowski Jul 9, 2023
8543d64
Try again with workspaces, restores 7b886c84c4d62397a2aac14ebe69a95f2…
krassowski Jul 9, 2023
7065abb
Re-enable immutable installs (default)
krassowski Jul 9, 2023
a679f0e
Fix tests setup:
krassowski Jul 9, 2023
a08845c
Update version specifiers for JupyterLab and Python
krassowski Jul 9, 2023
17039bf
Upgrade to lab 4.0.3 removing which allows to remove most `ts-ignore`s
krassowski Jul 15, 2023
80a1704
Silence remaining `@ts-ignore`s in linting output for now
krassowski Jul 15, 2023
afef4bf
Fix statusbar status and popup:
krassowski Jul 15, 2023
7caea23
Fix version integrity
krassowski Jul 15, 2023
1f42235
Fix signature highlight when parameter is not given
krassowski Jul 30, 2023
4167c48
Restore tests for edits and renaming
krassowski Aug 16, 2023
a0c67cd
Port diagnostics test, delay promise evaluation by frame
krassowski Aug 16, 2023
809ad06
Finalise porting unit tests
krassowski Aug 20, 2023
a6b47ce
Stop testing `serverextension` since notebook v7 using jupyter-server…
krassowski Aug 20, 2023
2fe9d88
Update config for examples
krassowski Aug 20, 2023
228311a
Test smoke with node 18
krassowski Aug 20, 2023
f749246
Do not bail on test failure in a task
krassowski Aug 20, 2023
4a37d01
Partially fix settings rendering
krassowski Aug 21, 2023
5adf6b8
Pin selenium
krassowski Aug 21, 2023
cb75215
Restore support for theming diagnostics underlines (only colour)
krassowski Aug 21, 2023
4ce1feb
Start porting acceptance tests
krassowski Aug 21, 2023
85cc0ca
Bump required JupyterLab version to 4.0.5
krassowski Aug 24, 2023
827b78e
Update script bumping versions
krassowski Aug 24, 2023
29edf58
Restore auto-completion, not working yet due to missing context upstream
krassowski Aug 24, 2023
92ba7d8
Update completer model settings as needed, and advertise
krassowski Aug 25, 2023
e7c5f72
Bump version to 5.0.0-alpha.0
krassowski Aug 25, 2023
e1697da
Completer fixes, re-implement `disable` option
krassowski Aug 26, 2023
cc432c9
Rename branch
krassowski Aug 26, 2023
3013503
Ensure marks/diagnostics do not exceed editor length
krassowski Aug 26, 2023
f3f4cf5
Add missing await before accessing rename settings
krassowski Aug 26, 2023
5fc93f0
Fix infinite loop for standalone docs and logging after tests
krassowski Aug 26, 2023
d1873ac
Fix version spec in smoke test
krassowski Aug 26, 2023
27d11ec
Correct offset guard and add more guards for diagnostics
krassowski Aug 26, 2023
b0e8cab
More work on restoring acceptance tests
krassowski Aug 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: 'CodeQL'

on:
push:
branches: [master]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
branches: [main]
schedule:
- cron: '16 12 * * 4'

Expand Down
76 changes: 32 additions & 44 deletions .github/workflows/job.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name: CI
on:
push:
branches:
- master
- 2.x
- main
- 3.x
- 4.x
pull_request:
branches:
- master
- 2.x
- main
- 3.x
- 4.x
workflow_dispatch:

# TODO: might need to tweak `group`
Expand All @@ -30,7 +30,7 @@ env:

ATEST_PROCESSES: 2
ATEST_RETRIES: 3
JLPM_CMD: jlpm --ignore-optional --prefer-offline --frozen-lockfile
JLPM_CMD: jlpm install

# Increase this value to reset all caches
CACHE_EPOCH: 4
Expand All @@ -43,8 +43,8 @@ jobs:
strategy:
matrix:
os: [ubuntu]
nodejs: ['>=14,<15.0.0a0']
lab: ['>=3.6.0,<4.0.0a0']
nodejs: ['>=16,<17.0.0a0']
lab: ['>=4.0.5,<5.0.0a0']
r: ['>=4']
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
path: .yarn-packages
path: '.yarn/cache'
key: |
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
Expand All @@ -99,7 +99,7 @@ jobs:
run: jlpm build

- name: Run frontend unit tests
run: jlpm test
run: jlpm test --no-bail

- name: Lint backend
run: python scripts/lint.py
Expand All @@ -123,8 +123,8 @@ jobs:
strategy:
matrix:
os: [ubuntu]
nodejs: ['>=14,<15.0.0a0']
lab: ['>=3.6.0,<4.0.0a0']
nodejs: ['>=16,<17.0.0a0']
lab: ['>=4.0.0,<5.0.0a0']
r: ['>=4']
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
path: .yarn-packages
path: '.yarn/cache'
key: |
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
Expand Down Expand Up @@ -214,18 +214,18 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu', 'macos', 'windows']
python: ['3.8', '3.10']
python: ['3.8', '3.11']
include:
- python: '3.8'
# Node 16 end-of-life: April 2024
# Node 16 end-of-life: 2023-09-11
nodejs: '>=16,<17.0.0.a0'
r: '>=4'
lab: '>=3.6.0,<4'
- python: '3.10'
# Node 16 end-of-life: April 2024
nodejs: '>=16,<17.0.0.a0'
lab: '>=4,<5'
- python: '3.11'
# Node 18 end-of-life: 2025-04-30
nodejs: '>=18,<19.0.0.a0'
r: '>=4'
lab: '>=3.6.0,<4'
lab: '>=4,<5'

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -264,7 +264,7 @@ jobs:
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
path: .yarn-packages
path: '.yarn/cache'
key: |
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
Expand Down Expand Up @@ -298,11 +298,6 @@ jobs:
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "jupyter_lsp.*enabled" -

- name: List notebook server extensions
run: |
jupyter serverextension list
jupyter serverextension list 2>&1 | grep -ie "jupyter_lsp.*enabled" -

- name: List frontend extensions
run: |
jupyter labextension list
Expand Down Expand Up @@ -351,23 +346,20 @@ jobs:
max-parallel: 3
matrix:
os: ['ubuntu', 'macos', 'windows']
python: ['3.8', '3.9', '3.10', 'pypy-3.8']
exclude:
- os: windows
python: pypy-3.7
python: ['3.8', '3.11', 'pypy-3.8']
include:
- python: '3.8'
dist: 'jupyter*lsp*.whl'
lab: '>=3.6,<3.7'
- python: '3.9'
lab: '>=4,<5'
- python: '3.8'
dist: 'jupyter*lsp*.tar.gz'
lab: '>=3.6,<4'
- python: '3.10'
lab: '>=4,<5'
- python: '3.11'
dist: 'jupyter*lsp*.whl'
lab: '>=3.6,<4'
lab: '>=4,<5'
- python: 'pypy-3.8'
dist: 'jupyter*lsp*.tar.gz'
lab: '>=3.6,<4'
lab: '>=4,<5'
- os: 'windows'
py_cmd: python
- os: 'macos'
Expand Down Expand Up @@ -409,13 +401,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu]
python: ['3.8', '3.10']
nodejs: ['14']
python: ['3.8', '3.11']
nodejs: ['18']
include:
- python: '3.8'
lab: '>=3.6,<3.7'
- python: '3.10'
lab: '>=3.6,<4'
lab: '>=4,<5'
- python: '3.11'
lab: '>=4,<5'
steps:
- name: Install Python
uses: actions/setup-python@v4
Expand All @@ -434,8 +426,6 @@ jobs:
run: python -m pip install --upgrade pip wheel setuptools
- name: Install JupyterLab
run: python -m pip install 'jupyterlab${{ matrix.lab }}'
- name: Install Notebook (to test serverextension)
run: python -m pip install 'notebook'
- name: Install the server package
run: cd dist && python -m pip install -vv jupyter_lsp*.whl
- name: install the source extension
Expand All @@ -445,7 +435,5 @@ jobs:
set -eux
jupyter labextension list
jupyter server extension list
jupyter serverextension list
jupyter labextension list 2>&1 | grep -ie "jupyterlab-lsp.*enabled.*ok" -
jupyter server extension list 2>&1 | grep -ie "jupyter_lsp.*enabled" -
jupyter serverextension list 2>&1 | grep -ie "jupyter_lsp.*enabled" -
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,8 @@ _build

# Built labextensions
python_packages/*/*/labextensions/

# Berry
.pnp.cjs
.pnp.loader.mjs
.yarn/
2 changes: 0 additions & 2 deletions .yarnrc

This file was deleted.

1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## Changelog

### `@jupyter-lsp/jupyterlab-lsp 5.0.0-alpha.0`

- maintenance:
- support JupyterLab 4

Requires JupyterLab `>=4.0.5,<5.0.0a0`

### `@jupyter-lsp/jupyterlab-lsp 4.2.0` (2023-05-28)

- features:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Development requires, at a minimum:

- `nodejs >=16,!=17,<19`
- `python >=3.8,<3.11.0a0`
- `jupyterlab >=3.6.0,<4.0.0a0`
- `jupyterlab >=4.0.5,<5.0.0a0`

It is recommended to use a virtual environment (e.g. `virtualenv` or `conda env`)
for development.
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Language Server Protocol integration for Jupyter(Lab)

[![tests](https://github.com/jupyter-lsp/jupyterlab-lsp/workflows/CI/badge.svg)](https://github.com/jupyter-lsp/jupyterlab-lsp/actions?query=workflow%3ACI+branch%3Amaster)
[![tests](https://github.com/jupyter-lsp/jupyterlab-lsp/workflows/CI/badge.svg)](https://github.com/jupyter-lsp/jupyterlab-lsp/actions?query=workflow%3ACI+branch%3Amain)
[![Documentation Status](https://readthedocs.org/projects/jupyterlab-lsp/badge/?version=latest)](https://jupyterlab-lsp.readthedocs.io/en/latest/?badge=latest)
[![Python Demo](https://img.shields.io/badge/demo-Python-blue)](https://mybinder.org/v2/gh/jupyter-lsp/demo-python/main?urlpath=lab)
[![R Demo](https://img.shields.io/badge/demo-R-blue)](https://mybinder.org/v2/gh/jupyter-lsp/demo-r/main?urlpath=lab)
[![Julia Demo](https://img.shields.io/badge/demo-Julia-blue)](https://mybinder.org/v2/gh/jupyter-lsp/demo-julia/main?urlpath=lab)
[![Binder](https://img.shields.io/badge/launch-dev_version-blue)](https://mybinder.org/v2/gh/jupyter-lsp/jupyterlab-lsp/master?urlpath=lab%2Ftree%2Fexamples%2FPython.ipynb)
[![Binder](https://img.shields.io/badge/launch-dev_version-blue)](https://mybinder.org/v2/gh/jupyter-lsp/jupyterlab-lsp/main?urlpath=lab%2Ftree%2Fexamples%2FPython.ipynb)

**[Installation](#installation) | [Configuring](./docs/Configuring.ipynb) | [Changelog](./CHANGELOG.md) | [Roadmap](./docs/Roadmap.ipynb) | [Contributing](./CONTRIBUTING.md) | [Extending](./docs/Extending.ipynb)**

Expand All @@ -19,20 +19,20 @@ Hover over any piece of code; if an underline appears, you can press <kbd>Ctrl</
to get a tooltip with function/class signature, module documentation or any other
piece of information that the language server provides

![hover](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/hover.png)
![hover](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/hover.png)

### Diagnostics

Critical errors have red underline, warnings are orange, etc. Hover
over the underlined code to see a more detailed message

![inspections](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/inspections.png)
![inspections](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/inspections.png)

### Jump to Definition and References

Use the context menu entry, or <kbd>Alt</kbd> + :computer_mouse: to jump to definitions/references (you can change it to <kbd>Ctrl</kbd>/<kbd>⌘</kbd> in settings); use <kbd>Alt</kbd> + <kbd>o</kbd> to jump back.

![jump](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/jump_to_definition.png)
![jump](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/jump_to_definition.png)

### Highlight References

Expand All @@ -44,19 +44,19 @@ Place your cursor on a variable, function, etc and all the usages will be highli
completion.
- You can choose to receive the completion suggestions as you type by enabling `continuousHinting` setting.

![invoke](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/autocompletion.gif)
![invoke](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/autocompletion.gif)

### Automatic Signature Suggestions

Function signatures will automatically be displayed

![signature](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/signature.png)
![signature](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/signature.png)

### Kernel-less Autocompletion

Advanced static-analysis autocompletion without a running kernel

![autocompletion](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/completions-Julia-Python-R.gif)
![autocompletion](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/completions-Julia-Python-R.gif)

#### The runtime kernel suggestions are still there

Expand All @@ -76,21 +76,21 @@ setting; Or add both if you like to code in hardcore mode and get no completions
Rename variables, functions and more, in both: notebooks and the file editor.
Use the context menu option or the <kbd>F2</kbd> shortcut to invoke.

![rename](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/rename.png)
![rename](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/rename.png)

### Diagnostics panel

Sort and jump between the diagnostics using the diagnostics panel.
Open it searching for "Show diagnostics panel" in JupyterLab commands palette or from the context menu.
Use context menu on rows in the panel to filter out diagnostics or copy their message.

![panel](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/panel.png)
![panel](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/panel.png)

## Prerequisites

You will need to have both of the following installed:

- JupyterLab >=3.6.0,<4.0.0a0
- JupyterLab >=4.0.5,<5.0.0a0
- Python 3.8+

In addition, if you wish to use javascript, html, markdown or any other NodeJS-based language server you will need to have appropriate NodeJS version installed.
Expand All @@ -113,9 +113,9 @@ Use of a python `virtualenv` or a conda env is also recommended.
1. install JupyterLab and the extensions

```bash
conda install -c conda-forge 'jupyterlab>=3.0.0,<4.0.0a0' jupyterlab-lsp
conda install -c conda-forge 'jupyterlab>=4.0.0,<5.0.0a0' jupyterlab-lsp
# or
pip install 'jupyterlab>=3.0.0,<4.0.0a0' jupyterlab-lsp
pip install 'jupyterlab>=4.0.0,<5.0.0a0' jupyterlab-lsp
```

> Note: `jupyterlab-lsp` provides both the server extension and the lab extension.
Expand Down
3 changes: 2 additions & 1 deletion atest/03_Notebook.robot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Test Setup Try to Close All Tabs
Python
[Setup] Setup Notebook Python Python.ipynb
${diagnostic} = Set Variable W291 trailing whitespace (pycodestyle)
Wait Until Page Contains Element css:.cm-lsp-diagnostic[title="${diagnostic}"] timeout=35s
# TODO: no title for diagnostics; we can get the title with JS via `element.cmView.mark.spec.diagnostic.message` but this is not selectable
Wait Until Page Contains Element css:.cm-lintRange[title="${diagnostic}"] timeout=35s
Capture Page Screenshot 01-python.png
[Teardown] Clean Up After Working With File Python.ipynb

Expand Down
2 changes: 1 addition & 1 deletion atest/04_Interface/Statusbar.robot
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Status Changes Between Notebooks
Setup Notebook Python Python.ipynb
Wait Until Fully Initialized
Open New Notebook
Element Should Contain ${STATUSBAR} Waiting...
Element Should Contain ${STATUSBAR} Waiting
Wait Until Fully Initialized
Switch To Tab Python.ipynb
Wait Until Fully Initialized
Expand Down