Skip to content

Commit 387941d

Browse files
committed
Merge branch 'master' into fix-autoinvoke-on-dot
2 parents 6cff718 + 87b0f93 commit 387941d

File tree

22 files changed

+278
-64
lines changed

22 files changed

+278
-64
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
## CHANGELOG
22

3+
### `@krassowski/jupyterlab-lsp 2.1.2` (2020-12-XX)
4+
5+
- bug fixes
6+
- improved performance of completion and highlights by minimising the number of highlight requests and GUI redraws (token checking, debouncing, acting on a single response only) ([#433])
7+
- highlights now update after cell focus/blur events even if those do not trigger cursor movement ([#433])
8+
9+
[#433]: https://github.com/krassowski/jupyterlab-lsp/issues/433
10+
311
### `@krassowski/jupyterlab-lsp 2.1.1` (2020-12-15)
412

513
- bug fixes

atest/05_Features/Highlights.robot

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
*** Settings ***
2+
Suite Setup Setup Suite For Screenshots highlights
3+
Test Setup Setup Highlights Test
4+
Test Teardown Clean Up After Working With File Highlights.ipynb
5+
Force Tags feature:highlights
6+
Resource ../Keywords.robot
7+
8+
*** Test Cases ***
9+
# cursor is symbolized by pipe (|), for example when
10+
# it is at the end of line, after `1` in `test = 1`
11+
# it is presented as: `test = 1|`
12+
Highlights work at the start of a token
13+
Enter Cell Editor 1 line=1
14+
Press Keys None END # cursor to the end of first line (`test = 1|`)
15+
Should Not Highlight Any Tokens
16+
Press Keys None HOME # cursor before the token (`|test = 1`)
17+
Should Highlight Token test
18+
Should Not Highlight Token gist
19+
20+
Highlights work at the end of a token
21+
Enter Cell Editor 1 line=1
22+
Press Keys None END # cursor to the end of first line (`test = 1|`)
23+
Press Keys None DOWN # cursor to the end of the token in second line (`test`)
24+
Should Highlight Token test
25+
Should Not Highlight Token gist
26+
27+
Highlights are changed when moving cursor between cells
28+
[Documentation] GH431
29+
Enter Cell Editor 1 line=2
30+
Press Keys None END # cursor after the token in second line (`test|`)
31+
Should Highlight Token test
32+
Should Not Highlight Token gist
33+
Press Keys None DOWN # cursor to next cell, which is empty
34+
Should Not Highlight Any Tokens
35+
Press Keys None DOWN # cursor to third cell (`|gist = 1`)
36+
Should Highlight Token gist
37+
Press Keys None DOWN # cursor to third cell, second line (`|test `)
38+
Should Highlight Token test
39+
40+
Highlights are added after typing
41+
Enter Cell Editor 1 line=2
42+
Should Highlight Token test
43+
Press Keys None a
44+
Should Highlight Token testa
45+
46+
*** Keywords ***
47+
Should Not Highlight Any Tokens
48+
Page Should Not Contain css:.cm-lsp-highlight
49+
50+
Should Highlight Token
51+
[Arguments] ${token} ${timeout}=10s
52+
${token_element} Set Variable xpath://span[contains(@class, 'cm-lsp-highlight')][contains(text(), '${token}')]
53+
Wait Until Page Contains Element ${token_element} timeout=${timeout}
54+
55+
Should Not Highlight Token
56+
[Arguments] ${token} ${timeout}=10s
57+
${token_element} Set Variable xpath://span[contains(@class, 'cm-lsp-highlight')][contains(text(), '${token}')]
58+
Wait Until Page Does Not Contain Element ${token_element} timeout=${timeout}
59+
60+
Setup Highlights Test
61+
Setup Notebook Python Highlights.ipynb

atest/Keywords.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Create Notebok Server Config
5252

5353
Read Page Config
5454
${script} = Get Element Attribute id:jupyter-config-data innerHTML
55-
${config} = Evaluate __import__("json").loads("""${script}""")
55+
${config} = Evaluate __import__("json").loads(r"""${script}""")
5656
Set Global Variable ${PAGE CONFIG} ${config}
5757
Set Global Variable ${LAB VERSION} ${config["appVersion"]}
5858

atest/examples/Highlights.ipynb

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"test = 1\n",
10+
"test"
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": null,
16+
"metadata": {},
17+
"outputs": [],
18+
"source": []
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": null,
23+
"metadata": {},
24+
"outputs": [],
25+
"source": [
26+
"gist = 1\n",
27+
"test\n",
28+
"gist\n",
29+
"test"
30+
]
31+
}
32+
],
33+
"metadata": {
34+
"kernelspec": {
35+
"display_name": "Python 3",
36+
"language": "python",
37+
"name": "python3"
38+
},
39+
"language_info": {
40+
"codemirror_mode": {
41+
"name": "ipython",
42+
"version": 3
43+
},
44+
"file_extension": ".py",
45+
"mimetype": "text/x-python",
46+
"name": "python",
47+
"nbconvert_exporter": "python",
48+
"pygments_lexer": "ipython3",
49+
"version": "3.7.5"
50+
}
51+
},
52+
"nbformat": 4,
53+
"nbformat_minor": 4
54+
}

binder/environment.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: jupyterlab-lsp
22

33
channels:
44
- conda-forge
5-
- defaults
5+
- nodefaults
66

77
dependencies:
88
# runtime dependencies
@@ -12,21 +12,14 @@ dependencies:
1212
# build dependencies
1313
- nodejs >=10.12,<15
1414
# for python language server (and development)
15-
- black
1615
- flake8 >=3.5
17-
# isort 5.0 has breaking API changes which affect (among others) pylint and nblint;
18-
# the pin should be removed once https://github.com/PyCQA/pylint/pull/3725 is merged
19-
# see https://github.com/krassowski/jupyterlab-lsp/pull/291
20-
- isort <5
21-
- mypy
2216
- pip
2317
- pylint
18+
- pyls-black
19+
- pyls-isort
20+
- pyls-mypy
2421
- python-language-server
2522
- ruamel_yaml
26-
- pip: # not-yet-appearing-in-conda-forge
27-
- pyls-black
28-
- pyls-isort
29-
- pyls-mypy
3023
# for R language server and kernel
3124
- r
3225
- r-irkernel
@@ -36,3 +29,5 @@ dependencies:
3629
- tectonic
3730
- texlab
3831
- chktex
32+
# TODO: remove when jedi vs IPython is resolved
33+
- jedi <0.18

docs/Configuring.ipynb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,18 @@
175175
]
176176
},
177177
{
178+
"cell_type": "markdown",
179+
"metadata": {},
178180
"source": [
179181
"#### virtual_documents_dir\n",
180182
"\n",
181183
"> default: os.getenv(\"JP_LSP_VIRTUAL_DIR\", \".virtual_documents\")\n",
182184
"\n",
183185
"Path to virtual documents relative to the content manager root directory.\n",
184186
"\n",
185-
"Its default value can be set with `JP_LSP_VIRTUAL_DIR` environment variable and fallback to `.virtual_documents`."
186-
],
187-
"cell_type": "markdown",
188-
"metadata": {}
187+
"Its default value can be set with `JP_LSP_VIRTUAL_DIR` environment variable and\n",
188+
"fallback to `.virtual_documents`."
189+
]
189190
},
190191
{
191192
"cell_type": "markdown",
@@ -224,4 +225,4 @@
224225
},
225226
"nbformat": 4,
226227
"nbformat_minor": 4
227-
}
228+
}

