Skip to content

Commit

Permalink
rename namespace to notebooks, #122922
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed May 31, 2021
1 parent 3b407e0 commit 83d5e2b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
25 changes: 17 additions & 8 deletions src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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 {
Expand Down Expand Up @@ -2207,7 +2216,7 @@ declare module 'vscode' {
selections?: NotebookRange[];
}

export namespace notebook {
export namespace notebooks {



Expand Down Expand Up @@ -2302,15 +2311,15 @@ declare module 'vscode' {
dispose(): void;
}

export namespace notebook {
export namespace notebooks {
export function createNotebookEditorDecorationType(options: NotebookDecorationRenderOptions): NotebookEditorDecorationType;
}

//#endregion

//#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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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`
Expand Down
5 changes: 3 additions & 2 deletions src/vs/workbench/api/common/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1144,7 +1144,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
env,
extensions,
languages,
notebook,
notebooks,
notebook: notebooks,
scm,
tasks,
test,
Expand Down

0 comments on commit 83d5e2b

Please sign in to comment.