Skip to content

Commit b5557f4

Browse files
author
Kartik Raj
authored
Migrate over to using enabledApiProposals in package.json (#18269)
* Migrate over to using `enabledApiProposals` in `package.json` * Update webpack build for browser * Upgrade vscode engine * Remove unused notebook class * Remove unnecessary proposed API
1 parent 2883012 commit b5557f4

25 files changed

+608
-2810
lines changed

package-lock.json

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

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"languageServerVersion": "0.5.30",
2020
"publisher": "ms-python",
21-
"enableProposedApi": true,
21+
"enabledApiProposals": ["languageStatus", "quickPickSortByLabel", "quickPickSeparators", "testObserver", "notebookEditor"],
2222
"author": {
2323
"name": "Microsoft Corporation"
2424
},
@@ -38,7 +38,7 @@
3838
"theme": "dark"
3939
},
4040
"engines": {
41-
"vscode": "^1.61.0"
41+
"vscode": "^1.63.0"
4242
},
4343
"keywords": [
4444
"python",
@@ -1954,7 +1954,7 @@
19541954
"@types/tmp": "0.0.33",
19551955
"@types/untildify": "^3.0.0",
19561956
"@types/uuid": "^3.4.3",
1957-
"@types/vscode": "~1.53.0",
1957+
"@types/vscode": "~1.63.0",
19581958
"@types/winreg": "^1.2.30",
19591959
"@types/xml2js": "^0.4.2",
19601960
"@typescript-eslint/eslint-plugin": "^3.7.0",

src/client/activation/node/activator.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ export class NodeLanguageServerActivator extends LanguageServerActivatorBase {
7070
if (languageClient) {
7171
// Turn our item into a ProtocolCompletionItem before we convert it. This preserves the .data
7272
// attribute that it has and is needed to match on the language server side.
73-
const protoItem: ProtocolCompletionItem = new ProtocolCompletionItem(item.label);
73+
const protoItem: ProtocolCompletionItem = new ProtocolCompletionItem(
74+
typeof item.label === 'string' ? item.label : item.label.label,
75+
);
7476
Object.assign(protoItem, item);
7577

7678
const args = languageClient.code2ProtocolConverter.asCompletionItem(protoItem);

src/client/common/application/debugService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class DebugService implements IDebugService {
2828
public get activeDebugSession(): DebugSession | undefined {
2929
return debug.activeDebugSession;
3030
}
31-
public get breakpoints(): Breakpoint[] {
31+
public get breakpoints(): readonly Breakpoint[] {
3232
return debug.breakpoints;
3333
}
3434
public get onDidChangeActiveDebugSession(): Event<DebugSession | undefined> {

src/client/common/application/documentManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class DocumentManager implements IDocumentManager {
2929
public get activeTextEditor(): TextEditor | undefined {
3030
return window.activeTextEditor;
3131
}
32-
public get visibleTextEditors(): TextEditor[] {
32+
public get visibleTextEditors(): readonly TextEditor[] {
3333
return window.visibleTextEditors;
3434
}
3535
public get onDidChangeActiveTextEditor(): Event<TextEditor | undefined> {
@@ -38,7 +38,7 @@ export class DocumentManager implements IDocumentManager {
3838
public get onDidChangeTextDocument(): Event<TextDocumentChangeEvent> {
3939
return workspace.onDidChangeTextDocument;
4040
}
41-
public get onDidChangeVisibleTextEditors(): Event<TextEditor[]> {
41+
public get onDidChangeVisibleTextEditors(): Event<readonly TextEditor[]> {
4242
return window.onDidChangeVisibleTextEditors;
4343
}
4444
public get onDidChangeTextEditorSelection(): Event<TextEditorSelectionChangeEvent> {

src/client/common/application/notebook.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/client/common/application/types.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ import {
5959
WorkspaceFolderPickOptions,
6060
WorkspaceFoldersChangeEvent,
6161
} from 'vscode';
62-
import type { NotebookConcatTextDocument, NotebookDocument } from 'vscode-proposed';
6362

6463
import { Channel } from '../constants';
6564
import { Resource } from '../types';
@@ -522,7 +521,7 @@ export interface IDocumentManager {
522521
/**
523522
* The currently visible editors or an empty array.
524523
*/
525-
readonly visibleTextEditors: TextEditor[];
524+
readonly visibleTextEditors: readonly TextEditor[];
526525

527526
/**
528527
* An [event](#Event) which fires when the [active editor](#window.activeTextEditor)
@@ -542,7 +541,7 @@ export interface IDocumentManager {
542541
* An [event](#Event) which fires when the array of [visible editors](#window.visibleTextEditors)
543542
* has changed.
544543
*/
545-
readonly onDidChangeVisibleTextEditors: Event<TextEditor[]>;
544+
readonly onDidChangeVisibleTextEditors: Event<readonly TextEditor[]>;
546545

547546
/**
548547
* An [event](#Event) which fires when the selection in an editor has changed.
@@ -874,7 +873,7 @@ export interface IDebugService {
874873
/**
875874
* List of breakpoints.
876875
*/
877-
readonly breakpoints: Breakpoint[];
876+
readonly breakpoints: readonly Breakpoint[];
878877

879878
/**
880879
* An [event](#Event) which fires when the [active debug session](#debug.activeDebugSession)
@@ -1099,10 +1098,3 @@ export interface IClipboard {
10991098
*/
11001099
writeText(value: string): Promise<void>;
11011100
}
1102-
export const IVSCodeNotebook = Symbol('IVSCodeNotebook');
1103-
export interface IVSCodeNotebook {
1104-
readonly notebookDocuments: ReadonlyArray<NotebookDocument>;
1105-
readonly onDidOpenNotebookDocument: Event<NotebookDocument>;
1106-
readonly onDidCloseNotebookDocument: Event<NotebookDocument>;
1107-
createConcatTextDocument(notebook: NotebookDocument, selector?: DocumentSelector): NotebookConcatTextDocument;
1108-
}

src/client/common/serviceRegistry.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import { DebugSessionTelemetry } from './application/debugSessionTelemetry';
3636
import { DocumentManager } from './application/documentManager';
3737
import { Extensions } from './application/extensions';
3838
import { LanguageService } from './application/languageService';
39-
import { VSCodeNotebook } from './application/notebook';
4039
import { TerminalManager } from './application/terminalManager';
4140
import {
4241
IActiveResourceService,
@@ -50,7 +49,6 @@ import {
5049
IJupyterExtensionDependencyManager,
5150
ILanguageService,
5251
ITerminalManager,
53-
IVSCodeNotebook,
5452
IWorkspaceService,
5553
} from './application/types';
5654
import { WorkspaceService } from './application/workspace';
@@ -123,7 +121,6 @@ export function registerTypes(serviceManager: IServiceManager): void {
123121
serviceManager.addSingleton<ITerminalServiceFactory>(ITerminalServiceFactory, TerminalServiceFactory);
124122
serviceManager.addSingleton<IPathUtils>(IPathUtils, PathUtils);
125123
serviceManager.addSingleton<IApplicationShell>(IApplicationShell, ApplicationShell);
126-
serviceManager.addSingleton<IVSCodeNotebook>(IVSCodeNotebook, VSCodeNotebook);
127124
serviceManager.addSingleton<IClipboard>(IClipboard, ClipboardService);
128125
serviceManager.addSingleton<ICurrentProcess>(ICurrentProcess, CurrentProcess);
129126
serviceManager.addSingleton<IInstaller>(IInstaller, ProductInstaller);

src/client/testing/testController/common/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import { TestDiscoveryOptions } from '../../common/types';
1515

1616
export type TestRunInstanceOptions = TestRunOptions & {
17-
exclude?: TestItem[];
17+
exclude?: readonly TestItem[];
1818
debug: boolean;
1919
};
2020

@@ -51,8 +51,8 @@ export interface ITestController {
5151
}
5252

5353
export interface ITestRun {
54-
includes: TestItem[];
55-
excludes: TestItem[];
54+
includes: readonly TestItem[];
55+
excludes: readonly TestItem[];
5656
runKind: TestRunProfileKind;
5757
runInstance: TestRun;
5858
}

src/client/testing/testController/unittest/runner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class UnittestRunner implements ITestsRunner {
5252
}
5353

5454
private async runTest(
55-
testNodes: TestItem[],
55+
testNodes: readonly TestItem[],
5656
runInstance: TestRun,
5757
options: TestRunInstanceOptions,
5858
idToRawData: Map<string, TestData>,

src/test/common/terminals/activation.unit.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ suite('Terminal Auto Activation', () => {
2525
let terminal: Terminal;
2626

2727
setup(() => {
28-
terminal = {
28+
terminal = ({
2929
dispose: noop,
3030
hide: noop,
3131
name: 'Python',
@@ -34,7 +34,7 @@ suite('Terminal Auto Activation', () => {
3434
sendText: noop,
3535
show: noop,
3636
exitStatus: { code: 0 },
37-
};
37+
} as unknown) as Terminal;
3838
terminalManager = mock(TerminalManager);
3939
activator = mock(TerminalActivator);
4040
activeResourceService = mock(ActiveResourceService);
@@ -68,7 +68,7 @@ suite('Terminal Auto Activation', () => {
6868
verify(activator.activateEnvironmentInTerminal(terminal, anything())).once();
6969
});
7070
test('New Terminals should not be activated if hidden from user', async () => {
71-
terminal = {
71+
terminal = ({
7272
dispose: noop,
7373
hide: noop,
7474
name: 'Python',
@@ -77,7 +77,7 @@ suite('Terminal Auto Activation', () => {
7777
sendText: noop,
7878
show: noop,
7979
exitStatus: { code: 0 },
80-
};
80+
} as unknown) as Terminal;
8181
type EventHandler = (e: Terminal) => void;
8282
let handler: undefined | EventHandler;
8383
const handlerDisposable = TypeMoq.Mock.ofType<IDisposable>();
@@ -98,7 +98,7 @@ suite('Terminal Auto Activation', () => {
9898
verify(activator.activateEnvironmentInTerminal(terminal, anything())).never();
9999
});
100100
test('New Terminals should not be activated if auto activation is to be disabled', async () => {
101-
terminal = {
101+
terminal = ({
102102
dispose: noop,
103103
hide: noop,
104104
name: 'Python',
@@ -107,7 +107,7 @@ suite('Terminal Auto Activation', () => {
107107
sendText: noop,
108108
show: noop,
109109
exitStatus: { code: 0 },
110-
};
110+
} as unknown) as Terminal;
111111
type EventHandler = (e: Terminal) => void;
112112
let handler: undefined | EventHandler;
113113
const handlerDisposable = TypeMoq.Mock.ofType<IDisposable>();

0 commit comments

Comments
 (0)