This commit is contained in:
Johannes Rieken 2021-05-31 13:06:14 +02:00
parent 3b407e0b6c
commit 83d5e2bda0
No known key found for this signature in database
GPG key ID: 96634B5AF12F8798
3 changed files with 23 additions and 13 deletions

View file

@ -859,12 +859,12 @@ suite('Notebook API tests', function () {
const p = new Promise<void>(r => resolve = r);
const listener = vscode.notebook.onDidChangeNotebookCellExecutionState(e => {
if (eventCount === 0) {
assert.strictEqual(e.executionState, vscode.NotebookCellExecutionState.Pending, 'should be set to Pending');
assert.strictEqual(e.state, vscode.NotebookCellExecutionState.Pending, 'should be set to Pending');
} else if (eventCount === 1) {
assert.strictEqual(e.executionState, vscode.NotebookCellExecutionState.Executing, 'should be set to Executing');
assert.strictEqual(e.state, vscode.NotebookCellExecutionState.Executing, 'should be set to Executing');
assert.strictEqual(cell.outputs.length, 0, 'no outputs yet: ' + JSON.stringify(cell.outputs[0]));
} else if (eventCount === 2) {
assert.strictEqual(e.executionState, vscode.NotebookCellExecutionState.Idle, 'should be set to Idle');
assert.strictEqual(e.state, vscode.NotebookCellExecutionState.Idle, 'should be set to Idle');
assert.strictEqual(cell.outputs.length, 1, 'should have an output');
resolve();
}

View file

@ -1956,7 +1956,7 @@ declare module 'vscode' {
*/
// todo@api rename to notebooks?
// todo@api what should be in this namespace? should notebookDocuments and friends be in the workspace namespace?
export namespace notebook {
export namespace notebooks {
/**
* All notebook documents currently known to the editor.
@ -2073,7 +2073,7 @@ declare module 'vscode' {
readonly state: NotebookCellExecutionState;
}
export namespace notebook {
export namespace notebooks {
/**
* An {@link Event} which fires when the execution state of a cell has changed.
@ -2085,6 +2085,15 @@ declare module 'vscode' {
//#endregion
//#region https://github.com/microsoft/vscode/issues/106744, Notebook, deprecated
/**
* @deprecated use notebooks instead
*/
export const notebook: typeof notebooks;
//#endregion
//#region https://github.com/microsoft/vscode/issues/106744, NotebookEditor
export enum NotebookEditorRevealType {
@ -2207,7 +2216,7 @@ declare module 'vscode' {
selections?: NotebookRange[];
}
export namespace notebook {
export namespace notebooks {
@ -2302,7 +2311,7 @@ declare module 'vscode' {
dispose(): void;
}
export namespace notebook {
export namespace notebooks {
export function createNotebookEditorDecorationType(options: NotebookDecorationRenderOptions): NotebookEditorDecorationType;
}
@ -2310,7 +2319,7 @@ declare module 'vscode' {
//#region https://github.com/microsoft/vscode/issues/106744, NotebookConcatTextDocument
export namespace notebook {
export namespace notebooks {
/**
* Create a document that is the concatenation of all notebook cells. By default all code-cells are included
* but a selector can be provided to narrow to down the set of cells.
@ -2395,7 +2404,7 @@ declare module 'vscode' {
backupNotebook(document: NotebookDocument, context: NotebookDocumentBackupContext, token: CancellationToken): Thenable<NotebookDocumentBackup>;
}
export namespace notebook {
export namespace notebooks {
// TODO@api use NotebookDocumentFilter instead of just notebookType:string?
// TODO@API options duplicates the more powerful variant on NotebookContentProvider
@ -2412,7 +2421,7 @@ declare module 'vscode' {
exclusive?: boolean;
}
export namespace notebook {
export namespace notebooks {
// SPECIAL overload with NotebookRegistrationData
export function registerNotebookContentProvider(notebookType: string, provider: NotebookContentProvider, options?: NotebookDocumentContentOptions, registrationData?: NotebookRegistrationData): Disposable;
// SPECIAL overload with NotebookRegistrationData
@ -2486,7 +2495,7 @@ declare module 'vscode' {
postMessage(editor: NotebookEditor, message: TSend): void;
}
export namespace notebook {
export namespace notebooks {
/**
* Creates a new messaging instance used to communicate with a specific
* renderer. The renderer only has access to messaging if `requiresMessaging`

View file

@ -1054,7 +1054,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
};
// namespace: notebook
const notebook: typeof vscode.notebook = {
const notebooks: typeof vscode.notebooks = {
async openNotebookDocument(uriOrOptions?: URI | string, content?: vscode.NotebookData) {
checkProposedApiEnabled(extension);
let uri: URI;
@ -1144,7 +1144,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
env,
extensions,
languages,
notebook,
notebooks,
notebook: notebooks,
scm,
tasks,
test,