Skip to content
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

Fix pervasive test issue with editor properties #6100

Merged
merged 3 commits into from
Jun 3, 2021
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
1 change: 1 addition & 0 deletions news/3 Code Health/6098.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update test init code to use window and not notebook for editor properties.
8 changes: 4 additions & 4 deletions src/test/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export async function closeActiveNotebooks(): Promise<void> {
}
// We could have untitled notebooks, close them by reverting changes.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
while ((vscode as any).notebook.activeNotebookEditor || vscode.window.activeTextEditor) {
while ((vscode as any).window.activeNotebookEditor || vscode.window.activeTextEditor) {
await vscode.commands.executeCommand('workbench.action.revertAndCloseActiveEditor');
}
// Work around VS Code issues (sometimes notebooks do not get closed).
Expand Down Expand Up @@ -134,10 +134,10 @@ async function closeWindowsInternal() {
function isANotebookOpen() {
/* eslint-disable */
if (
Array.isArray((vscode as any).notebook.visibleNotebookEditors) &&
(vscode as any).notebook.visibleNotebookEditors.length
Array.isArray((vscode as any).window.visibleNotebookEditors) &&
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a reason for why we did this?

Copy link
Contributor

@DonJayamanne DonJayamanne Jun 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was due to some breaking changes in vscode and I wanted to future proof it.
We should be able to remove that now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, now remember. We couldn't use proposed api in stable (at one point, until we enabled the experiment and supported it) and this block of code always ran in stable as well. It has to compile and run in stable.

(vscode as any).window.visibleNotebookEditors.length
) {
return true;
}
return !!(vscode as any).notebook.activeNotebookEditor;
return !!(vscode as any).window.activeNotebookEditor;
}