Skip to content

Commit

Permalink
Initial tree-sitter support for .scm files
Browse files Browse the repository at this point in the history
  • Loading branch information
pokey committed May 5, 2023
1 parent 0ffd7d8 commit f0de95f
Show file tree
Hide file tree
Showing 12 changed files with 261 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
languageId: scm
command:
version: 5
spokenForm: clear comment
action: {name: clearAndSetSelection}
targets:
- type: primitive
modifiers:
- type: containingScope
scopeType: {type: comment}
usePrePhraseSnapshot: true
initialState:
documentContents: ;; aaa
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,29 @@
languageId: scm
command:
version: 5
spokenForm: clear every state
action: {name: clearAndSetSelection}
targets:
- type: primitive
modifiers:
- type: everyScope
scopeType: {type: statement}
usePrePhraseSnapshot: true
initialState:
documentContents: |-
(aaa) @bbb
;; ccc
(ddd) @eee
selections:
- anchor: {line: 2, character: 10}
active: {line: 2, character: 10}
marks: {}
finalState:
documentContents: |
;; ccc
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
- anchor: {line: 2, character: 0}
active: {line: 2, character: 0}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
languageId: scm
command:
version: 5
spokenForm: clear item
action: {name: clearAndSetSelection}
targets:
- type: primitive
modifiers:
- type: containingScope
scopeType: {type: collectionItem}
usePrePhraseSnapshot: true
initialState:
documentContents: ;; (aaa)
selections:
- anchor: {line: 0, character: 4}
active: {line: 0, character: 4}
marks: {}
finalState:
documentContents: ;; ()
selections:
- anchor: {line: 0, character: 4}
active: {line: 0, character: 4}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
languageId: scm
command:
version: 5
spokenForm: clear round
action: {name: clearAndSetSelection}
targets:
- type: primitive
modifiers:
- type: containingScope
scopeType: {type: surroundingPair, delimiter: parentheses}
usePrePhraseSnapshot: true
initialState:
documentContents: (aaa)
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,22 @@
languageId: scm
command:
version: 5
spokenForm: clear round
action: {name: clearAndSetSelection}
targets:
- type: primitive
modifiers:
- type: containingScope
scopeType: {type: surroundingPair, delimiter: parentheses}
usePrePhraseSnapshot: true
initialState:
documentContents: ;; (aaa)
selections:
- anchor: {line: 0, character: 3}
active: {line: 0, character: 3}
marks: {}
finalState:
documentContents: ";; "
selections:
- anchor: {line: 0, character: 3}
active: {line: 0, character: 3}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
languageId: scm
command:
version: 5
spokenForm: clear round
action: {name: clearAndSetSelection}
targets:
- type: primitive
modifiers:
- type: containingScope
scopeType: {type: surroundingPair, delimiter: parentheses}
usePrePhraseSnapshot: true
initialState:
documentContents: "\"(aaa)\" @bbb"
selections:
- anchor: {line: 0, character: 1}
active: {line: 0, character: 1}
marks: {}
finalState:
documentContents: "\"\" @bbb"
selections:
- anchor: {line: 0, character: 1}
active: {line: 0, character: 1}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
languageId: scm
command:
version: 5
spokenForm: clear state
action: {name: clearAndSetSelection}
targets:
- type: primitive
modifiers:
- type: containingScope
scopeType: {type: statement}
usePrePhraseSnapshot: true
initialState:
documentContents: ;; aaa
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
marks: {}
thrownError: {name: NoContainingScopeError}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
languageId: scm
command:
version: 5
spokenForm: clear state
action: {name: clearAndSetSelection}
targets:
- type: primitive
modifiers:
- type: containingScope
scopeType: {type: statement}
usePrePhraseSnapshot: true
initialState:
documentContents: (aaa) @bbb
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,26 @@
languageId: scm
command:
version: 5
spokenForm: clear state
action: {name: clearAndSetSelection}
targets:
- type: primitive
modifiers:
- type: containingScope
scopeType: {type: statement}
usePrePhraseSnapshot: true
initialState:
documentContents: |-
(
(aaa) @bbb
(#ccc? @bbb)
)
selections:
- anchor: {line: 1, character: 4}
active: {line: 1, character: 4}
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,26 @@
languageId: scm
command:
version: 5
spokenForm: clear state
action: {name: clearAndSetSelection}
targets:
- type: primitive
modifiers:
- type: containingScope
scopeType: {type: statement}
usePrePhraseSnapshot: true
initialState:
documentContents: |-
(
(aaa) @bbb
(#ccc? @bbb)
)
selections:
- anchor: {line: 2, character: 4}
active: {line: 2, character: 4}
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,22 @@
languageId: scm
command:
version: 5
spokenForm: clear state
action: {name: clearAndSetSelection}
targets:
- type: primitive
modifiers:
- type: containingScope
scopeType: {type: statement}
usePrePhraseSnapshot: true
initialState:
documentContents: "[(aaa) (bbb)] @ccc"
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}
8 changes: 8 additions & 0 deletions queries/scm.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(
(program
(_) @statement
) @_.iteration
(#not-type? @statement comment)
)
(comment) @comment @textFragment
(anonymous_node) @string @textFragment

0 comments on commit f0de95f

Please sign in to comment.