Skip to content

Commit a650dd8

Browse files
trungleduckrassowskibrendan0powersbpowers39Serhat YILDIRIM
authored
Integrate jupyterlab-lsp into jupyterlab (jupyterlab#12534)
* Import jumpers from index, update yarn * Do not attach "jump back" command to context menu * Flip the jump back icon in palette, remove debug log * Implement Accel and use it as default to support ⌘ on Mac * Add highlights debouncer and check if highlights request is needed before sending one. * Clear `last_token` after clearing highlights * Ensure that trigger characters auto-invoke works in continuous hinting mode * Add highlights test and fix jupyterlab#431 * Allow to clear highlights on blur * Set promise type to void * Fix syntax highlighting (needs import of cm/mode/meta) * Try to fix R double colon completion issue * Fix test and lint; add changelog * Add support for jupyterlab-classic * Make the status item work with classic on toolbar * Fix highlight of status icon when selected * Use new icons and no text on toolbar when status bar not available * Disable diagnostics panel command in Classic * Update yarn.lock, lint * Fix connection manager loosing track of notebooks which were not correctly scoped by path by switching away from id_path which was refactored to not contain the actual file name to uri which does contain the file name and path * Add new status "no server extension" * Fix handling of kernel change and restart * Retry connection for 5.5 minutes total rather than 40 seconds * Only claim that servers are missing if they really are * Rewire all logs to go through a thin scoped wrapper * Fix two typos * Temporarily tolerate pygls usage of nulls for diagnostics * Fix diagnostics panel not working after restart * Ensure that diagnostics panel works after restart * Remove prefixes * Implement completionItem/resolve and icon substitution * Move rendering to renderer * Pre-fetch completion items (above/below), show placeholder while waiing * Fix hiding of panel, fix illegal constructor for plain-text documentation * Do not check item inset text if empty * Fix Julia language server crashes on too broad save notification * Make the LSP completions work when kernel is busy or slow * Do not show delayed responses if line changed or cursor retreated * Fix state not being updated after notebook rename/restart * Implement allSettled replacement to show _something_ when one of the completion sources fails * Restore pre-formatted rendering for completer panel, enable latex * Invalidate delayed completion if cell changed or lost focus * Invalidate signature on cell blur, change and some cursor moves * Fix comment * WIP: enable sorting, improve marking and filtering and doc panel * Remove outdated comment * Allow tab-invoked completion in strings, suppress autoinvoke in def * Fix dictionary completion issue for jedi-language-server that would have led to "Code Editor out of Sync" error * Prevent crash of the diagnostics panel when foreign documents are empty * Fix diagnostics not being cleared upon foreign document closure * Only search for label match if different from insertText match and escape HTML label when no query is used * Collapse paths for files deep in subfolders * Fix source install (jupyterlab#526) * Add a job to verify source install * Add @jupyterlab-classic/application to peer dependencies * Adding as peer-dependency did not help, entering debug mode * Try to use peerDependenciesMeta * Remove peerDependency(Meta) for classic * Revert to safe use of app.shell with type casing and type import * Restore smoke job * Add changelog entry * Re-activate atest * Handle case where getCursor() returns null in highlighter * Clean up null check * Fix a typo preventing pinfo from working on ids with letter 's' * Initial work on source-aware completion item and reply * Add ipython-bigquery magic * Add ipython-bigquery to defaults.ts * update ipython-bigquery spec : comment %bigquery line magic * make strings localizable * Delete commented code * Delete commented code * update transclusions, run jlpm lint * fix error in tests with rename.ts * Fix regular-expression based extractors offset * Lint * Remove incorrect comment * Swap order of transclusions provider so that generic IPython is last * propose Extractor API * Update the bigquery extractor to use foreign_capture_group * Add key overrides exports, and a note * foreign_capture_group: number → foreign_capture_groups: number[] * start adding example package with tests * more work on example * linting * clobber some lint * resolve * Expose caseSensitive and includePerfectMatches completer settings * Display 'source' or 'detail' next to completion label * fix more lint, use built-in jest test data iteration * reorganize API definitions to avoid circular imports * Implement display of detail, source, and extra settings * Do update extra info on render too * fix code stype with lint * fix test errors with diagnostics.ts * localize Severity levels and columns menu of diagnostics panel * fix code style * use ICodeMirror, more type imports, order plugin for fixer * Lint * Defer translation of the status * Allow to disable LSP or Kernel completions independently. Some use love LSP for many of its features, but prefer to keep completions via the kernel. This adds two boolean flags in the configuration to not send completions request to LSP and not send completions requests to the kernel. See jupyterlab#440 * Move to exclusion list for config. Take reviews into accounts * Rename options * prettier * Add priority setting for servers handling the same language * Fix failing test, update changelog, add serverIdentifier * Address review comments, back down on lowercase * Move the workaround to the root of the issue * Special case for MacOS * Fix this binding for priority detection * Fix order of config initialization * Normalize colons in Windows paths * Implement console log window messages, update lsp-ws-connection * Add server identifier * JupyterLab Classic -> RetroLab * Rework LSP connection interface, cherry picking jupyterlab#278 Co-authored-by: bollwyvl Co-authored-by: krassowski * Pass connection to server request handlers as well (as optional) * Only emit priority warning once * Fix registration options, diagnostics (one slot!), migrate hover * Implement setTrace, logTrace, and optional logging of messages using new API * Optimize lsp server error message (jupyterlab#621) * Optimize lsp server error message * Fix * Update changelog * Add types-six for new mypy version * Add types-six to lint.yml * Try installing mypy types in action * Try to install types manually * Might as well use requirements/lint.yml... * Stop conda nagging about pip * Lint lint.yml Co-authored-by: zhouwenhua02 <[email protected]> Co-authored-by: krassowski <[email protected]> * Fix hover malfunction messages (jupyterlab#630) * Fix hover malfunction messages * Sync completion-theme version, relax some constraints * Update changelog, bump theme versions (as pin was relaxed) * Add troubleshooting pop-up * Fix tests, improve UI, add more troubleshooting * Prepare for testing with Klingon * Correct rpy2 `%Rdevice` magic integration (jupyterlab#646) and prevent breaking of other line magics which also happen to start with R. * Do not hide tooltip on mouseleave/move if close to tooltip * Display MarkedStrings correctly as markdown in hover Previously those were incorrectly shown as plain text strings * Workaround breaking change in JupyterLab 3.1 * Fix typos, lint * Handle case where position is null * Add console attribute to VirtualDocument * fix tests * Use current version of CodeMirror typings * Implement persistent signature, with active parameter highlight * Improve styling of the signature * Hoist closeCharacters to a setting, hide tooltip on blur, fix escapeMarkdown * Implement hiding on cursor moving prior to start position * Remove useless escape * Escape backslash * Implement remaining behaviour * Lint * Workaround incorrect initial placement of the tooltip * Test signature to markdown, fix whitespace handling, use new API * Fix backslash escaping * Add browser tests for signature marks and closing * Implement collapsing of long signatures * Improve translations in diagnostics, update translation domain * Ensure `trans` always available, camelCase some protected members * Keep `get_breadcrumbs` as deprecated to avoid breaking compatibility in case if anyone uses it * Fix the issue with non-disappearing signature * Fix kernel completions filtering for R * Fix tab completions not showing up in strings due to incomplete trigger kind invalidation * Fix path completion in strings * Improve the completion test * Soft rename of the organization * Improve escaping for IPython magics overrides * Allow to disable specific features * Fix placeholder removal overwriting documentation from newer request * Further improve documentation panel reliability * Prettier * Shim `workspace/configuration` to support new YAML server version * issue 695 copy generated type files into lib directory * Implement details-below layout * Correct gettext method * Fix translations for popup * Fix `Line:Ch` and `Cell` sort order * Test sorting of columns in diagnostic panel * Fix identifier for pluralized strings * Squash warnings and errors in console * Enable strict null checks * Enable `noImplicitThis` * Fix hover character comparison logic, finish null position handling * Only fetch position on actual user-commanded jump * Handle an warning showing up on restoring workspace * Enable `strictBindCallApply` * Enable `noImplicitReturns` * Fix: make signature (and details) clickable, correct signature formatting when no arguments present * Enable simple pre-filtering of completion matches * Address test failures * Add support for diagnostic tags from LSP 3.15 * Move `initializeParams` which are fully responsibility of client, and not the connection implementation detail * Announce tag support for diagnostics, correct capabilities type * Move client capabilities to features * Prepare jupyterlab-lsp 3.10.0 release (jupyterlab#740) * Update changelog and bump version to 3.10.0 * Upgrade CodeMirror, lerna and pyright * Update to JupyterLab 3.1 part 1 * Update devDependencies including JupyterLab packages to 3.2.x * Mention all bug fixes from null checks PR in the changelog * Fix jest config * Lint everything * Final set of dev dependencies bumps * Bump versions of modified packages * Bump range in more places * Integrity updates * Fix tooltip types (undefined) * Final lock file bump * Lint again * Update date and lab versions to test on CI * Implement jump to definitions and basic target selector * Fix jumping to dependencies in node modules * Remove unused highlight commands and highlight type icon * Move files * Integrate `jupyterlab-lsp` into `jupyterlab` * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add `jupyter-lsp` * Update Playwright Snapshots * Add schema check * Update Playwright Snapshots * Remove any type * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update galata tests * Apply reviewer's suggestions * Move lsp plugins to required list * Update staging dependencies * Revert change on staging/package.json * Update Playwright Snapshots * Update Playwright Snapshots. * Update code structure + add docstring * Remove `nbformat` * Apply reviewer's suggestions * Fix integrity, tests and staging dependencies * Remove `nbformat` dependency * Fix failed UI tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update integrity * Apply reviewer's suggestions * Package integrity updates * Lint code * Tag new APIs as `alpha` * Rename `initialized` to `ready` * Add missing header and update setting schema * Remove `lsp-ws-connection` dependency * Fix header * Remove `codemirror` dependency * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix lint * Apply reviewer's suggestion Co-authored-by: krassowski <[email protected]> Co-authored-by: Michał Krassowski <[email protected]> Co-authored-by: Brendan Powers <[email protected]> Co-authored-by: Brendan Powers <[email protected]> Co-authored-by: Serhat YILDIRIM <[email protected]> Co-authored-by: JessicaBarh <[email protected]> Co-authored-by: julioyildo <[email protected]> Co-authored-by: Nicholas Bollweg <[email protected]> Co-authored-by: Matthias Bussonnier <[email protected]> Co-authored-by: Jeremy Tuloup <[email protected]> Co-authored-by: passer <[email protected]> Co-authored-by: zhouwenhua02 <[email protected]> Co-authored-by: bsyouness <[email protected]> Co-authored-by: Youness Bennani <[email protected]> Co-authored-by: cccs-jc <[email protected]> Co-authored-by: Frédéric Collonval <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 050f799 commit a650dd8

File tree

99 files changed

+9379
-455
lines changed

Some content is hidden

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

99 files changed

+9379
-455
lines changed

.eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ typedoc-theme/
4242
# ms IDE stuff
4343
.history/
4444
.vscode/
45+
46+
# generated LSP interfaces
47+
packages/lsp/src/_*
48+
packages/lsp/schema.js

.github/labeler.yml

+6
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ pkg:logconsole:
186186
- packages/logconsole-extension/**/*
187187
- packages/logconsole-extension/*
188188

189+
pkg:lsp:
190+
- packages/lsp/**/*
191+
- packages/lsp/*
192+
- packages/lsp-extension/**/*
193+
- packages/lsp-extension/*
194+
189195
pkg:mainmenu:
190196
- packages/mainmenu/**/*
191197
- packages/mainmenu/*

.github/workflows/linuxjs-tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
js-imageviewer,
3535
js-inspector,
3636
js-logconsole,
37+
js-lsp,
3738
js-mainmenu,
3839
js-nbformat,
3940
js-notebook,

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,6 @@ junit.xml
126126
!.vscode/extension.json
127127

128128
.jupyter_releaser_checkout
129+
130+
# generated LSP interfaces
131+
packages/lsp/src/_*

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ packages/nbconvert-css/style/index.css
4545
# autogenerated files for documentation
4646
docs/source/user/commands_list.md
4747
galata/test/documentation/commands.test.ts-snapshots/commandsList-documentation-linux.json
48+
49+
# generated LSP interfaces
50+
packages/lsp/src/_

buildutils/src/ensure-repo.ts

+3
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ const SKIP_CSS: Dict<string[]> = {
152152
'@jupyterlab/filebrowser': ['@jupyterlab/statusbar'],
153153
'@jupyterlab/fileeditor': ['@jupyterlab/statusbar'],
154154
'@jupyterlab/help-extension': ['@jupyterlab/application'],
155+
'@jupyterlab/lsp': ['codemirror'],
155156
'@jupyterlab/metapackage': [
156157
'@jupyterlab/ui-components',
157158
'@jupyterlab/apputils',
@@ -209,6 +210,8 @@ const SKIP_CSS: Dict<string[]> = {
209210
'@jupyterlab/launcher-extension',
210211
'@jupyterlab/logconsole',
211212
'@jupyterlab/logconsole-extension',
213+
'@jupyterlab/lsp',
214+
'@jupyterlab/lsp-extension',
212215
'@jupyterlab/mainmenu-extension',
213216
'@jupyterlab/markdownviewer',
214217
'@jupyterlab/markdownviewer-extension',

dev_mode/package.json

+7
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@
6565
"@jupyterlab/launcher-extension": "~4.0.0-alpha.11",
6666
"@jupyterlab/logconsole": "~4.0.0-alpha.11",
6767
"@jupyterlab/logconsole-extension": "~4.0.0-alpha.11",
68+
"@jupyterlab/lsp": "~4.0.0-alpha.11",
69+
"@jupyterlab/lsp-extension": "~4.0.0-alpha.11",
6870
"@jupyterlab/mainmenu": "~4.0.0-alpha.11",
6971
"@jupyterlab/mainmenu-extension": "~4.0.0-alpha.11",
7072
"@jupyterlab/markdownviewer": "~4.0.0-alpha.11",
@@ -155,6 +157,7 @@
155157
"@jupyterlab/json-extension": "~4.0.0-alpha.11",
156158
"@jupyterlab/launcher-extension": "~4.0.0-alpha.11",
157159
"@jupyterlab/logconsole-extension": "~4.0.0-alpha.11",
160+
"@jupyterlab/lsp-extension": "~4.0.0-alpha.11",
158161
"@jupyterlab/mainmenu-extension": "~4.0.0-alpha.11",
159162
"@jupyterlab/markdownviewer-extension": "~4.0.0-alpha.11",
160163
"@jupyterlab/markedparser-extension": "~4.0.0-alpha.11",
@@ -233,6 +236,7 @@
233236
"@jupyterlab/inspector-extension": "",
234237
"@jupyterlab/launcher-extension": "",
235238
"@jupyterlab/logconsole-extension": "",
239+
"@jupyterlab/lsp-extension": "",
236240
"@jupyterlab/mainmenu-extension": "",
237241
"@jupyterlab/markdownviewer-extension": "",
238242
"@jupyterlab/markedparser-extension": "",
@@ -281,6 +285,7 @@
281285
"@jupyterlab/inspector",
282286
"@jupyterlab/launcher",
283287
"@jupyterlab/logconsole",
288+
"@jupyterlab/lsp",
284289
"@jupyterlab/mainmenu",
285290
"@jupyterlab/markdownviewer",
286291
"@jupyterlab/notebook",
@@ -364,6 +369,8 @@
364369
"@jupyterlab/launcher-extension": "../packages/launcher-extension",
365370
"@jupyterlab/logconsole": "../packages/logconsole",
366371
"@jupyterlab/logconsole-extension": "../packages/logconsole-extension",
372+
"@jupyterlab/lsp": "../packages/lsp",
373+
"@jupyterlab/lsp-extension": "../packages/lsp-extension",
367374
"@jupyterlab/mainmenu": "../packages/mainmenu",
368375
"@jupyterlab/mainmenu-extension": "../packages/mainmenu-extension",
369376
"@jupyterlab/markdownviewer": "../packages/markdownviewer",

dev_mode/style.js

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import '@jupyterlab/javascript-extension/style/index.js';
2525
import '@jupyterlab/json-extension/style/index.js';
2626
import '@jupyterlab/launcher-extension/style/index.js';
2727
import '@jupyterlab/logconsole-extension/style/index.js';
28+
import '@jupyterlab/lsp-extension/style/index.js';
2829
import '@jupyterlab/mainmenu-extension/style/index.js';
2930
import '@jupyterlab/markdownviewer-extension/style/index.js';
3031
import '@jupyterlab/markedparser-extension/style/index.js';

examples/app/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const extensions = [
3131
import('@jupyterlab/imageviewer-extension'),
3232
import('@jupyterlab/inspector-extension'),
3333
import('@jupyterlab/launcher-extension'),
34+
import('@jupyterlab/lsp-extension'),
3435
import('@jupyterlab/mainmenu-extension'),
3536
import('@jupyterlab/markdownviewer-extension'),
3637
import('@jupyterlab/mathjax2-extension'),

examples/app/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"@jupyterlab/imageviewer-extension": "^4.0.0-alpha.11",
2424
"@jupyterlab/inspector-extension": "^4.0.0-alpha.11",
2525
"@jupyterlab/launcher-extension": "^4.0.0-alpha.11",
26+
"@jupyterlab/lsp-extension": "^4.0.0-alpha.11",
2627
"@jupyterlab/mainmenu-extension": "^4.0.0-alpha.11",
2728
"@jupyterlab/markdownviewer-extension": "^4.0.0-alpha.11",
2829
"@jupyterlab/mathjax2-extension": "^4.0.0-alpha.11",
@@ -76,6 +77,7 @@
7677
"@jupyterlab/inspector-extension",
7778
"@jupyterlab/json-extension",
7879
"@jupyterlab/launcher-extension",
80+
"@jupyterlab/lsp-extension",
7981
"@jupyterlab/mainmenu-extension",
8082
"@jupyterlab/markdownviewer-extension",
8183
"@jupyterlab/mathjax2-extension",

examples/example.spec.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ test('should load the example', async ({ page }) => {
1515

1616
const handleMessage = async (msg: ConsoleMessage) => {
1717
const text = msg.text();
18+
const url = msg.location().url;
1819
console.log(msg.type(), '>>', text);
19-
if (msg.type() === 'error') {
20+
// Skip the missing lsp handler error
21+
if (msg.type() === 'error' && !url.includes('lsp/status')) {
2022
errorLogs += 1;
2123
}
2224

@@ -39,5 +41,5 @@ test('should load the example', async ({ page }) => {
3941

4042
await waitForTestEnd;
4143

42-
expect(errorLogs).toEqual(0);
44+
expect(errorLogs).toEqual(0); // Missing lsp handlers
4345
});

examples/federated/core_package/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
"@jupyterlab/launcher-extension": "~4.0.0-alpha.11",
5050
"@jupyterlab/logconsole": "^4.0.0-alpha.2",
5151
"@jupyterlab/logconsole-extension": "~4.0.0-alpha.11",
52+
"@jupyterlab/lsp": "^4.0.0-alpha.2",
53+
"@jupyterlab/lsp-extension": "~4.0.0-alpha.11",
5254
"@jupyterlab/mainmenu": "^4.0.0-alpha.2",
5355
"@jupyterlab/mainmenu-extension": "~4.0.0-alpha.11",
5456
"@jupyterlab/mathjax2-extension": "~4.0.0-alpha.11",
@@ -121,6 +123,7 @@
121123
"@jupyterlab/json-extension": "^4.0.0-alpha.11",
122124
"@jupyterlab/launcher-extension": "^4.0.0-alpha.11",
123125
"@jupyterlab/logconsole-extension": "^4.0.0-alpha.11",
126+
"@jupyterlab/lsp-extension": "^4.0.0-alpha.11",
124127
"@jupyterlab/mainmenu-extension": "^4.0.0-alpha.11",
125128
"@jupyterlab/mathjax2-extension": "^4.0.0-alpha.11",
126129
"@jupyterlab/notebook-extension": "^4.0.0-alpha.11",
@@ -181,6 +184,7 @@
181184
"@jupyterlab/inspector",
182185
"@jupyterlab/launcher",
183186
"@jupyterlab/logconsole",
187+
"@jupyterlab/lsp",
184188
"@jupyterlab/mainmenu",
185189
"@jupyterlab/notebook",
186190
"@jupyterlab/rendermime",
@@ -234,6 +238,7 @@
234238
"@jupyterlab/json-extension",
235239
"@jupyterlab/launcher-extension",
236240
"@jupyterlab/logconsole-extension",
241+
"@jupyterlab/lsp-extension",
237242
"@jupyterlab/mainmenu-extension",
238243
"@jupyterlab/mathjax2-extension",
239244
"@jupyterlab/notebook-extension",

galata/test/benchmark/notebook.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ test.describe('Benchmark', () => {
137137
// Shutdown the kernel to be sure it does not get in our way (especially for the close action)
138138
await page.click('li[role="menuitem"]:has-text("Kernel")');
139139
await page.click('ul[role="menu"] >> text=Shut Down All Kernels…');
140-
await page.click(':nth-match(button:has-text("Shut Down All"), 3)');
140+
await page.click('button:has-text("Shut Down All") >> nth=-1'); // Click on the last matched button.
141141

142142
// Open text file
143143
const fromTime = await perf.measure(async () => {
Loading
Loading

jupyterlab/staging/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@
6565
"@jupyterlab/launcher-extension": "~4.0.0-alpha.11",
6666
"@jupyterlab/logconsole": "~4.0.0-alpha.11",
6767
"@jupyterlab/logconsole-extension": "~4.0.0-alpha.11",
68+
"@jupyterlab/lsp": "~4.0.0-alpha.11",
69+
"@jupyterlab/lsp-extension": "~4.0.0-alpha.11",
6870
"@jupyterlab/mainmenu": "~4.0.0-alpha.11",
6971
"@jupyterlab/mainmenu-extension": "~4.0.0-alpha.11",
7072
"@jupyterlab/markdownviewer": "~4.0.0-alpha.11",
@@ -155,6 +157,7 @@
155157
"@jupyterlab/json-extension": "~4.0.0-alpha.11",
156158
"@jupyterlab/launcher-extension": "~4.0.0-alpha.11",
157159
"@jupyterlab/logconsole-extension": "~4.0.0-alpha.11",
160+
"@jupyterlab/lsp-extension": "~4.0.0-alpha.11",
158161
"@jupyterlab/mainmenu-extension": "~4.0.0-alpha.11",
159162
"@jupyterlab/markdownviewer-extension": "~4.0.0-alpha.11",
160163
"@jupyterlab/markedparser-extension": "~4.0.0-alpha.11",
@@ -233,6 +236,7 @@
233236
"@jupyterlab/inspector-extension": "",
234237
"@jupyterlab/launcher-extension": "",
235238
"@jupyterlab/logconsole-extension": "",
239+
"@jupyterlab/lsp-extension": "",
236240
"@jupyterlab/mainmenu-extension": "",
237241
"@jupyterlab/markdownviewer-extension": "",
238242
"@jupyterlab/markedparser-extension": "",
@@ -281,6 +285,7 @@
281285
"@jupyterlab/inspector",
282286
"@jupyterlab/launcher",
283287
"@jupyterlab/logconsole",
288+
"@jupyterlab/lsp",
284289
"@jupyterlab/mainmenu",
285290
"@jupyterlab/markdownviewer",
286291
"@jupyterlab/notebook",

packages/fileeditor-extension/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@jupyterlab/filebrowser": "^4.0.0-alpha.11",
5151
"@jupyterlab/fileeditor": "^4.0.0-alpha.11",
5252
"@jupyterlab/launcher": "^4.0.0-alpha.11",
53+
"@jupyterlab/lsp": "^4.0.0-alpha.11",
5354
"@jupyterlab/mainmenu": "^4.0.0-alpha.11",
5455
"@jupyterlab/observables": "^5.0.0-alpha.11",
5556
"@jupyterlab/services": "^7.0.0-alpha.11",

packages/fileeditor-extension/src/index.ts

+39
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { ISearchProviderRegistry } from '@jupyterlab/documentsearch';
3131
import { IFileBrowserFactory } from '@jupyterlab/filebrowser';
3232
import {
3333
FileEditor,
34+
FileEditorAdapter,
3435
FileEditorFactory,
3536
FileEditorSearchProvider,
3637
IEditorTracker,
@@ -40,6 +41,11 @@ import {
4041
TabSpaceStatus
4142
} from '@jupyterlab/fileeditor';
4243
import { ILauncher } from '@jupyterlab/launcher';
44+
import {
45+
ILSPCodeExtractorsManager,
46+
ILSPDocumentConnectionManager,
47+
ILSPFeatureManager
48+
} from '@jupyterlab/lsp';
4349
import { IMainMenu } from '@jupyterlab/mainmenu';
4450
import { IObservableList } from '@jupyterlab/observables';
4551
import { Session } from '@jupyterlab/services';
@@ -50,6 +56,7 @@ import { ITranslator } from '@jupyterlab/translation';
5056
import { find, toArray } from '@lumino/algorithm';
5157
import { JSONObject } from '@lumino/coreutils';
5258
import { Menu, Widget } from '@lumino/widgets';
59+
5360
import { CommandIDs, Commands, FACTORY, IFileTypeData } from './commands';
5461

5562
export { Commands } from './commands';
@@ -195,13 +202,27 @@ const searchProvider: JupyterFrontEndPlugin<void> = {
195202
}
196203
};
197204

205+
const languageServerPlugin: JupyterFrontEndPlugin<void> = {
206+
id: '@jupyterlab/fileeditor-extension:language-server',
207+
requires: [
208+
IEditorTracker,
209+
ILSPDocumentConnectionManager,
210+
ILSPFeatureManager,
211+
ILSPCodeExtractorsManager
212+
],
213+
214+
activate: activateFileEditorLanguageServer,
215+
autoStart: true
216+
};
217+
198218
/**
199219
* Export the plugins as default.
200220
*/
201221
const plugins: JupyterFrontEndPlugin<any>[] = [
202222
plugin,
203223
lineColStatus,
204224
completerPlugin,
225+
languageServerPlugin,
205226
searchProvider,
206227
tabSpaceStatus
207228
];
@@ -534,3 +555,21 @@ function activateFileEditorCompleterService(
534555
});
535556
});
536557
}
558+
559+
function activateFileEditorLanguageServer(
560+
app: JupyterFrontEnd,
561+
editors: IEditorTracker,
562+
connectionManager: ILSPDocumentConnectionManager,
563+
featureManager: ILSPFeatureManager,
564+
extractorManager: ILSPCodeExtractorsManager
565+
): void {
566+
editors.widgetAdded.connect(async (_, editor) => {
567+
const adapter = new FileEditorAdapter(editor, {
568+
connectionManager,
569+
featureManager,
570+
foreignCodeExtractorsManager: extractorManager,
571+
docRegistry: app.docRegistry
572+
});
573+
connectionManager.registerAdapter(editor.context.path, adapter);
574+
});
575+
}

