Skip to content

Commit

Permalink
Add tests and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pokey committed Aug 21, 2023
1 parent 2cbbf6a commit b78c097
Show file tree
Hide file tree
Showing 15 changed files with 333 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
languageId: scm
command:
version: 6
spokenForm: bring name to air
action:
name: replaceWithTarget
source:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: name}
destination:
type: primitive
insertionMode: to
target:
type: primitive
mark: {type: decoratedSymbol, symbolColor: default, character: a}
usePrePhraseSnapshot: true
initialState:
documentContents: |-
(aaa) @bbb @ccc @ddd
(eee) @fff
selections:
- anchor: {line: 1, character: 0}
active: {line: 1, character: 0}
marks:
default.a:
start: {line: 0, character: 1}
end: {line: 0, character: 4}
finalState:
documentContents: |-
(aaa) @fff
(eee) @fff
selections:
- anchor: {line: 1, character: 0}
active: {line: 1, character: 0}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
languageId: scm
command:
version: 6
spokenForm: change every name
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: everyScope
scopeType: {type: name}
usePrePhraseSnapshot: true
initialState:
documentContents: (aaa) @bbb @ccc @ddd
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
marks: {}
finalState:
documentContents: (aaa) @ @ @
selections:
- anchor: {line: 0, character: 7}
active: {line: 0, character: 7}
- anchor: {line: 0, character: 9}
active: {line: 0, character: 9}
- anchor: {line: 0, character: 11}
active: {line: 0, character: 11}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
languageId: scm
command:
version: 6
spokenForm: change name
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: name}
usePrePhraseSnapshot: true
initialState:
documentContents: (aaa) @bbb @ccc @ddd
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
marks: {}
finalState:
documentContents: (aaa) @
selections:
- anchor: {line: 0, character: 7}
active: {line: 0, character: 7}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
languageId: scm
command:
version: 6
spokenForm: change name
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: name}
usePrePhraseSnapshot: true
initialState:
documentContents: "eee: (aaa) @bbb @ccc @ddd"
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
marks: {}
finalState:
documentContents: "eee: (aaa) @"
selections:
- anchor: {line: 0, character: 12}
active: {line: 0, character: 12}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
languageId: scm
command:
version: 6
spokenForm: change name
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: name}
usePrePhraseSnapshot: true
initialState:
documentContents: "eee: _ @bbb @ccc @ddd"
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
marks: {}
finalState:
documentContents: "eee: _ @"
selections:
- anchor: {line: 0, character: 8}
active: {line: 0, character: 8}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
languageId: scm
command:
version: 6
spokenForm: chuck name
action:
name: remove
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: name}
usePrePhraseSnapshot: true
initialState:
documentContents: (aaa) @bbb @ccc @ddd
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
marks: {}
finalState:
documentContents: "(aaa) "
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
languageId: scm
command:
version: 6
spokenForm: chuck name
action:
name: remove
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: name}
usePrePhraseSnapshot: true
initialState:
documentContents: (aaa) @bbb @ccc @ddd
selections:
- anchor: {line: 0, character: 20}
active: {line: 0, character: 20}
marks: {}
finalState:
documentContents: "(aaa) @bbb @ccc "
selections:
- anchor: {line: 0, character: 16}
active: {line: 0, character: 16}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
languageId: scm
command:
version: 6
spokenForm: clone name
action:
name: insertCopyAfter
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: name}
usePrePhraseSnapshot: true
initialState:
documentContents: "eee: _ @bbb @ccc"
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
marks: {}
finalState:
documentContents: "eee: _ @bbb @ccc @bbb @ccc"
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
languageId: scm
command:
version: 6
spokenForm: drink name
action:
name: editNewLineBefore
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: name}
usePrePhraseSnapshot: true
initialState:
documentContents: "eee: _ @bbb @ccc"
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
marks: {}
finalState:
documentContents: "eee: _ @ @bbb @ccc"
selections:
- anchor: {line: 0, character: 8}
active: {line: 0, character: 8}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
languageId: scm
command:
version: 6
spokenForm: pour name
action:
name: editNewLineAfter
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: name}
usePrePhraseSnapshot: true
initialState:
documentContents: "eee: _ @bbb @ccc"
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
marks: {}
finalState:
documentContents: "eee: _ @bbb @ccc @"
selections:
- anchor: {line: 0, character: 18}
active: {line: 0, character: 18}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
languageId: scm
command:
version: 6
spokenForm: pour name
action:
name: editNewLineAfter
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: name}
usePrePhraseSnapshot: true
initialState:
documentContents: "eee: _ @bbb @ccc"
selections:
- anchor: {line: 0, character: 7}
active: {line: 0, character: 7}
marks: {}
finalState:
documentContents: "eee: _ @bbb @ @ccc"
selections:
- anchor: {line: 0, character: 13}
active: {line: 0, character: 13}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
languageId: scm
command:
version: 6
spokenForm: take name
action:
name: setSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: name}
usePrePhraseSnapshot: true
initialState:
documentContents: (aaa) @bbb @ccc @ddd
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
marks: {}
finalState:
documentContents: (aaa) @bbb @ccc @ddd
selections:
- anchor: {line: 0, character: 7}
active: {line: 0, character: 20}
14 changes: 14 additions & 0 deletions queries/scm.collections.scm
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
;;!! (aaa (bbb) (ccc))
;;! ^^^^^ ^^^^^
;;! ***************
(
(named_node
"(" @collectionItem.iteration.start.endOf
Expand All @@ -7,6 +10,9 @@
)
)

;;!! ((aaa) (bbb))
;;! ^^^^^ ^^^^^
;;! ***********
(
(grouping
"(" @collectionItem.iteration.start.endOf
Expand All @@ -15,6 +21,14 @@
)
)

;; collectionItem:
;;!! [(aaa) (bbb)] @ccc
;;! ^^^^^ ^^^^^
;;! ***********
;; list:
;;!! [(aaa) (bbb)] @ccc
;;! ^^^^^^^^^^^^^
;;! ------------------
(
(list
"[" @list.start @collectionItem.iteration.start.endOf
Expand Down
21 changes: 18 additions & 3 deletions queries/scm.name.scm
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
;; Include everything leading up to the first capture in the domain for name
;;!! (aaa) @bbb @ccc
;;! ^^^^^^^^
;;! xxxxxxxxx
;;! ---------------
(
(_
_ @dummy
Expand All @@ -16,7 +19,10 @@
(#insertion-delimiter! @name.start " @")
)

;; Include everything leading up to the first capture in the domain for name
;;!! eee: (aaa) @bbb @ccc
;;! ^^^^^^^^
;;! xxxxxxxxx
;;! --------------------
(
(field_definition
(_
Expand All @@ -34,7 +40,10 @@
(#insertion-delimiter! @name.start " @")
)

;; Only include the capture itself in its domain after the first capture
;;!! (aaa) @bbb @ccc
;;! ^^^ ^^^
;;! xxxx xxxx
;;! ---- ----
(
(_
(capture
Expand All @@ -47,6 +56,9 @@
(#insertion-delimiter! @name " @")
)

;;!! (aaa) @bbb @ccc
;;! *********
;;! --------------- <~ iteration domain
(
(_
_ @dummy
Expand All @@ -58,6 +70,9 @@
(#not-parent-type? @name.iteration.domain field_definition)
)

;;!! ddd: (aaa) @bbb @ccc
;;! *********
;;! -------------------- <~ iteration domain
(
(field_definition
[
Expand Down
Loading

0 comments on commit b78c097

Please sign in to comment.