Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { sleep } from "@cursorless/common";
import {
getCursorlessApi,
openNewNotebookEditor,
Expand All @@ -19,6 +20,8 @@ async function runTest() {

await openNewNotebookEditor(['"hello"', '"world"']);

await sleep(200);

await hatTokenMap.allocateHats();

await runCursorlessCommand({
Expand Down
5 changes: 2 additions & 3 deletions packages/vscode-common/src/testUtil/openNewEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,13 @@ export async function openNewNotebookEditor(
return document;
}

function waitForEditorToOpen() {
function waitForEditorToOpen(): Promise<void> {
return new Promise<void>((resolve, reject) => {
let count = 0;
const interval = setInterval(() => {
if (vscode.window.activeTextEditor != null) {
clearInterval(interval);
// Give it a moment to settle
setTimeout(resolve, 100);
resolve();
} else {
count++;
if (count === 20) {
Expand Down
Loading