packages/fileeditor-extension/style/index.css

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
@import url('~@jupyterlab/filebrowser/style/index.css');
1818
@import url('~@jupyterlab/toc/style/index.css');
1919
@import url('~@jupyterlab/console/style/index.css');
20+
@import url('~@jupyterlab/lsp/style/index.css');
2021
@import url('~@jupyterlab/fileeditor/style/index.css');
2122
@import url('~@jupyterlab/launcher/style/index.css');
2223
@import url('~@jupyterlab/mainmenu/style/index.css');

packages/fileeditor-extension/style/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import '@jupyterlab/completer/style/index.js';
1717
import '@jupyterlab/filebrowser/style/index.js';
1818
import '@jupyterlab/toc/style/index.js';
1919
import '@jupyterlab/console/style/index.js';
20+
import '@jupyterlab/lsp/style/index.js';
2021
import '@jupyterlab/fileeditor/style/index.js';
2122
import '@jupyterlab/launcher/style/index.js';
2223
import '@jupyterlab/mainmenu/style/index.js';

packages/fileeditor-extension/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
{
4343
"path": "../launcher"
4444
},
45+
{
46+
"path": "../lsp"
47+
},
4548
{
4649
"path": "../mainmenu"
4750
},

packages/fileeditor/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"@jupyterlab/codemirror": "^4.0.0-alpha.11",
4545
"@jupyterlab/docregistry": "^4.0.0-alpha.11",
4646
"@jupyterlab/documentsearch": "^4.0.0-alpha.11",
47+
"@jupyterlab/lsp": "^4.0.0-alpha.11",
4748
"@jupyterlab/statusbar": "^4.0.0-alpha.11",
4849
"@jupyterlab/toc": "^6.0.0-alpha.11",
4950
"@jupyterlab/translation": "^4.0.0-alpha.11",

0 commit comments

Comments
 (0)