Skip to content

Commit

Permalink
Improve item
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasArvidsson committed Nov 29, 2023
1 parent 9dafad9 commit 3f0fcd4
Show file tree
Hide file tree
Showing 10 changed files with 275 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
languageId: yaml
command:
version: 6
spokenForm: change map
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: map}
usePrePhraseSnapshot: true
initialState:
documentContents: |-
foo: 0
bar: 1
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
marks: {}
finalState:
documentContents: ""
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
languageId: yaml
command:
version: 6
spokenForm: chuck item
action:
name: remove
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: collectionItem}
usePrePhraseSnapshot: true
initialState:
documentContents: |-
values:
- 0
- 1
selections:
- anchor: {line: 1, character: 4}
active: {line: 1, character: 4}
marks: {}
finalState:
documentContents: |-
values:
- 1
selections:
- anchor: {line: 1, character: 4}
active: {line: 1, character: 4}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
languageId: yaml
command:
version: 6
spokenForm: chuck item
action:
name: remove
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: collectionItem}
usePrePhraseSnapshot: true
initialState:
documentContents: |-
values:
- 0
- 1
selections:
- anchor: {line: 2, character: 4}
active: {line: 2, character: 4}
marks: {}
finalState:
documentContents: |-
values:
- 0
selections:
- anchor: {line: 1, character: 7}
active: {line: 1, character: 7}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
languageId: yaml
command:
version: 6
spokenForm: chuck item
action:
name: remove
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: collectionItem}
usePrePhraseSnapshot: true
initialState:
documentContents: "values: [0, 1]"
selections:
- anchor: {line: 0, character: 9}
active: {line: 0, character: 9}
marks: {}
finalState:
documentContents: "values: [1]"
selections:
- anchor: {line: 0, character: 9}
active: {line: 0, character: 9}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
languageId: yaml
command:
version: 6
spokenForm: chuck item
action:
name: remove
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: collectionItem}
usePrePhraseSnapshot: true
initialState:
documentContents: "values: [0, 1]"
selections:
- anchor: {line: 0, character: 13}
active: {line: 0, character: 13}
marks: {}
finalState:
documentContents: "values: [0]"
selections:
- anchor: {line: 0, character: 10}
active: {line: 0, character: 10}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
languageId: yaml
command:
version: 6
spokenForm: chuck item
action:
name: remove
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: collectionItem}
usePrePhraseSnapshot: true
initialState:
documentContents: |-
foo: 0
bar: 0
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
marks: {}
finalState:
documentContents: "bar: 0"
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
languageId: yaml
command:
version: 6
spokenForm: chuck item
action:
name: remove
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: collectionItem}
usePrePhraseSnapshot: true
initialState:
documentContents: |-
foo: 0
bar: 0
selections:
- anchor: {line: 1, character: 0}
active: {line: 1, character: 0}
marks: {}
finalState:
documentContents: "foo: 0"
selections:
- anchor: {line: 0, character: 6}
active: {line: 0, character: 6}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
languageId: yaml
command:
version: 6
spokenForm: chuck item
action:
name: remove
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: collectionItem}
usePrePhraseSnapshot: true
initialState:
documentContents: |
values: {foo: 0, bar: 0}
selections:
- anchor: {line: 0, character: 9}
active: {line: 0, character: 9}
marks: {}
finalState:
documentContents: |
values: {bar: 0}
selections:
- anchor: {line: 0, character: 9}
active: {line: 0, character: 9}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
languageId: yaml
command:
version: 6
spokenForm: chuck item
action:
name: remove
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: collectionItem}
usePrePhraseSnapshot: true
initialState:
documentContents: |
values: {foo: 0, bar: 0}
selections:
- anchor: {line: 0, character: 17}
active: {line: 0, character: 17}
marks: {}
finalState:
documentContents: |
values: {foo: 0}
selections:
- anchor: {line: 0, character: 15}
active: {line: 0, character: 15}
77 changes: 48 additions & 29 deletions queries/yaml.scm
Original file line number Diff line number Diff line change
@@ -1,13 +1,56 @@
;;!! foo: bar
;;! ^^^ ^^^
;; ;;!! foo: bar
;; ;;! ^^^ ^^^
(_
key: (_) @collectionKey @collectionKey.trailing.start.endOf @value.leading.start.endOf
value: (_) @value @collectionKey.trailing.start.startOf @value.leading.start.startOf
) @collectionItem @_.domain
) @_.domain

;;!! foo: bar
;;! ^^^^^^^^
(block_mapping
(block_mapping_pair)? @collectionItem.leading.start.endOf
.
(block_mapping_pair) @collectionItem @collectionItem.leading.end.startOf @collectionItem.trailing.end.endOf
.
(block_mapping_pair)? @collectionItem.trailing.end.startOf
) @map

;;!! - 0
;;! ^^^
(block_sequence
(block_sequence_item)? @collectionItem.leading.start.endOf
.
(block_sequence_item) @collectionItem @collectionItem.leading.end.startOf @collectionItem.trailing.end.endOf
.
(block_sequence_item)? @collectionItem.trailing.end.startOf
) @list

;;!! [0]
;;! ^
(flow_sequence
(flow_node)? @collectionItem.leading.start.endOf
.
(flow_node) @collectionItem @collectionItem.leading.end.startOf @collectionItem.trailing.end.endOf
.
(flow_node)? @collectionItem.trailing.end.startOf
) @list

(block_mapping) @collectionItem.iteration @collectionKey.iteration @value.iteration
;;!! { foo: bar }
;;! ^^^^^^^^
(flow_mapping
(flow_pair)? @collectionItem.leading.start.endOf
.
(flow_pair) @collectionItem @collectionItem.leading.end.startOf @collectionItem.trailing.end.endOf
.
(flow_pair)? @collectionItem.trailing.end.startOf
) @map

(flow_pair) @collectionItem
[
(block_mapping)
(block_sequence)
(flow_sequence)
(flow_mapping)
] @collectionItem.iteration @collectionKey.iteration @value.iteration

;;!! languageId: plauintext
;;! ^^^^^^^^^^
Expand All @@ -19,27 +62,3 @@

;;!! | block scalar
(block_scalar) @textFragment

;;!! { foo: bar }
;;! ^^^^^^^^^^^^
(flow_mapping) @map
(flow_mapping) @collectionItem.iteration @collectionKey.iteration @value.iteration

[
;;!! - 0\n- 1
;;! ^^^^^^^^
(block_sequence)
;;!! [0, 1]
;;! ^^^^^^
(flow_sequence)
] @list @collectionItem.iteration

;;!! - 0
;;! ^^^
(block_sequence_item) @collectionItem

;;!! [0]
;;! ^
(flow_sequence
(flow_node) @collectionItem
)

0 comments on commit 3f0fcd4

Please sign in to comment.