Skip to content

Commit c03c1d1

Browse files
committed
Merge branch 'master' into refactor-completion-item
2 parents b4d2707 + ffdd497 commit c03c1d1

40 files changed

+694
-130
lines changed

.github/workflows/job.test.yml

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ defaults:
1616
shell: bash -l {0}
1717

1818
env:
19-
# Increase this value to reset all caches
20-
CACHE_EPOCH: 0
21-
22-
JLPM_CMD: jlpm --ignore-optional --prefer-offline --frozen-lockfile
23-
19+
JULIA_NUM_THREADS: 2
20+
MAMBA_NO_BANNER: 1
21+
PIP_DISABLE_PIP_VERSION_CHECK: 1
2422
PYTHONUNBUFFERED: 1
23+
2524
ATEST_RETRIES: 3
26-
PIP_DISABLE_PIP_VERSION_CHECK: 1
25+
JLPM_CMD: jlpm --ignore-optional --prefer-offline --frozen-lockfile
2726

28-
# TODO: replace once mambaforge "just works" with setup-miniconda
29-
MAMBAFORGE_URL: https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge
27+
# Increase this value to reset all caches
28+
CACHE_EPOCH: 2
29+
JULIA_LANGSERVER: 3.2.0
3030

3131
jobs:
3232
lint:
@@ -50,7 +50,7 @@ jobs:
5050
nodejs: '${{ matrix.nodejs }}'
5151

5252
- name: Cache conda
53-
uses: actions/cache@v1
53+
uses: actions/cache@v2
5454
with:
5555
path: ~/conda_pkgs_dir
5656
key: |
@@ -59,13 +59,12 @@ jobs:
5959
${{ env.CACHE_EPOCH }}-${{ matrix.os }}-lint-
6060
6161
- name: Set up Python and mamba
62-
uses: conda-incubator/setup-miniconda@v2
62+
uses: conda-incubator/setup-miniconda@master
6363
with:
64-
installer-url: ${{ env.MAMBAFORGE_URL }}-Linux-x86_64.sh
6564
condarc-file: .github/.condarc
66-
67-
- name: Install base conda dependencies
68-
run: mamba env update -n test --file requirements/github-actions.yml
65+
environment-file: requirements/github-actions.yml
66+
miniforge-variant: Mambaforge
67+
use-mamba: true
6968