packages/jupyterlab-lsp/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@
2929
},
3030
"scripts": {
3131
"build": "jlpm build:schema && tsc -b",
32-
"build:schema": "jlpm build:schema-backend && jlpm build:schema-completion && jlpm build:schema-hover && jlpm build:schema-diagnostics && jlpm build:schema-syntax_highlighting && jlpm build:schema-jump_to",
32+
"build:schema": "jlpm build:schema-backend && jlpm build:schema-completion && jlpm build:schema-hover && jlpm build:schema-diagnostics && jlpm build:schema-syntax_highlighting && jlpm build:schema-jump_to && jlpm build:schema-highlights",
3333
"build:schema-backend": "json2ts ../../py_src/jupyter_lsp/schema/schema.json --unreachableDefinitions | prettier --stdin-filepath _schema.d.ts > src/_schema.d.ts",
3434
"build:schema-completion": "json2ts schema/completion.json | prettier --stdin-filepath _completion.d.ts > src/_completion.d.ts",
3535
"build:schema-hover": "json2ts schema/hover.json | prettier --stdin-filepath _hover.d.ts > src/_hover.d.ts",
3636
"build:schema-jump_to": "json2ts schema/jump_to.json | prettier --stdin-filepath _jump_to.d.ts > src/_jump_to.d.ts",
3737
"build:schema-diagnostics": "json2ts schema/diagnostics.json | prettier --stdin-filepath _diagnostics.d.ts > src/_diagnostics.d.ts",
3838
"build:schema-syntax_highlighting": "json2ts schema/syntax_highlighting.json | prettier --stdin-filepath _syntax_highlighting.d.ts > src/_syntax_highlighting.d.ts",
39+
"build:schema-highlights": "json2ts schema/highlights.json | prettier --stdin-filepath _highlights.d.ts > src/_highlights.d.ts",
3940
"bundle": "npm pack .",
4041
"clean": "rimraf lib",
4142
"lab:link": "jupyter labextension link . --no-build",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"jupyter.lab.setting-icon": "lsp:highlight",
3+
"jupyter.lab.setting-icon-label": "Language integration",
4+
"title": "Code Highlights",
5+
"description": "LSP highlights of the variable under the cursor settings.",
6+
"type": "object",
7+
"properties": {
8+
"debouncerDelay": {
9+
"title": "Debouncer delay",
10+
"type": "number",
11+
"default": 250,
12+
"description": "Number of milliseconds to delay sending out the highlights request to the language server; you can get better responsiveness adjusting this value, but setting it to zero can actually slow it down as the server might get overwhelmed when moving the cursor."
13+
}
14+
},
15+
"jupyter.lab.shortcuts": []
16+
}

packages/jupyterlab-lsp/schema/hover.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"title": "Throttler delay",
1717
"type": "number",
1818
"default": 50,
19-
"description": "Number of milliseconds to delay sending out the request hover request to the language server; you can get better responsiveness adjusting this value, but setting it to zero can actually slow it down as the server might get overwhelmed when moving the mose over the code."
19+
"description": "Number of milliseconds to delay sending out the hover request to the language server; you can get better responsiveness adjusting this value, but setting it to zero can actually slow it down as the server might get overwhelmed when moving the mouse over the code."
2020
},
2121
"cacheSize": {
2222
"title": "Cache size",

0 commit comments

Comments
 (0)