Skip to content

Commit

Permalink
Rename snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
pokey committed Oct 19, 2021
1 parent edf04ba commit b492207
Show file tree
Hide file tree
Showing 32 changed files with 557 additions and 282 deletions.
Binary file added images/tryWrapFine.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -406,16 +406,16 @@
"type": "object",
"scope": "language-overridable",
"default": {
"cursorless.wrapper.ifStatement": {
"cursorless.wrappers.ifStatement": {
"scopeType": "statement"
},
"cursorless.wrapper.tryCatchStatement": {
"cursorless.wrappers.tryCatchStatement": {
"scopeType": "statement"
},
"cursorless.wrapper.ifElseStatementIfBranch": {
"cursorless.wrappers.ifElseStatementIfBranch": {
"scopeType": "statement"
},
"cursorless.wrapper.ifElseStatementElseBranch": {
"cursorless.wrappers.ifElseStatementElseBranch": {
"scopeType": "statement"
}
},
Expand Down
8 changes: 4 additions & 4 deletions snippets/cpp.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"cursorless.wrapper.ifStatement": {
"cursorless.wrappers.ifStatement": {
"body": [
"if ($1) {\n\t$TM_SELECTED_TEXT\n}"
],
"description": "For wrapping selection in if statement"
},
"cursorless.wrapper.tryCatchStatement": {
"cursorless.wrappers.tryCatchStatement": {
"body": [
"try {\n\t$TM_SELECTED_TEXT\n} catch ($1) {\n\t$0\n}"
],
"description": "For wrapping selection in try-catch statement"
},
"cursorless.wrapper.ifElseStatementIfBranch": {
"cursorless.wrappers.ifElseStatementIfBranch": {
"body": [
"if ($1) {\n\t$TM_SELECTED_TEXT\n} else {\n\t$0\n}"
],
"description": "For wrapping selection in if branch of if-else statement"
},
"cursorless.wrapper.ifElseStatementElseBranch": {
"cursorless.wrappers.ifElseStatementElseBranch": {
"body": [
"if ($1) {\n\t$0\n} else {\n\t$TM_SELECTED_TEXT\n}"
],
Expand Down
8 changes: 4 additions & 4 deletions snippets/csharp.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"cursorless.wrapper.ifStatement": {
"cursorless.wrappers.ifStatement": {
"body": [
"if ($1) {\n\t$TM_SELECTED_TEXT\n}"
],
"description": "For wrapping selection in if statement"
},
"cursorless.wrapper.tryCatchStatement": {
"cursorless.wrappers.tryCatchStatement": {
"body": [
"try {\n\t$TM_SELECTED_TEXT\n} catch ($1) {\n\t$0\n}"
],
"description": "For wrapping selection in try-catch statement"
},
"cursorless.wrapper.ifElseStatementIfBranch": {
"cursorless.wrappers.ifElseStatementIfBranch": {
"body": [
"if ($1) {\n\t$TM_SELECTED_TEXT\n} else {\n\t$0\n}"
],
"description": "For wrapping selection in if branch of if-else statement"
},
"cursorless.wrapper.ifElseStatementElseBranch": {
"cursorless.wrappers.ifElseStatementElseBranch": {
"body": [
"if ($1) {\n\t$0\n} else {\n\t$TM_SELECTED_TEXT\n}"
],
Expand Down
8 changes: 4 additions & 4 deletions snippets/java.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"cursorless.wrapper.ifStatement": {
"cursorless.wrappers.ifStatement": {
"body": [
"if ($1) {\n\t$TM_SELECTED_TEXT\n}"
],
"description": "For wrapping selection in if statement"
},
"cursorless.wrapper.tryCatchStatement": {
"cursorless.wrappers.tryCatchStatement": {
"body": [
"try {\n\t$TM_SELECTED_TEXT\n} catch ($1) {\n\t$0\n}"
],
"description": "For wrapping selection in try-catch statement"
},
"cursorless.wrapper.ifElseStatementIfBranch": {
"cursorless.wrappers.ifElseStatementIfBranch": {
"body": [
"if ($1) {\n\t$TM_SELECTED_TEXT\n} else {\n\t$0\n}"
],
"description": "For wrapping selection in if branch of if-else statement"
},
"cursorless.wrapper.ifElseStatementElseBranch": {
"cursorless.wrappers.ifElseStatementElseBranch": {
"body": [
"if ($1) {\n\t$0\n} else {\n\t$TM_SELECTED_TEXT\n}"
],
Expand Down
8 changes: 4 additions & 4 deletions snippets/python.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"cursorless.wrapper.ifStatement": {
"cursorless.wrappers.ifStatement": {
"body": [
"if $1:\n\t$TM_SELECTED_TEXT"
],
"description": "For wrapping selection in if statement"
},
"cursorless.wrapper.tryCatchStatement": {
"cursorless.wrappers.tryCatchStatement": {
"body": [
"try:\n\t$TM_SELECTED_TEXT\nexcept $1:\n\t"
],
"description": "For wrapping selection in try-catch statement"
},
"cursorless.wrapper.ifElseStatementIfBranch": {
"cursorless.wrappers.ifElseStatementIfBranch": {
"body": [
"if $1:\n\t$TM_SELECTED_TEXT\nelse:\n\t"
],
"description": "For wrapping selection in if branch of if-else statement"
},
"cursorless.wrapper.ifElseStatementElseBranch": {
"cursorless.wrappers.ifElseStatementElseBranch": {
"body": [
"if $1:\n\t$0\nelse:\n\t$TM_SELECTED_TEXT"
],
Expand Down
8 changes: 4 additions & 4 deletions snippets/typescript.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"cursorless.wrapper.ifStatement": {
"cursorless.wrappers.ifStatement": {
"body": [
"if ($1) {\n\t$TM_SELECTED_TEXT\n}"
],
"description": "For wrapping selection in if statement"
},
"cursorless.wrapper.tryCatchStatement": {
"cursorless.wrappers.tryCatchStatement": {
"body": [
"try {\n\t$TM_SELECTED_TEXT\n} catch ($1) {\n\t$0\n}"
],
"description": "For wrapping selection in try-catch statement"
},
"cursorless.wrapper.ifElseStatementIfBranch": {
"cursorless.wrappers.ifElseStatementIfBranch": {
"body": [
"if ($1) {\n\t$TM_SELECTED_TEXT\n} else {\n\t$0\n}"
],
"description": "For wrapping selection in if branch of if-else statement"
},
"cursorless.wrapper.ifElseStatementElseBranch": {
"cursorless.wrappers.ifElseStatementElseBranch": {
"body": [
"if ($1) {\n\t$0\n} else {\n\t$TM_SELECTED_TEXT\n}"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ command:
actionName: wrapWithSnippet
partialTargets:
- type: primitive
mark: {type: cursor}
extraArgs: [cursorless.wrapper.ifElseStatementElseBranch]
mark: { type: cursor }
extraArgs: [cursorless.wrappers.ifElseStatementElseBranch]
marks: {}
initialState:
documentContents: int foo = 0;
selections:
- anchor: {line: 0, character: 6}
active: {line: 0, character: 6}
- anchor: { line: 0, character: 6 }
active: { line: 0, character: 6 }
finalState:
documentContents: |-
if () {
Expand All @@ -20,9 +20,20 @@ finalState:
int foo = 0;
}
selections:
- anchor: {line: 0, character: 4}
active: {line: 0, character: 4}
- anchor: { line: 0, character: 4 }
active: { line: 0, character: 4 }
thatMark:
- anchor: {line: 0, character: 0}
active: {line: 4, character: 1}
fullTargets: [{type: primitive, mark: {type: cursor}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: statement, includeSiblings: false}}]
- anchor: { line: 0, character: 0 }
active: { line: 4, character: 1 }
fullTargets:
[
{
type: primitive,
mark: { type: cursor },
selectionType: token,
position: contents,
insideOutsideType: inside,
modifier:
{ type: containingScope, scopeType: statement, includeSiblings: false },
},
]
29 changes: 20 additions & 9 deletions src/test/suite/fixtures/recorded/languages/cpp/ifElseWrapThis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ command:
actionName: wrapWithSnippet
partialTargets:
- type: primitive
mark: {type: cursor}
extraArgs: [cursorless.wrapper.ifElseStatementIfBranch]
mark: { type: cursor }
extraArgs: [cursorless.wrappers.ifElseStatementIfBranch]
marks: {}
initialState:
documentContents: int foo = 0;
selections:
- anchor: {line: 0, character: 6}
active: {line: 0, character: 6}
- anchor: { line: 0, character: 6 }
active: { line: 0, character: 6 }
finalState:
documentContents: |-
if () {
Expand All @@ -20,9 +20,20 @@ finalState:
}
selections:
- anchor: {line: 0, character: 4}
active: {line: 0, character: 4}
- anchor: { line: 0, character: 4 }
active: { line: 0, character: 4 }
thatMark:
- anchor: {line: 0, character: 0}
active: {line: 4, character: 1}
fullTargets: [{type: primitive, mark: {type: cursor}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: statement, includeSiblings: false}}]
- anchor: { line: 0, character: 0 }
active: { line: 4, character: 1 }
fullTargets:
[
{
type: primitive,
mark: { type: cursor },
selectionType: token,
position: contents,
insideOutsideType: inside,
modifier:
{ type: containingScope, scopeType: statement, includeSiblings: false },
},
]
29 changes: 20 additions & 9 deletions src/test/suite/fixtures/recorded/languages/cpp/ifStateWrapThis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,34 @@ command:
actionName: wrapWithSnippet
partialTargets:
- type: primitive
mark: {type: cursor}
extraArgs: [cursorless.wrapper.ifStatement]
mark: { type: cursor }
extraArgs: [cursorless.wrappers.ifStatement]
marks: {}
initialState:
documentContents: int foo = 0;
selections:
- anchor: {line: 0, character: 6}
active: {line: 0, character: 6}
- anchor: { line: 0, character: 6 }
active: { line: 0, character: 6 }
finalState:
documentContents: |-
if () {
int foo = 0;
}
selections:
- anchor: {line: 0, character: 4}
active: {line: 0, character: 4}
- anchor: { line: 0, character: 4 }
active: { line: 0, character: 4 }
thatMark:
- anchor: {line: 0, character: 0}
active: {line: 2, character: 1}
fullTargets: [{type: primitive, mark: {type: cursor}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: statement, includeSiblings: false}}]
- anchor: { line: 0, character: 0 }
active: { line: 2, character: 1 }
fullTargets:
[
{
type: primitive,
mark: { type: cursor },
selectionType: token,
position: contents,
insideOutsideType: inside,
modifier:
{ type: containingScope, scopeType: statement, includeSiblings: false },
},
]
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ command:
actionName: wrapWithSnippet
partialTargets:
- type: primitive
mark: {type: cursor}
extraArgs: [cursorless.wrapper.tryCatchStatement]
mark: { type: cursor }
extraArgs: [cursorless.wrappers.tryCatchStatement]
marks: {}
initialState:
documentContents: int foo = 0;
selections:
- anchor: {line: 0, character: 6}
active: {line: 0, character: 6}
- anchor: { line: 0, character: 6 }
active: { line: 0, character: 6 }
finalState:
documentContents: |-
try {
Expand All @@ -20,9 +20,20 @@ finalState:
}
selections:
- anchor: {line: 2, character: 9}
active: {line: 2, character: 9}
- anchor: { line: 2, character: 9 }
active: { line: 2, character: 9 }
thatMark:
- anchor: {line: 0, character: 0}
active: {line: 4, character: 1}
fullTargets: [{type: primitive, mark: {type: cursor}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: statement, includeSiblings: false}}]
- anchor: { line: 0, character: 0 }
active: { line: 4, character: 1 }
fullTargets:
[
{
type: primitive,
mark: { type: cursor },
selectionType: token,
position: contents,
insideOutsideType: inside,
modifier:
{ type: containingScope, scopeType: statement, includeSiblings: false },
},
]
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ command:
actionName: wrapWithSnippet
partialTargets:
- type: primitive
mark: {type: cursor}
extraArgs: [cursorless.wrapper.tryCatchStatement]
mark: { type: cursor }
extraArgs: [cursorless.wrappers.tryCatchStatement]
marks: {}
initialState:
documentContents: |-
Expand All @@ -15,10 +15,10 @@ initialState:
int bar = 1;
selections:
- anchor: {line: 4, character: 0}
active: {line: 4, character: 0}
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
- anchor: { line: 4, character: 0 }
active: { line: 4, character: 0 }
- anchor: { line: 0, character: 0 }
active: { line: 0, character: 0 }
finalState:
documentContents: |-
try {
Expand All @@ -35,13 +35,24 @@ finalState:
}
selections:
- anchor: {line: 10, character: 9}
active: {line: 10, character: 9}
- anchor: {line: 4, character: 9}
active: {line: 4, character: 9}
- anchor: { line: 10, character: 9 }
active: { line: 10, character: 9 }
- anchor: { line: 4, character: 9 }
active: { line: 4, character: 9 }
thatMark:
- anchor: {line: 8, character: 0}
active: {line: 12, character: 1}
- anchor: {line: 0, character: 0}
active: {line: 6, character: 1}
fullTargets: [{type: primitive, mark: {type: cursor}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: statement, includeSiblings: false}}]
- anchor: { line: 8, character: 0 }
active: { line: 12, character: 1 }
- anchor: { line: 0, character: 0 }
active: { line: 6, character: 1 }
fullTargets:
[
{
type: primitive,
mark: { type: cursor },
selectionType: token,
position: contents,
insideOutsideType: inside,
modifier:
{ type: containingScope, scopeType: statement, includeSiblings: false },
},
]
Loading

0 comments on commit b492207

Please sign in to comment.