7069
- name: Install linting dependencies
7170
run: mamba env update -n test --file requirements/lint.yml
@@ -78,15 +77,17 @@ jobs:
7877
uses: actions/cache@v2
7978
with:
8079
path: '**/node_modules'
81-
key: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-lint-${{ hashFiles('yarn.lock', 'requirements/github-actions.yml') }}
80+
key: |
81+
${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-lint-${{ hashFiles('yarn.lock', 'requirements/github-actions.yml') }}
8282
8383
- name: Cache yarn packages
8484
id: cache-yarn-packages
8585
if: steps.cache-node-modules.outputs.cache-hit != 'true'
86-
uses: actions/cache@v1
86+
uses: actions/cache@v2
8787
with:
8888
path: .yarn-packages
89-
key: ${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
89+
key: |
90+
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
9091
restore-keys: |
9192
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-
9293
${{ env.CACHE_EPOCH }}-yarn-
@@ -128,7 +129,7 @@ jobs:
128129
nodejs: '${{ matrix.nodejs }}'
129130

130131
- name: Cache conda
131-
uses: actions/cache@v1
132+
uses: actions/cache@v2
132133
with:
133134
path: ~/conda_pkgs_dir
134135
key: |
@@ -137,10 +138,10 @@ jobs:
137138
${{ env.CACHE_EPOCH }}-${{ matrix.os }}-build-
138139
139140
- name: Set up Python and mamba
140-
uses: conda-incubator/setup-miniconda@v2
141+
uses: conda-incubator/setup-miniconda@master
141142
with:
142-
installer-url: ${{ env.MAMBAFORGE_URL }}-Linux-x86_64.sh
143143
condarc-file: .github/.condarc
144+
miniforge-variant: Mambaforge
144145

145146
- name: Install minimal build deps
146147
shell: bash -l {0}
@@ -151,15 +152,17 @@ jobs:
151152
uses: actions/cache@v2
152153
with:
153154
path: '**/node_modules'
154-
key: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-build-${{ hashFiles('yarn.lock', 'requirements/github-actions.yml') }}
155+
key: |
156+
${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-build-${{ hashFiles('yarn.lock', 'requirements/github-actions.yml') }}
155157
156158
- name: Cache yarn packages
157159
id: cache-yarn-packages
158160
if: steps.cache-node-modules.outputs.cache-hit != 'true'
159-
uses: actions/cache@v1
161+
uses: actions/cache@v2
160162
with:
161163
path: .yarn-packages
162-
key: ${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
164+
key: |
165+
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
163166
restore-keys: |
164167
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-
165168
${{ env.CACHE_EPOCH }}-yarn-
@@ -230,11 +233,6 @@ jobs:
230233
steps:
231234
- uses: actions/checkout@v2
232235

233-
- uses: julia-actions/setup-julia@v1
234-
235-
- name: Install Julia language server
236-
run: julia -e 'using Pkg; Pkg.add("LanguageServer")'
237-
238236
- name: Set JupyterLab and Node versions
239237
uses: cschleiden/replace-tokens@v1
240238
with:
@@ -246,7 +244,7 @@ jobs:
246244
nodejs: '${{ matrix.nodejs }}'
247245

248246
- name: Cache conda
249-
uses: actions/cache@v1
247+
uses: actions/cache@v2
250248
with:
251249
path: ~/conda_pkgs_dir
252250
key: |
@@ -255,26 +253,12 @@ jobs:
255253
${{ env.CACHE_EPOCH }}-${{ matrix.os }}-${{ matrix.python }}-atest-
256254
257255
- name: Set up Python and mamba
258-
uses: conda-incubator/setup-miniconda@v2
256+
uses: conda-incubator/setup-miniconda@master
259257
with:
260-
installer-url: ${{ env.MAMBAFORGE_URL }}-${{ matrix.mambaforge }}
261-
python-version: ${{ matrix.python }}
262258
condarc-file: .github/.condarc
263-
264-
- name: Describe conda
265-
run: |
266-
conda info
267-
conda config --show-sources
268-
conda config --show
269-
270-
- name: Install conda dependencies (unix)
271-
if: ${{ matrix.os != 'windows' }}
272-
run: mamba env update -n test --file requirements/github-actions.yml
273-
274-
- name: Install conda dependencies (windows)
275-
if: ${{ matrix.os == 'windows' }}
276-
shell: cmd /C call {0}
277-
run: mamba env update -n test --file requirements/github-actions.yml
259+
environment-file: requirements/github-actions.yml
260+
miniforge-variant: Mambaforge
261+
use-mamba: true
278262

279263
- name: List all packages
280264
run: conda list
@@ -284,22 +268,26 @@ jobs:
284268
uses: actions/cache@v2
285269
with:
286270
path: '**/node_modules'
287-
key: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-test-${{ hashFiles('yarn.lock', 'requirements/github-actions.yml') }}
271+
key: |
272+
${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-atest-${{ hashFiles('yarn.lock') }}
288273
289274
- name: Cache yarn packages
290275
id: cache-yarn-packages
291276
if: steps.cache-node-modules.outputs.cache-hit != 'true'
292-
uses: actions/cache@v1
277+
uses: actions/cache@v2
293278
with:
294279
path: .yarn-packages
295-
key: ${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
280+
key: |
281+
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
296282
restore-keys: |
297283
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-
298284
${{ env.CACHE_EPOCH }}-yarn-
299285
300-
- name: install npm dependencies
301-
if: steps.cache-node-modules.outputs.cache-hit != 'true'
302-
run: ${{ env.JLPM_CMD }}
286+
- uses: actions/cache@v2
287+
with:
288+
path: ~/.julia/artifacts
289+
key: |
290+
${{ env.CACHE_EPOCH }}-julia-test-${{ runner.os }}-${{ env.JULIA_LANGSERVER }}
303291
304292
- uses: actions/download-artifact@v2
305293
with:
@@ -325,6 +313,16 @@ jobs:
325313
- name: List frontend extensions
326314
run: jupyter labextension list
327315

316+
- name: install node-based language servers
317+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
318+
run: ${{ env.JLPM_CMD }}
319+
320+
- name: Install Julia
321+
uses: julia-actions/setup-julia@v1
322+
323+
- name: Install Julia language server
324+
run: julia -e 'using Pkg; Pkg.add(Pkg.PackageSpec(;name="LanguageServer", version="${{ env.JULIA_LANGSERVER }}"))'
325+
328326
- name: Run python tests
329327
run: python scripts/utest.py
330328

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
## CHANGELOG
22

3-
### `@krassowski/jupyterlab-lsp 3.4.2` (unreleased)
3+
### `@krassowski/jupyterlab-lsp 3.5.0` (unreleased)
4+
5+
- features:
6+
7+
- adds `%%bigquery` IPython cell magic support for BigQuery ([#553], thanks @julioyildo)
48

59
- bug fixes:
610

711
- prevents throwing a highlights error when adding new cell with <kbd>Shift</kbd> + <kbd>Enter</kbd> ([#544])
812
- fixes IPython `pinfo` and `pinfo2` (`?` and `??`) for identifiers containing `s` ([#547])
13+
- fixes incorrect behaviour of LSP features in some IPython magics with single line of content ([#560])
14+
15+
- for extension authors:
16+
17+
- minimal functional extractor and code overrides APIs are now exported; these APIs cab be subject to change in future releases ([#562])
918

1019
[#544]: https://github.com/krassowski/jupyterlab-lsp/pull/544
1120
[#547]: https://github.com/krassowski/jupyterlab-lsp/pull/547
21+
[#553]: https://github.com/krassowski/jupyterlab-lsp/pull/553
22+
[#560]: https://github.com/krassowski/jupyterlab-lsp/pull/560
23+
[#562]: https://github.com/krassowski/jupyterlab-lsp/pull/562
1224

1325
### `jupyter-lsp 1.1.4` (2020-02-21)
1426

atest/05_Features/Completion.robot

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,28 @@ Shows Documentation With CompletionItem Resolve
296296
Completer Should Include Documentation the default method of the
297297
[Teardown] Clean Up After Working With File completion.R
298298

299+
Shows Only Relevant Suggestions In Known Magics
300+
# https://github.com/krassowski/jupyterlab-lsp/issues/559
301+
# h<tab>
302+
Enter Cell Editor 20 line=2
303+
Trigger Completer
304+
Completer Should Suggest help
305+
Completer Should Not Suggest from
306+
Completer Should Suggest hash
307+
308+
Completes In R Magics
309+
# Proper completion in R magics needs to be tested as:
310+
# - R magic extractor uses a tailor-made replacer function, not tested elsewhere
311+
# - R lanugage server is very sensitive to off-by-one errors (see https://github.com/REditorSupport/languageserver/issues/395)
312+
# '%%R\n librar<tab>'
313+
Enter Cell Editor 22 line=2
314+
Trigger Completer
315+
Completer Should Suggest library
316+
# '%R lib<tab>'
317+
Enter Cell Editor 24 line=1
318+
Trigger Completer
319+
Completer Should Suggest library
320+
299321
*** Keywords ***
300322
Setup Completion Test
301323
Setup Notebook Python Completion.ipynb

atest/examples/Completion.ipynb

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,56 @@
150150
"source": [
151151
"t"
152152
]
153+
},
154+
{
155+
"cell_type": "markdown",
156+
"metadata": {},
157+
"source": [
158+
"Cell magics show only relevant suggestions (triggering after `h` should return `hash`, `help`, etc, but not `from`):"
159+
]
160+
},
161+
{
162+
"cell_type": "code",
163+
"execution_count": null,
164+
"metadata": {},
165+
"outputs": [],
166+
"source": [
167+
"%%python\n",
168+
"h"
169+
]
170+
},
171+
{
172+
"cell_type": "markdown",
173+
"metadata": {},
174+
"source": [
175+
"Test that the leading space does not cause issues in R cell magic:"
176+
]
177+
},
178+
{
179+
"cell_type": "code",
180+
"execution_count": null,
181+
"metadata": {},
182+
"outputs": [],
183+
"source": [
184+
"%%R\n",
185+
" librar"
186+
]
187+
},
188+
{
189+
"cell_type": "markdown",
190+
"metadata": {},
191+
"source": [
192+
"And that R line magic works too:"
193+
]
194+
},
195+
{
196+
"cell_type": "code",
197+
"execution_count": null,
198+
"metadata": {},
199+
"outputs": [],
200+
"source": [
201+
"%R li"
202+
]
153203
}
154204
],
155205
"metadata": {

docs/Installation.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@
250250
"##### pip\n",
251251
"\n",
252252
"```bash\n",
253-
"pip install jupyterlab-lsp={JUPYTERLAB_LSP_VERSION}\n",
253+
"pip install jupyterlab-lsp=={JUPYTERLAB_LSP_VERSION}\n",
254254
"```"
255255
]
256256
},

packages/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = {
66
node: true,
77
'jest/globals': true
88
},
9+
globals: { JSX: 'readonly' },
910
root: true,
1011
extends: [
1112
'eslint:recommended',

packages/_example-extractor/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Extractor API
2+
3+
This is an example of the Extractor API. See the [discussion].
4+
5+
[discussion]: https://github.com/krassowski/jupyterlab-lsp/issues/561
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('@jupyterlab/testutils/lib/babel.config');
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const func = require('@jupyterlab/testutils/lib/jest-config');
2+
const upstream = func('jupyterlab-lsp', __dirname);
3+
4+
const reuseFromUpstream = [
5+
'moduleFileExtensions',
6+
'moduleNameMapper',
7+
'setupFiles',
8+
'setupFilesAfterEnv',
9+
'testPathIgnorePatterns'
10+
];
11+
12+
let local = {
13+
globals: { 'ts-jest': { tsconfig: 'tsconfig.json' } },
14+
testRegex: `.*\.spec\.tsx?$`,
15+
transform: {
16+
'\\.(ts|tsx)?$': 'ts-jest',
17+
'\\.(js|jsx)?$': './transform.js',
18+
'\\.svg$': 'jest-raw-loader'
19+
},
20+
transformIgnorePatterns: [
21+
'/node_modules/(?!(@jupyterlab/.*|@jupyterlab-classic/.*)/)'
22+
],
23+
testLocationInResults: true,
24+
reporters: [...upstream['reporters'], 'jest-github-actions-reporter']
25+
};
26+
27+
for (const option of reuseFromUpstream) {
28+
local[option] = upstream[option];
29+
}
30+
31+
module.exports = local;

0 commit comments

Comments
 (0)