Skip to content

Commit 3497e3d

Browse files
Update ranges for markdown item (#2778)
Fixes #2384 ## Checklist - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [/] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [/] I have not broken the cheatsheet
1 parent cb23567 commit 3497e3d

File tree

6 files changed

+87
-20
lines changed

6 files changed

+87
-20
lines changed

data/fixtures/recorded/languages/markdown/changeLeadingItem.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ initialState:
2424
finalState:
2525
documentContents: |-
2626
- values
27-
- 0- 1
27+
- 0
28+
- 1
2829
- 2
2930
selections:
30-
- anchor: {line: 1, character: 7}
31-
active: {line: 1, character: 7}
31+
- anchor: {line: 2, character: 4}
32+
active: {line: 2, character: 4}

data/fixtures/recorded/languages/markdown/chuckItem4.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ finalState:
2323
documentContents: |-
2424
- values
2525
- 0
26+
2627
selections:
27-
- anchor: {line: 1, character: 7}
28-
active: {line: 1, character: 7}
28+
- anchor: {line: 2, character: 4}
29+
active: {line: 2, character: 4}

data/fixtures/recorded/languages/markdown/roundWrapItemAir.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ initialState:
2626
end: {line: 0, character: 5}
2727
finalState:
2828
documentContents: |
29-
- (aaa)
30-
- bbb
29+
- (aaa
30+
- bbb)
3131
selections:
3232
- anchor: {line: 2, character: 0}
3333
active: {line: 2, character: 0}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
- This is the first level of a list.
2+
- This is the second level of a list.
3+
- This is the first level of a list again.
4+
---
5+
6+
[#1 Content] = 0:2-1:39
7+
>----------------------------------
8+
0| - This is the first level of a list.
9+
1| - This is the second level of a list.
10+
---------------------------------------<
11+
12+
[#1 Removal] = 0:0-2:0
13+
>------------------------------------
14+
0| - This is the first level of a list.
15+
1| - This is the second level of a list.
16+
2| - This is the first level of a list again.
17+
<
18+
19+
[#1 Trailing delimiter] = 1:39-2:0
20+
>
21+
1| - This is the second level of a list.
22+
2| - This is the first level of a list again.
23+
<
24+
25+
[#1 Domain] = 0:0-1:39
26+
>------------------------------------
27+
0| - This is the first level of a list.
28+
1| - This is the second level of a list.
29+
---------------------------------------<
30+
31+
[#1 Insertion delimiter] = "\n"
32+
33+
34+
[#2 Content] = 1:4-1:39
35+
>-----------------------------------<
36+
1| - This is the second level of a list.
37+
38+
[#2 Removal] = 1:0-1:39
39+
>---------------------------------------<
40+
1| - This is the second level of a list.
41+
42+
[#2 Leading delimiter] = 1:0-1:2
43+
>--<
44+
1| - This is the second level of a list.
45+
46+
[#2 Domain] = 1:2-1:39
47+
>-------------------------------------<
48+
1| - This is the second level of a list.
49+
50+
[#2 Insertion delimiter] = "\n"
51+
52+
53+
[#3 Content] = 2:2-2:42
54+
>----------------------------------------<
55+
2| - This is the first level of a list again.
56+
57+
[#3 Removal] = 2:0-2:42
58+
>------------------------------------------<
59+
2| - This is the first level of a list again.
60+
61+
[#3 Leading delimiter] = 2:0-2:0
62+
><
63+
2| - This is the first level of a list again.
64+
65+
[#3 Domain] = 2:0-2:42
66+
>------------------------------------------<
67+
2| - This is the first level of a list again.
68+
69+
[#3 Insertion delimiter] = "\n"

packages/common/src/scopeSupportFacets/markdown.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = {
99
"comment.block": supported,
1010
section: supported,
1111
notebookCell: supported,
12+
"collectionItem.unenclosed": supported,
1213
};

queries/markdown.scm

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,17 @@
2424
;;! ^
2525
;;! ---
2626
(list
27-
(list_item
28-
(paragraph
29-
(inline) @_.leading.endOf
30-
)
31-
)?
27+
(list_item)? @collectionItem.leading.endOf
3228
.
3329
(list_item
34-
(_) @_.prefix
35-
(paragraph
36-
(inline) @collectionItem
37-
)
38-
) @_.domain
30+
(_) @collectionItem.prefix
31+
(paragraph) @collectionItem.start.startOf
32+
) @collectionItem.end.endOf @collectionItem.domain
3933
.
40-
(list_item)? @_.trailing.startOf
41-
(#trim-end! @_.domain)
42-
(#insertion-delimiter! @collectionItem "\n")
34+
(list_item)? @collectionItem.trailing.startOf
35+
(#trim-end! @collectionItem.end.endOf)
36+
(#trim-end! @collectionItem.domain)
37+
(#insertion-delimiter! @collectionItem.start.startOf "\n")
4338
)
4439

4540
(list) @collectionItem.iteration

0 commit comments

Comments
 (0)