Skip to content

Commit 5eb2fe8

Browse files
[Ignore] Update Notebook dts (#3000)
* [Ignore] Update Notebook dts * breaking changes Co-authored-by: TylerLeonhardt <TylerLeonhardt@users.noreply.github.com> Co-authored-by: Tyler Leonhardt <tylerl0706@gmail.com>
1 parent b930c92 commit 5eb2fe8

File tree

3 files changed

+20
-28
lines changed

3 files changed

+20
-28
lines changed

src/features/PowerShellNotebooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class PowerShellNotebooksFeature extends LanguageClientConsumer {
9696
}
9797

9898
private static async DisableNotebookMode() {
99-
const uri = vscode.notebook.activeNotebookEditor.document.uri;
99+
const uri = vscode.window.activeNotebookEditor.document.uri;
100100
await vscode.commands.executeCommand("workbench.action.closeActiveEditor");
101101
await vscode.commands.executeCommand("vscode.openWith", uri, "default");
102102
}

test/features/PowerShellNotebooks.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,11 @@ suite("PowerShellNotebooks tests", () => {
350350
// Allow some time to pass to render the Notebook
351351
await utils.sleep(5000);
352352
assert.strictEqual(
353-
vscode.notebook.activeNotebookEditor.document.uri.toString(),
353+
vscode.window.activeNotebookEditor.document.uri.toString(),
354354
notebookSimpleMixedComments.toString());
355355

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

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

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

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

406406
test(".Notebook.ps1 files are opened automatically", async () => {
407407
await vscode.commands.executeCommand("vscode.open", notebookSimpleDotNotebook);
408-
assert.strictEqual(vscode.notebook.activeNotebookEditor.document.cells.length, 2);
409-
assert.strictEqual(vscode.notebook.activeNotebookEditor.document.cells[0].cellKind, vscode.CellKind.Markdown);
410-
assert.strictEqual(vscode.notebook.activeNotebookEditor.document.cells[0].document.getText(), "asdf");
411-
assert.strictEqual(vscode.notebook.activeNotebookEditor.document.cells[1].cellKind, vscode.CellKind.Code);
412-
assert.strictEqual(vscode.notebook.activeNotebookEditor.document.cells[1].document.getText(), "gci\n");
408+
assert.strictEqual(vscode.window.activeNotebookEditor.document.cells.length, 2);
409+
assert.strictEqual(vscode.window.activeNotebookEditor.document.cells[0].cellKind, vscode.CellKind.Markdown);
410+
assert.strictEqual(vscode.window.activeNotebookEditor.document.cells[0].document.getText(), "asdf");
411+
assert.strictEqual(vscode.window.activeNotebookEditor.document.cells[1].cellKind, vscode.CellKind.Code);
412+
assert.strictEqual(vscode.window.activeNotebookEditor.document.cells[1].document.getText(), "gci\n");
413413
}).timeout(20000);
414414
});

vscode.proposed.d.ts

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -341,16 +341,6 @@ declare module 'vscode' {
341341
*/
342342
readonly viewColumn?: ViewColumn;
343343

344-
/**
345-
* Whether the panel is active (focused by the user).
346-
*/
347-
readonly active: boolean;
348-
349-
/**
350-
* Whether the panel is visible.
351-
*/
352-
readonly visible: boolean;
353-
354344
/**
355345
* Fired when the panel is disposed.
356346
*/
@@ -687,6 +677,7 @@ declare module 'vscode' {
687677
): Disposable;
688678

689679
export function createNotebookEditorDecorationType(options: NotebookDecorationRenderOptions): NotebookEditorDecorationType;
680+
export function openNotebookDocument(uri: Uri, viewType?: string): Promise<NotebookDocument>;
690681
export const onDidOpenNotebookDocument: Event<NotebookDocument>;
691682
export const onDidCloseNotebookDocument: Event<NotebookDocument>;
692683
export const onDidSaveNotebookDocument: Event<NotebookDocument>;
@@ -695,14 +686,6 @@ declare module 'vscode' {
695686
* All currently known notebook documents.
696687
*/
697688
export const notebookDocuments: ReadonlyArray<NotebookDocument>;
698-
699-
export const visibleNotebookEditors: NotebookEditor[];
700-
export const onDidChangeVisibleNotebookEditors: Event<NotebookEditor[]>;
701-
702-
export const activeNotebookEditor: NotebookEditor | undefined;
703-
export const onDidChangeActiveNotebookEditor: Event<NotebookEditor | undefined>;
704-
export const onDidChangeNotebookEditorSelection: Event<NotebookEditorSelectionChangeEvent>;
705-
export const onDidChangeNotebookEditorVisibleRanges: Event<NotebookEditorVisibleRangesChangeEvent>;
706689
export const onDidChangeNotebookDocumentMetadata: Event<NotebookDocumentMetadataChangeEvent>;
707690
export const onDidChangeNotebookCells: Event<NotebookCellsChangeEvent>;
708691
export const onDidChangeCellOutputs: Event<NotebookCellOutputsChangeEvent>;
@@ -731,5 +714,14 @@ declare module 'vscode' {
731714
export function createCellStatusBarItem(cell: NotebookCell, alignment?: NotebookCellStatusBarAlignment, priority?: number): NotebookCellStatusBarItem;
732715
}
733716

717+
export namespace window {
718+
export const visibleNotebookEditors: NotebookEditor[];
719+
export const onDidChangeVisibleNotebookEditors: Event<NotebookEditor[]>;
720+
export const activeNotebookEditor: NotebookEditor | undefined;
721+
export const onDidChangeActiveNotebookEditor: Event<NotebookEditor | undefined>;
722+
export const onDidChangeNotebookEditorSelection: Event<NotebookEditorSelectionChangeEvent>;
723+
export const onDidChangeNotebookEditorVisibleRanges: Event<NotebookEditorVisibleRangesChangeEvent>;
724+
}
725+
734726
//#endregion
735727
}

0 commit comments

Comments
 (0)