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
@@ -0,0 +1,38 @@
languageId: markdown
command:
version: 7
spokenForm: change every section
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: everyScope
scopeType: {type: section}
usePrePhraseSnapshot: false
initialState:
documentContents: |-
# h1
Aaa

## h2.1
Bbb

## h2.2
Ccc
selections:
- anchor: {line: 3, character: 0}
active: {line: 3, character: 0}
marks: {}
finalState:
documentContents: |+
# h1
Aaa



selections:
- anchor: {line: 3, character: 0}
active: {line: 3, character: 0}
- anchor: {line: 5, character: 0}
active: {line: 5, character: 0}
28 changes: 28 additions & 0 deletions data/fixtures/scopes/markdown/section.iteration.document.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# h1.1
Aaa

# h1.2
Bbb
---

[#1 Range] =
[#1 Domain] = 0:0-4:3
>------
0| # h1.1
1| Aaa
2|
3| # h1.2
4| Bbb
---<


[#2 Range] =
[#2 Domain] = 1:0-1:3
>---<
1| Aaa


[#3 Range] =
[#3 Domain] = 4:0-4:3
>---<
4| Bbb
47 changes: 47 additions & 0 deletions data/fixtures/scopes/markdown/section.iteration.parent.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# h1
Aaa

## h2.1
Bbb

## h2.2
Ccc
---

[#1 Range] =
[#1 Domain] = 0:0-7:3
>----
0| # h1
1| Aaa
2|
3| ## h2.1
4| Bbb
5|
6| ## h2.2
7| Ccc
---<


[#2 Range] =
[#2 Domain] = 1:0-7:3
>---
1| Aaa
2|
3| ## h2.1
4| Bbb
5|
6| ## h2.2
7| Ccc
---<


[#3 Range] =
[#3 Domain] = 4:0-4:3
>---<
4| Bbb


[#4 Range] =
[#4 Domain] = 7:0-7:3
>---<
7| Ccc
4 changes: 4 additions & 0 deletions packages/common/src/scopeSupportFacets/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;
export const markdownScopeSupport: LanguageScopeSupportFacetMap = {
"comment.line": supported,
"comment.block": supported,

section: supported,
"section.iteration.document": supported,
"section.iteration.parent": supported,

notebookCell: supported,
"collectionItem.unenclosed": supported,
};
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ export const scopeSupportFacetInfos: Record<
description: "A document section",
scopeType: "section",
},
"section.iteration.document": {
description:
"Iteration scope for a document section. This is the entire document.",
scopeType: "section",
isIteration: true,
},
"section.iteration.parent": {
description:
"Iteration scope for a document section. This is the parent section.",
scopeType: "section",
isIteration: true,
},

list: {
description: "A list/array",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export const scopeSupportFacets = [
"environment",

"section",
"section.iteration.document",
"section.iteration.parent",

"list",
"map",
Expand Down
9 changes: 9 additions & 0 deletions queries/markdown.scm
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,12 @@
) @sectionLevelSix @_.removal
(#trim-end! @sectionLevelSix)
)

(document) @section.iteration

(
(section
(atx_heading) @section.iteration.start.endOf
) @section.iteration.end.endOf
(#trim-end! @section.iteration.end.endOf)
)
Loading