Skip to content

Commit 379fb95

Browse files
debontekimadeline
andauthored
Upgrade to LSP 3.17 for LSP notebooks support (#18742)
* Fix sendCancellation * Upgrade vscode-jupyter-lsp-middleware * Update to latest LSP packages * Update vscode.proposed.notebookEditor.d.ts * Remove proposed api d.ts files that are no longer listed in package.json * Update mocks * Upgrade to @types/vscode 1.65.0 * Generate package-lock.json with NPM 8.5.2 * Upgrade to vscode-jupyter-lsp-middleware 0.2.40 to try to fix vscode-dts issue * Upgrade to vscode-jupyter-lsp-middleware 0.2.41 to try to fix vscode-dts issue * Back up to previous dot release of LSP which was dependent on VSC 1.63.0 instead of 1.66.0 * Add mocks to fix unit tests * Remove vscode-dts devDependency; no longer needed with middleware change * Upgrade webpack to fix Create VSIX error * Switch to latest webpack 4 and upgrade plugins * Reupgrade webpack to 5.x; upgrade ts-loader, copy-webpack-plugin * Add webpack resolve fallback to path-browserify * locators/index.ts -> wrappers.ts (webpack issues) Co-authored-by: Kim-Adeline Miguel <[email protected]>
1 parent 576d4f8 commit 379fb95

15 files changed

+1764
-3095
lines changed

build/webpack/webpack.extension.browser.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const nodeConfig = (_, { mode }) => ({
3232
// },
3333
resolve: {
3434
extensions: ['.ts', '.js'],
35+
fallback: { path: require.resolve('path-browserify') },
3536
},
3637
externals: {
3738
vscode: 'commonjs vscode',

build/webpack/webpack.extension.dependencies.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const config = {
2828
// vsls requires our package.json to be next to node_modules. It's how they
2929
// 'find' the calling extension.
3030
// eslint-disable-next-line new-cap
31-
new copyWebpackPlugin([{ from: './package.json', to: '.' }]),
31+
new copyWebpackPlugin({ patterns: [{ from: './package.json', to: '.' }] }),
3232
],
3333
resolve: {
3434
extensions: ['.js'],

package-lock.json

Lines changed: 1662 additions & 2810 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"theme": "dark"
4343
},
4444
"engines": {
45-
"vscode": "^1.63.1"
45+
"vscode": "^1.65.0"
4646
},
4747
"keywords": [
4848
"python",
@@ -1828,7 +1828,7 @@
18281828
"webpack": "webpack"
18291829
},
18301830
"dependencies": {
1831-
"@vscode/jupyter-lsp-middleware": "^0.2.35",
1831+
"@vscode/jupyter-lsp-middleware": "^0.2.41",
18321832
"arch": "^2.1.0",
18331833
"diff-match-patch": "^1.0.0",
18341834
"fs-extra": "^9.1.0",
@@ -1856,10 +1856,10 @@
18561856
"vscode-debugadapter": "^1.28.0",
18571857
"vscode-debugprotocol": "^1.28.0",
18581858
"vscode-extension-telemetry": "0.4.5",
1859-
"vscode-jsonrpc": "6.0.0",
1860-
"vscode-languageclient": "7.0.0",
1861-
"vscode-languageserver": "7.0.0",
1862-
"vscode-languageserver-protocol": "3.16.0",
1859+
"vscode-jsonrpc": "8.0.0-next.7",
1860+
"vscode-languageclient": "8.0.0-next.13",
1861+
"vscode-languageserver": "8.0.0-next.9",
1862+
"vscode-languageserver-protocol": "3.17.0-next.15",
18631863
"vscode-tas-client": "^0.1.22",
18641864
"winreg": "^1.2.4",
18651865
"xml2js": "^0.4.19"
@@ -1886,7 +1886,7 @@
18861886
"@types/tmp": "0.0.33",
18871887
"@types/untildify": "^3.0.0",
18881888
"@types/uuid": "^3.4.3",
1889-
"@types/vscode": "~1.63.0",
1889+
"@types/vscode": "~1.65.0",
18901890
"@types/winreg": "^1.2.30",
18911891
"@types/xml2js": "^0.4.2",
18921892
"@typescript-eslint/eslint-plugin": "^3.7.0",
@@ -1895,7 +1895,7 @@
18951895
"chai": "^4.1.2",
18961896
"chai-arrays": "^2.0.0",
18971897
"chai-as-promised": "^7.1.1",
1898-
"copy-webpack-plugin": "^5.1.2",
1898+
"copy-webpack-plugin": "^9.1.0",
18991899
"cross-spawn": "^6.0.5",
19001900
"del": "^3.0.0",
19011901
"download": "^7.0.0",
@@ -1929,7 +1929,7 @@
19291929
"shortid": "^2.2.8",
19301930
"sinon": "^8.0.1",
19311931
"source-map-support": "^0.5.12",
1932-
"ts-loader": "^5.3.0",
1932+
"ts-loader": "^9.2.8",
19331933
"ts-mockito": "^2.5.0",
19341934
"ts-node": "^8.3.0",
19351935
"tsconfig-paths-webpack-plugin": "^3.2.0",
@@ -1939,13 +1939,13 @@
19391939
"vsce": "^2.6.6",
19401940
"vscode-debugadapter-testsupport": "^1.27.0",
19411941
"vscode-telemetry-extractor": "^1.9.5",
1942-
"webpack": "^4.33.0",
1943-
"webpack-bundle-analyzer": "^3.6.0",
1942+
"webpack": "^5.70.0",
1943+
"webpack-bundle-analyzer": "^4.5.0",
19441944
"webpack-cli": "^3.1.2",
19451945
"webpack-fix-default-import-plugin": "^1.0.3",
1946-
"webpack-merge": "^4.1.4",
1947-
"webpack-node-externals": "^1.7.2",
1948-
"webpack-require-from": "^1.8.0",
1946+
"webpack-merge": "^5.8.0",
1947+
"webpack-node-externals": "^3.0.0",
1948+
"webpack-require-from": "^1.8.6",
19491949
"yargs": "^15.3.1"
19501950
},
19511951
"__metadata": {

src/client/activation/common/cancellationUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class FileCancellationSenderStrategy implements CancellationSenderStrategy {
4343
tryRun(() => fs.mkdirSync(folder, { recursive: true }));
4444
}
4545

46-
public sendCancellation(_: MessageConnection, id: CancellationId): void {
46+
public async sendCancellation(_: MessageConnection, id: CancellationId) {
4747
const file = getCancellationFilePath(this.folderName, id);
4848
tryRun(() => fs.writeFileSync(file, '', { flag: 'w' }));
4949
}

src/client/activation/languageClientMiddlewareBase.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
ConfigurationParams,
77
ConfigurationRequest,
88
HandleDiagnosticsSignature,
9+
LSPObject,
910
Middleware,
1011
ResponseError,
1112
} from 'vscode-languageclient';
@@ -82,12 +83,13 @@ export class LanguageClientMiddlewareBase implements Middleware {
8283
// value as though it were in the user's settings.json file.
8384
// As this is for backwards compatibility, `ConfigService.pythonPath`
8485
// can be considered as active interpreter path.
85-
settings[i].pythonPath = configService.getSettings(uri).pythonPath;
86+
const settingDict: LSPObject = settings[i] as LSPObject;
87+
settingDict.pythonPath = configService.getSettings(uri).pythonPath;
8688

8789
const env = await envService.getEnvironmentVariables(uri);
8890
const envPYTHONPATH = env.PYTHONPATH;
8991
if (envPYTHONPATH) {
90-
settings[i]._envPYTHONPATH = envPYTHONPATH;
92+
settingDict._envPYTHONPATH = envPYTHONPATH;
9193
}
9294
}
9395
}

src/client/pythonEnvironments/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { PythonEnvsResolver } from './base/locators/composite/envsResolver';
1313
import { WindowsPathEnvVarLocator } from './base/locators/lowLevel/windowsKnownPathsLocator';
1414
import { WorkspaceVirtualEnvironmentLocator } from './base/locators/lowLevel/workspaceVirtualEnvLocator';
1515
import { initializeExternalDependencies as initializeLegacyExternalDependencies } from './common/externalDependencies';
16-
import { ExtensionLocators, WatchRootsArgs, WorkspaceLocators } from './base/locators/';
16+
import { ExtensionLocators, WatchRootsArgs, WorkspaceLocators } from './base/locators/wrappers';
1717
import { CustomVirtualEnvironmentLocator } from './base/locators/lowLevel/customVirtualEnvLocator';
1818
import { CondaEnvironmentLocator } from './base/locators/lowLevel/condaLocator';
1919
import { GlobalVirtualEnvironmentLocator } from './base/locators/lowLevel/globalVirtualEnvronmentLocator';

src/test/mocks/vsc/extHostedTypes.ts

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
2+
/* eslint-disable @typescript-eslint/no-explicit-any */
13
/* eslint-disable max-classes-per-file */
24
// Copyright (c) Microsoft Corporation. All rights reserved.
35
// Licensed under the MIT License.
@@ -2078,6 +2080,8 @@ export enum ConfigurationTarget {
20782080
}
20792081

20802082
export class RelativePattern implements IRelativePattern {
2083+
baseUri: vscode.Uri;
2084+
20812085
base: string;
20822086

20832087
pattern: string;
@@ -2093,6 +2097,7 @@ export class RelativePattern implements IRelativePattern {
20932097
throw illegalArgument('pattern');
20942098
}
20952099

2100+
this.baseUri = typeof base === 'string' ? vscUri.URI.parse(base) : base.uri;
20962101
this.base = typeof base === 'string' ? base : base.uri.fsPath;
20972102
this.pattern = pattern;
20982103
}
@@ -2279,3 +2284,72 @@ export enum CommentThreadCollapsibleState {
22792284
export class QuickInputButtons {
22802285
static readonly Back: vscode.QuickInputButton = { iconPath: vscUri.URI.file('back') };
22812286
}
2287+
2288+
export enum SymbolTag {
2289+
Deprecated = 1,
2290+
}
2291+
2292+
export class TypeHierarchyItem {
2293+
name: string;
2294+
2295+
kind: SymbolKind;
2296+
2297+
tags?: ReadonlyArray<SymbolTag>;
2298+
2299+
detail?: string;
2300+
2301+
uri: vscode.Uri;
2302+
2303+
range: Range;
2304+
2305+
selectionRange: Range;
2306+
2307+
constructor(kind: SymbolKind, name: string, detail: string, uri: vscode.Uri, range: Range, selectionRange: Range) {
2308+
this.name = name;
2309+
this.kind = kind;
2310+
this.detail = detail;
2311+
this.uri = uri;
2312+
this.range = range;
2313+
this.selectionRange = selectionRange;
2314+
}
2315+
}
2316+
2317+
export declare type LSPObject = {
2318+
[key: string]: LSPAny;
2319+
};
2320+
2321+
export declare type LSPArray = LSPAny[];
2322+
2323+
export declare type integer = number;
2324+
export declare type uinteger = number;
2325+
export declare type decimal = number;
2326+
2327+
export declare type LSPAny = LSPObject | LSPArray | string | integer | uinteger | decimal | boolean | null;
2328+
2329+
export class ProtocolTypeHierarchyItem extends TypeHierarchyItem {
2330+
data?;
2331+
2332+
constructor(
2333+
kind: SymbolKind,
2334+
name: string,
2335+
detail: string,
2336+
uri: vscode.Uri,
2337+
range: Range,
2338+
selectionRange: Range,
2339+
data?: LSPAny,
2340+
) {
2341+
super(kind, name, detail, uri, range, selectionRange);
2342+
this.data = data;
2343+
}
2344+
}
2345+
2346+
export class CancellationError extends Error {}
2347+
2348+
export class LSPCancellationError extends CancellationError {
2349+
data;
2350+
2351+
constructor(data: any) {
2352+
super();
2353+
this.data = data;
2354+
}
2355+
}

src/test/mocks/vsc/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export enum LanguageStatusSeverity {
3737

3838
export enum QuickPickItemKind {
3939
Separator = -1,
40-
Default = 1,
40+
Default = 0,
4141
}
4242

4343
export class Disposable {

0 commit comments

Comments
 (0)