Skip to content

Commit c52216b

Browse files
Assert that we have an active editor before taking snapshot (#2932)
Ran into this being undefined on my local machine. Much better to have a proper error message
1 parent ac3b05b commit c52216b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/common/src/testUtil/getSnapshotForComparison.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,18 @@ export async function getSnapshotForComparison(
4747
}
4848
}
4949

50+
const editor = spyIde.activeTextEditor;
51+
52+
if (editor == null) {
53+
throw new Error("No active text editor found in SpyIDE");
54+
}
55+
5056
// FIXME Visible ranges are not asserted, see:
5157
// https://github.com/cursorless-dev/cursorless/issues/160
5258
const { visibleRanges, ...resultState } = await takeSnapshot(
5359
excludeFields,
5460
[],
55-
spyIde.activeTextEditor!,
61+
editor,
5662
spyIde,
5763
marks,
5864
);

0 commit comments

Comments
 (0)