Skip to content

[Ignore] Update Notebook dts #3000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 12, 2020
Merged
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
2 changes: 1 addition & 1 deletion src/features/PowerShellNotebooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class PowerShellNotebooksFeature extends LanguageClientConsumer {
}

private static async DisableNotebookMode() {
const uri = vscode.notebook.activeNotebookEditor.document.uri;
const uri = vscode.window.activeNotebookEditor.document.uri;
await vscode.commands.executeCommand("workbench.action.closeActiveEditor");
await vscode.commands.executeCommand("vscode.openWith", uri, "default");
}
Expand Down
18 changes: 9 additions & 9 deletions test/features/PowerShellNotebooks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,11 @@ suite("PowerShellNotebooks tests", () => {
// Allow some time to pass to render the Notebook
await utils.sleep(5000);
assert.strictEqual(
vscode.notebook.activeNotebookEditor.document.uri.toString(),
vscode.window.activeNotebookEditor.document.uri.toString(),
notebookSimpleMixedComments.toString());

// Save it as testFile.ps1 and reopen it using the feature.
await notebookContentProvider.saveNotebookAs(uri, vscode.notebook.activeNotebookEditor.document, null);
await notebookContentProvider.saveNotebookAs(uri, vscode.window.activeNotebookEditor.document, null);
const newNotebook = await notebookContentProvider.openNotebook(uri, {});

// Compare that saving as a file results in the same cell data as the existing one.
Expand All @@ -376,12 +376,12 @@ suite("PowerShellNotebooks tests", () => {
// Allow some time to pass to render the Notebook
await utils.sleep(5000);
assert.strictEqual(
vscode.notebook.activeNotebookEditor.document.uri.toString(),
vscode.window.activeNotebookEditor.document.uri.toString(),
notebookBlockCommentsWithTextOnSameLine.toString());

// Save it as testFile1.ps1
const contentOfBackingFileBefore = (await vscode.workspace.fs.readFile(notebookBlockCommentsWithTextOnSameLine)).toString();
await notebookContentProvider.saveNotebookAs(uri, vscode.notebook.activeNotebookEditor.document, null);
await notebookContentProvider.saveNotebookAs(uri, vscode.window.activeNotebookEditor.document, null);
const contentOfBackingFileAfter = (await vscode.workspace.fs.readFile(uri)).toString();

// Verify that saving does not mutate result.
Expand All @@ -405,10 +405,10 @@ gci`,

test(".Notebook.ps1 files are opened automatically", async () => {
await vscode.commands.executeCommand("vscode.open", notebookSimpleDotNotebook);
assert.strictEqual(vscode.notebook.activeNotebookEditor.document.cells.length, 2);
assert.strictEqual(vscode.notebook.activeNotebookEditor.document.cells[0].cellKind, vscode.CellKind.Markdown);
assert.strictEqual(vscode.notebook.activeNotebookEditor.document.cells[0].document.getText(), "asdf");
assert.strictEqual(vscode.notebook.activeNotebookEditor.document.cells[1].cellKind, vscode.CellKind.Code);
assert.strictEqual(vscode.notebook.activeNotebookEditor.document.cells[1].document.getText(), "gci\n");
assert.strictEqual(vscode.window.activeNotebookEditor.document.cells.length, 2);
assert.strictEqual(vscode.window.activeNotebookEditor.document.cells[0].cellKind, vscode.CellKind.Markdown);
assert.strictEqual(vscode.window.activeNotebookEditor.document.cells[0].document.getText(), "asdf");
assert.strictEqual(vscode.window.activeNotebookEditor.document.cells[1].cellKind, vscode.CellKind.Code);
assert.strictEqual(vscode.window.activeNotebookEditor.document.cells[1].document.getText(), "gci\n");
}).timeout(20000);
});
28 changes: 10 additions & 18 deletions vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,16 +341,6 @@ declare module 'vscode' {
*/
readonly viewColumn?: ViewColumn;

/**
* Whether the panel is active (focused by the user).
*/
readonly active: boolean;

/**
* Whether the panel is visible.
*/
readonly visible: boolean;

/**
* Fired when the panel is disposed.
*/
Expand Down Expand Up @@ -687,6 +677,7 @@ declare module 'vscode' {
): Disposable;

export function createNotebookEditorDecorationType(options: NotebookDecorationRenderOptions): NotebookEditorDecorationType;
export function openNotebookDocument(uri: Uri, viewType?: string): Promise<NotebookDocument>;
export const onDidOpenNotebookDocument: Event<NotebookDocument>;
export const onDidCloseNotebookDocument: Event<NotebookDocument>;
export const onDidSaveNotebookDocument: Event<NotebookDocument>;
Expand All @@ -695,14 +686,6 @@ declare module 'vscode' {
* All currently known notebook documents.
*/
export const notebookDocuments: ReadonlyArray<NotebookDocument>;

export const visibleNotebookEditors: NotebookEditor[];
export const onDidChangeVisibleNotebookEditors: Event<NotebookEditor[]>;

export const activeNotebookEditor: NotebookEditor | undefined;
export const onDidChangeActiveNotebookEditor: Event<NotebookEditor | undefined>;
export const onDidChangeNotebookEditorSelection: Event<NotebookEditorSelectionChangeEvent>;
export const onDidChangeNotebookEditorVisibleRanges: Event<NotebookEditorVisibleRangesChangeEvent>;
export const onDidChangeNotebookDocumentMetadata: Event<NotebookDocumentMetadataChangeEvent>;
export const onDidChangeNotebookCells: Event<NotebookCellsChangeEvent>;
export const onDidChangeCellOutputs: Event<NotebookCellOutputsChangeEvent>;
Expand Down Expand Up @@ -731,5 +714,14 @@ declare module 'vscode' {
export function createCellStatusBarItem(cell: NotebookCell, alignment?: NotebookCellStatusBarAlignment, priority?: number): NotebookCellStatusBarItem;
}

export namespace window {
export const visibleNotebookEditors: NotebookEditor[];
export const onDidChangeVisibleNotebookEditors: Event<NotebookEditor[]>;
export const activeNotebookEditor: NotebookEditor | undefined;
export const onDidChangeActiveNotebookEditor: Event<NotebookEditor | undefined>;
export const onDidChangeNotebookEditorSelection: Event<NotebookEditorSelectionChangeEvent>;
export const onDidChangeNotebookEditorVisibleRanges: Event<NotebookEditorVisibleRangesChangeEvent>;
}

//#endregion
}