Skip to content

Commit

Permalink
Initial next gen scope support for shellscript
Browse files Browse the repository at this point in the history
  • Loading branch information
fidgetingbits committed Dec 27, 2023
1 parent 7341d0f commit f235bda
Show file tree
Hide file tree
Showing 35 changed files with 1,062 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
languageId: shellscript
command:
version: 6
spokenForm: change arg
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: argumentOrParameter}
usePrePhraseSnapshot: true
initialState:
documentContents: var="foo ${bar}"
selections:
- anchor: {line: 0, character: 13}
active: {line: 0, character: 13}
marks: {}
finalState:
documentContents: var="foo "
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: shellscript
command:
version: 6
spokenForm: change arg
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: argumentOrParameter}
usePrePhraseSnapshot: true
initialState:
documentContents: var="foo $bar"
selections:
- anchor: {line: 0, character: 10}
active: {line: 0, character: 10}
marks: {}
finalState:
documentContents: var="foo "
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: shellscript
command:
version: 6
spokenForm: change arg
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: argumentOrParameter}
usePrePhraseSnapshot: true
initialState:
documentContents: echo "foo"
selections:
- anchor: {line: 0, character: 6}
active: {line: 0, character: 6}
marks: {}
finalState:
documentContents: "echo "
selections:
- anchor: {line: 0, character: 5}
active: {line: 0, character: 5}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
languageId: shellscript
command:
version: 6
spokenForm: change arg
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: argumentOrParameter}
usePrePhraseSnapshot: true
initialState:
documentContents: echo "foo" "bar"
selections:
- anchor: {line: 0, character: 15}
active: {line: 0, character: 15}
marks: {}
finalState:
documentContents: "echo \"foo\" "
selections:
- anchor: {line: 0, character: 11}
active: {line: 0, character: 11}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
languageId: shellscript
command:
version: 6
spokenForm: change branch
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: branch}
usePrePhraseSnapshot: true
initialState:
documentContents: |-
if [ "$number" -eq 42 ]; then
echo "The number is 42"
else
echo "The number is not 42"
fi
selections:
- anchor: {line: 3, character: 10}
active: {line: 3, character: 10}
marks: {}
finalState:
documentContents: |-
if [ "$number" -eq 42 ]; then
echo "The number is 42"
fi
selections:
- anchor: {line: 2, character: 0}
active: {line: 2, character: 0}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
languageId: shellscript
command:
version: 6
spokenForm: change branch
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: branch}
usePrePhraseSnapshot: true
initialState:
documentContents: |-
if [ "$number" -eq 42 ]; then
echo "The number is 42"
elif [ "$number" -gt 42 ]; then
echo "The number is greater than 42"
else
echo "The number is less than than 42"
fi
selections:
- anchor: {line: 3, character: 10}
active: {line: 3, character: 10}
marks: {}
finalState:
documentContents: |-
if [ "$number" -eq 42 ]; then
echo "The number is 42"
else
echo "The number is less than than 42"
fi
selections:
- anchor: {line: 2, character: 0}
active: {line: 2, character: 0}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
languageId: shellscript
command:
version: 6
spokenForm: change call
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: functionCall}
usePrePhraseSnapshot: true
initialState:
documentContents: echo "foo"
selections:
- anchor: {line: 0, character: 10}
active: {line: 0, character: 10}
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,23 @@
languageId: shellscript
command:
version: 6
spokenForm: change callee
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: functionCallee}
usePrePhraseSnapshot: true
initialState:
documentContents: echo "foo"
selections:
- anchor: {line: 0, character: 10}
active: {line: 0, character: 10}
marks: {}
finalState:
documentContents: " \"foo\""
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: shellscript
command:
version: 6
spokenForm: change comment
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: comment}
usePrePhraseSnapshot: true
initialState:
documentContents: "# foo"
selections:
- anchor: {line: 0, character: 5}
active: {line: 0, character: 5}
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,33 @@
languageId: shellscript
command:
version: 6
spokenForm: change condition
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: condition}
usePrePhraseSnapshot: true
initialState:
documentContents: |-
if [ "$number" -eq 42 ]; then
echo "The number is 42"
else
echo "The number is not 42"
fi
selections:
- anchor: {line: 0, character: 8}
active: {line: 0, character: 8}
marks: {}
finalState:
documentContents: |-
if ; then
echo "The number is 42"
else
echo "The number is not 42"
fi
selections:
- anchor: {line: 0, character: 3}
active: {line: 0, character: 3}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
languageId: shellscript
command:
version: 6
spokenForm: change condition
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: condition}
usePrePhraseSnapshot: true
initialState:
documentContents: |
if [["$number" -eq 42 ]]; then
echo "number match"
elif [[ $number -lt 20 ]]; then
echo "< 20"
else
echo "No match"
fi
selections:
- anchor: {line: 4, character: 6}
active: {line: 4, character: 6}
marks: {}
finalState:
documentContents: |
if [["$number" -eq 42 ]]; then
echo "number match"
elif ; then
echo "< 20"
else
echo "No match"
fi
selections:
- anchor: {line: 3, character: 5}
active: {line: 3, character: 5}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
languageId: shellscript
command:
version: 6
spokenForm: change every arg
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: everyScope
scopeType: {type: argumentOrParameter}
usePrePhraseSnapshot: true
initialState:
documentContents: echo a b c
selections:
- anchor: {line: 0, character: 10}
active: {line: 0, character: 10}
marks: {}
finalState:
documentContents: "echo "
selections:
- anchor: {line: 0, character: 5}
active: {line: 0, character: 5}
- anchor: {line: 0, character: 6}
active: {line: 0, character: 6}
- anchor: {line: 0, character: 7}
active: {line: 0, character: 7}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
languageId: shellscript
command:
version: 6
spokenForm: change every item
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: everyScope
scopeType: {type: collectionItem}
usePrePhraseSnapshot: true
initialState:
documentContents: |
array=("apple" "banana" "cherry")
selections:
- anchor: {line: 0, character: 9}
active: {line: 0, character: 9}
marks: {}
finalState:
documentContents: |
array=( )
selections:
- anchor: {line: 0, character: 7}
active: {line: 0, character: 7}
- anchor: {line: 0, character: 8}
active: {line: 0, character: 8}
- anchor: {line: 0, character: 9}
active: {line: 0, character: 9}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
languageId: shellscript
command:
version: 6
spokenForm: change funk
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: namedFunction}
usePrePhraseSnapshot: true
initialState:
documentContents: |-
function foo() {
echo "foo"
}
selections:
- anchor: {line: 0, character: 7}
active: {line: 0, character: 7}
marks: {}
finalState:
documentContents: ""
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
Loading

0 comments on commit f235bda

Please sign in to comment.