Skip to content

Commit

Permalink
Fix interior scope tests (#2218)
Browse files Browse the repository at this point in the history
  • Loading branch information
pokey authored Feb 2, 2024
1 parent aed028e commit bae9ce0
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 12 deletions.
15 changes: 11 additions & 4 deletions packages/cursorless-engine/src/scopeProviders/getTargetRanges.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
NoContainingScopeError,
TargetRanges,
toCharacterRange,
toLineRange,
Expand All @@ -8,17 +9,23 @@ import { Target } from "../typings/target.types";
export function getTargetRanges(target: Target): TargetRanges {
const interior = (() => {
try {
target.getInteriorStrict().map(getTargetRanges);
return target.getInteriorStrict().map(getTargetRanges);
} catch (error) {
return undefined;
if (error instanceof NoContainingScopeError) {
return undefined;
}
throw error;
}
})();

const boundary = (() => {
try {
target.getBoundaryStrict().map(getTargetRanges);
return target.getBoundaryStrict().map(getTargetRanges);
} catch (error) {
return undefined;
if (error instanceof NoContainingScopeError) {
return undefined;
}
throw error;
}
})();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@
0| <div id="root"></div>
>---------------------<

[Interior] = 0:15-0:15
0| <div id="root"></div>
><

[Insertion delimiter] = "\n"
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@
0| <div id="root"></div>
>---------------------<

[Interior] = 0:15-0:15
0| <div id="root"></div>
><

[Insertion delimiter] = "\n"
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ press {user.key}:
1| key(key)
------------<

[Interior] = 1:4-1:12
1| key(key)
>--------<

[Insertion delimiter] = "\n"
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
aaa

aaa

bbb

ccc

---

[Content] =
[Removal] =
[Domain] = 0:0-4:3
0| aaa
>---
1|
[Domain] = 0:0-6:0
0|
>
1| aaa
-----
2|

3| bbb
---
4|

5| ccc
---
6|
<

[Interior] = 1:2-5:3
1| aaa
>---
2|

2| bbb
3| bbb
---
3|
4|

4| ccc
5| ccc
---<

[Insertion delimiter] = "\n"

0 comments on commit bae9ce0

Please sign in to comment.