Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1936,7 +1936,7 @@
"@types/tmp": "0.0.33",
"@types/untildify": "^3.0.0",
"@types/uuid": "^3.4.3",
"@types/vscode": "~1.53.0",
"@types/vscode": "~1.60.0",
"@types/winreg": "^1.2.30",
"@types/xml2js": "^0.4.2",
"@typescript-eslint/eslint-plugin": "^3.7.0",
Expand Down
4 changes: 3 additions & 1 deletion src/client/activation/node/activator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ export class NodeLanguageServerActivator extends LanguageServerActivatorBase {
if (languageClient) {
// Turn our item into a ProtocolCompletionItem before we convert it. This preserves the .data
// attribute that it has and is needed to match on the language server side.
const protoItem: ProtocolCompletionItem = new ProtocolCompletionItem(item.label);
const protoItem: ProtocolCompletionItem = new ProtocolCompletionItem(
typeof item.label === 'string' ? item.label : item.label.label,
);
Object.assign(protoItem, item);

const args = languageClient.code2ProtocolConverter.asCompletionItem(protoItem);
Expand Down
2 changes: 2 additions & 0 deletions src/test/mockClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export class MockStatusBarItem implements vscode.StatusBarItem {
public tooltip!: string;
public color!: string;
public command!: string;
public id: string = '';
public name: string = '';

public show(): void {}

Expand Down
4 changes: 4 additions & 0 deletions src/test/mocks/mementos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export class MockMemento implements Memento {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private _value: Record<string, any> = {};

public keys(): string[] {
return Object.keys(this._value);
}

// @ts-ignore Ignore the return value warning
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
public get(key: any, defaultValue?: any);
Expand Down
50 changes: 36 additions & 14 deletions types/vscode-proposed/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
//#region https://github.com/microsoft/vscode/issues/106744, Notebooks (misc)

export enum NotebookCellKind {
Markdown = 1,
Markup = 1,
Code = 2,
}

Expand Down Expand Up @@ -410,19 +410,6 @@ export class NotebookCellOutputItem {
constructor(mime: string, value: unknown, metadata?: Record<string, any>);
}

// @jrieken
// todo@API think about readonly...
//TODO@API add execution count to cell output?
export class NotebookCellOutput {
readonly id: string;
readonly outputs: NotebookCellOutputItem[];
readonly metadata?: Record<string, any>;

constructor(outputs: NotebookCellOutputItem[], metadata?: Record<string, any>);

constructor(outputs: NotebookCellOutputItem[], id: string, metadata?: Record<string, any>);
}

//#endregion

//#region https://github.com/microsoft/vscode/issues/106744, NotebookEditorEdit
Expand Down Expand Up @@ -681,6 +668,41 @@ export interface NotebookKernelPreload {
uri: Uri;
}

/**
* Notebook cell output represents a result of executing a cell. It is a container type for multiple
* {@link NotebookCellOutputItem output items} where contained items represent the same result but
* use different MIME types.
*/
export class NotebookCellOutput {
/**
* The output items of this output. Each item must represent the same result. _Note_ that repeated
* MIME types per output is invalid and that the editor will just pick one of them.
*
* ```ts
* new vscode.NotebookCellOutput([
* vscode.NotebookCellOutputItem.text('Hello', 'text/plain'),
* vscode.NotebookCellOutputItem.text('<i>Hello</i>', 'text/html'),
* vscode.NotebookCellOutputItem.text('_Hello_', 'text/markdown'),
* vscode.NotebookCellOutputItem.text('Hey', 'text/plain'), // INVALID: repeated type, editor will pick just one
* ])
* ```
*/
items: NotebookCellOutputItem[];

/**
* Arbitrary metadata for this cell output. Can be anything but must be JSON-stringifyable.
*/
metadata?: { [key: string]: any };

/**
* Create new notebook output.
*
* @param items Notebook output items.
* @param metadata Optional metadata.
*/
constructor(items: NotebookCellOutputItem[], metadata?: { [key: string]: any });
}

export interface NotebookKernel {
// todo@API make this mandatory?
readonly id?: string;
Expand Down
114 changes: 9 additions & 105 deletions types/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
declare module 'vscode' {
//#region https://github.com/microsoft/vscode/issues/106744, Notebooks (misc)

export enum NotebookCellKind {
Markdown = 1,
Code = 2,
}

export class NotebookCellMetadata {
/**
* Whether a code cell's editor is collapsed
Expand Down Expand Up @@ -43,24 +38,6 @@ declare module 'vscode' {
}): NotebookCellMetadata;
}

export interface NotebookCellExecutionSummary {
executionOrder?: number;
success?: boolean;
startTime?: number;
endTime?: number;
}

// todo@API support ids https://github.com/jupyter/enhancement-proposals/blob/master/62-cell-id/cell-id.md
export interface NotebookCell {
readonly index: number;
readonly notebook: NotebookDocument;
readonly kind: NotebookCellKind;
readonly document: TextDocument;
readonly metadata: NotebookCellMetadata;
readonly outputs: ReadonlyArray<NotebookCellOutput>;
readonly latestExecutionSummary: NotebookCellExecutionSummary | undefined;
}

export class NotebookDocumentMetadata {
/**
* @deprecated
Expand Down Expand Up @@ -114,8 +91,6 @@ declare module 'vscode' {
*/
readonly isClosed: boolean;

readonly metadata: NotebookDocumentMetadata;

// todo@API should we really expose this?
readonly notebookType: string;

Expand Down Expand Up @@ -263,29 +238,6 @@ declare module 'vscode' {
readonly cell: NotebookCell;
readonly executionState: NotebookCellExecutionState;
}

// todo@API support ids https://github.com/jupyter/enhancement-proposals/blob/master/62-cell-id/cell-id.md
export class NotebookCellData {
// todo@API should they all be readonly?
kind: NotebookCellKind;
// todo@API better names: value? text?
source: string;
// todo@API how does language and MD relate?
language: string;
// todo@API ReadonlyArray?
outputs?: NotebookCellOutput[];
metadata?: NotebookCellMetadata;
latestExecutionSummary?: NotebookCellExecutionSummary;
constructor(
kind: NotebookCellKind,
source: string,
language: string,
outputs?: NotebookCellOutput[],
metadata?: NotebookCellMetadata,
latestExecutionSummary?: NotebookCellExecutionSummary,
);
}

export class NotebookData {
// todo@API should they all be readonly?
cells: NotebookCellData[];
Expand Down Expand Up @@ -393,19 +345,6 @@ declare module 'vscode' {
constructor(mime: string, value: unknown, metadata?: Record<string, any>);
}

// @jrieken
// todo@API think about readonly...
//TODO@API add execution count to cell output?
export class NotebookCellOutput {
readonly id: string;
readonly outputs: NotebookCellOutputItem[];
readonly metadata?: Record<string, any>;

constructor(outputs: NotebookCellOutputItem[], metadata?: Record<string, any>);

constructor(outputs: NotebookCellOutputItem[], id: string, metadata?: Record<string, any>);
}

//#endregion

//#region https://github.com/microsoft/vscode/issues/106744, NotebookEditorEdit
Expand Down Expand Up @@ -528,20 +467,9 @@ declare module 'vscode' {
label: string;
description?: string;
isPreferred?: boolean;

supportedLanguages: string[];
hasExecutionOrder?: boolean;
preloads?: NotebookKernelPreload[];

/**
* The execute handler is invoked when the run gestures in the UI are selected, e.g Run Cell, Run All,
* Run Selection etc.
*/
readonly executeHandler: (cells: NotebookCell[], controller: NotebookController) => void;

// optional kernel interrupt command
interruptHandler?: (notebook: NotebookDocument) => void;

// remove kernel
dispose(): void;

Expand Down Expand Up @@ -751,16 +679,16 @@ declare module 'vscode' {
}

export interface QuickPick<T extends QuickPickItem> extends QuickInput {
/**
* An optional flag to sort the final results by index of first query match in label. Defaults to true.
*/
sortByLabel: boolean;
/**
* An optional flag to sort the final results by index of first query match in label. Defaults to true.
*/
sortByLabel: boolean;

/*
* An optional flag that can be set to true to maintain the scroll position of the quick pick when the quick pick items are updated. Defaults to false.
*/
keepScrollPosition?: boolean;
}
/*
* An optional flag that can be set to true to maintain the scroll position of the quick pick when the quick pick items are updated. Defaults to false.
*/
keepScrollPosition?: boolean;
}

export enum NotebookCellExecutionState {
Idle = 1,
Expand Down Expand Up @@ -854,21 +782,6 @@ declare module 'vscode' {

//#region https://github.com/microsoft/vscode/issues/106744, NotebookCellStatusBarItem

/**
* Represents the alignment of status bar items.
*/
export enum NotebookCellStatusBarAlignment {
/**
* Aligned to the left side.
*/
Left = 1,

/**
* Aligned to the right side.
*/
Right = 2,
}

export class NotebookCellStatusBarItem {
readonly text: string;
readonly alignment: NotebookCellStatusBarAlignment;
Expand Down Expand Up @@ -1052,15 +965,6 @@ declare module 'vscode' {
export const testResults: ReadonlyArray<TestRunResult>;
}

/**
* The kind of executions that {@link TestRunProfile TestRunProfiles} control.
*/
export enum TestRunProfileKind {
Run = 1,
Debug = 2,
Coverage = 3,
}

/**
* A TestRunProfile describes one way to execute tests in a {@link TestController}.
*/
Expand Down