mirror of
https://github.com/cursorless-dev/cursorless.git
synced 2024-10-05 05:17:38 +03:00
Added action remove selection (#348)
* Added action remove selection * Renamed remove selection to deselectgit status * Renamed and clean up remove selection * Update src/actions/Deselect.ts Co-authored-by: Pokey Rule <pokey.rule@gmail.com> * Enabled deselection of empty selections Co-authored-by: Pokey Rule <pokey.rule@gmail.com>
This commit is contained in:
parent
a5593ed997
commit
d3a91b9cfc
41
src/actions/Deselect.ts
Normal file
41
src/actions/Deselect.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import { Selection } from "vscode";
|
||||
import {
|
||||
Action,
|
||||
ActionPreferences,
|
||||
ActionReturnValue,
|
||||
TypedSelection,
|
||||
Graph,
|
||||
} from "../typings/Types";
|
||||
import { runOnTargetsForEachEditor } from "../util/targetUtils";
|
||||
|
||||
export default class Deselect implements Action {
|
||||
getTargetPreferences: () => ActionPreferences[] = () => [
|
||||
{ insideOutsideType: "inside" },
|
||||
];
|
||||
|
||||
constructor(private graph: Graph) {
|
||||
this.run = this.run.bind(this);
|
||||
}
|
||||
|
||||
async run([targets]: [TypedSelection[]]): Promise<ActionReturnValue> {
|
||||
await runOnTargetsForEachEditor(targets, async (editor, targets) => {
|
||||
// Remove selections with a non-empty intersection
|
||||
const newSelections = editor.selections.filter(
|
||||
(selection) =>
|
||||
!targets.some((target) => {
|
||||
const intersection =
|
||||
target.selection.selection.intersection(selection);
|
||||
return intersection && (!intersection.isEmpty || selection.isEmpty);
|
||||
})
|
||||
);
|
||||
// The editor requires at least one selection. Keep "primary" selection active
|
||||
editor.selections = newSelections.length
|
||||
? newSelections
|
||||
: [new Selection(editor.selection.active, editor.selection.active)];
|
||||
});
|
||||
|
||||
return {
|
||||
thatMark: targets.map((target) => target.selection),
|
||||
};
|
||||
}
|
||||
}
|
@ -28,6 +28,7 @@ import SetBreakpoint from "./SetBreakpoint";
|
||||
import { Sort, Reverse } from "./Sort";
|
||||
import Call from "./Call";
|
||||
import WrapWithSnippet from "./WrapWithSnippet";
|
||||
import Deselect from "./Deselect";
|
||||
|
||||
class Actions implements ActionRecord {
|
||||
constructor(private graph: Graph) {}
|
||||
@ -52,6 +53,7 @@ class Actions implements ActionRecord {
|
||||
outdentLine = new OutdentLines(this.graph);
|
||||
pasteFromClipboard = new Paste(this.graph);
|
||||
remove = new Delete(this.graph);
|
||||
deselect = new Deselect(this.graph);
|
||||
replace = new Replace(this.graph);
|
||||
replaceWithTarget = new Bring(this.graph);
|
||||
reverseTargets = new Reverse(this.graph);
|
||||
|
33
src/test/suite/fixtures/recorded/actions/giveAfterDot.yml
Normal file
33
src/test/suite/fixtures/recorded/actions/giveAfterDot.yml
Normal file
@ -0,0 +1,33 @@
|
||||
spokenForm: give after dot
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: primitive
|
||||
position: after
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: .}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: a b.c
|
||||
selections:
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 3}
|
||||
active: {line: 0, character: 3}
|
||||
- anchor: {line: 0, character: 4}
|
||||
active: {line: 0, character: 4}
|
||||
marks:
|
||||
default..:
|
||||
start: {line: 0, character: 3}
|
||||
end: {line: 0, character: 4}
|
||||
finalState:
|
||||
documentContents: a b.c
|
||||
selections:
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 3}
|
||||
active: {line: 0, character: 3}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 4}
|
||||
active: {line: 0, character: 4}
|
||||
fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: .}, selectionType: token, position: after, insideOutsideType: inside, modifier: {type: identity}}]
|
41
src/test/suite/fixtures/recorded/actions/giveAirAndBang.yml
Normal file
41
src/test/suite/fixtures/recorded/actions/giveAirAndBang.yml
Normal file
@ -0,0 +1,41 @@
|
||||
spokenForm: give air and bang
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: list
|
||||
elements:
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: a}
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: '!'}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: |
|
||||
"a!
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 2}
|
||||
- anchor: {line: 0, character: 2}
|
||||
active: {line: 0, character: 3}
|
||||
marks:
|
||||
default.a:
|
||||
start: {line: 0, character: 1}
|
||||
end: {line: 0, character: 2}
|
||||
default.!:
|
||||
start: {line: 0, character: 2}
|
||||
end: {line: 0, character: 3}
|
||||
finalState:
|
||||
documentContents: |
|
||||
"a!
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 2}
|
||||
- anchor: {line: 0, character: 2}
|
||||
active: {line: 0, character: 3}
|
||||
fullTargets: [{type: list, elements: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: a}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}, {type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: '!'}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}]}]
|
28
src/test/suite/fixtures/recorded/actions/giveBat.yml
Normal file
28
src/test/suite/fixtures/recorded/actions/giveBat.yml
Normal file
@ -0,0 +1,28 @@
|
||||
spokenForm: give bat
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: b}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: a b c d
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 2}
|
||||
active: {line: 0, character: 7}
|
||||
marks:
|
||||
default.b:
|
||||
start: {line: 0, character: 2}
|
||||
end: {line: 0, character: 3}
|
||||
finalState:
|
||||
documentContents: a b c d
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 2}
|
||||
active: {line: 0, character: 3}
|
||||
fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: b}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}]
|
28
src/test/suite/fixtures/recorded/actions/giveBat2.yml
Normal file
28
src/test/suite/fixtures/recorded/actions/giveBat2.yml
Normal file
@ -0,0 +1,28 @@
|
||||
spokenForm: give bat
|
||||
languageId: markdown
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: b}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: a b.
|
||||
selections:
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 3}
|
||||
active: {line: 0, character: 3}
|
||||
marks:
|
||||
default.b:
|
||||
start: {line: 0, character: 2}
|
||||
end: {line: 0, character: 3}
|
||||
finalState:
|
||||
documentContents: a b.
|
||||
selections:
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 1}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 2}
|
||||
active: {line: 0, character: 3}
|
||||
fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: b}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}]
|
33
src/test/suite/fixtures/recorded/actions/giveBeforeDot.yml
Normal file
33
src/test/suite/fixtures/recorded/actions/giveBeforeDot.yml
Normal file
@ -0,0 +1,33 @@
|
||||
spokenForm: give before dot
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: primitive
|
||||
position: before
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: .}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: a b.c
|
||||
selections:
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 3}
|
||||
active: {line: 0, character: 3}
|
||||
- anchor: {line: 0, character: 4}
|
||||
active: {line: 0, character: 4}
|
||||
marks:
|
||||
default..:
|
||||
start: {line: 0, character: 3}
|
||||
end: {line: 0, character: 4}
|
||||
finalState:
|
||||
documentContents: a b.c
|
||||
selections:
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 4}
|
||||
active: {line: 0, character: 4}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 3}
|
||||
active: {line: 0, character: 3}
|
||||
fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: .}, selectionType: token, position: before, insideOutsideType: inside, modifier: {type: identity}}]
|
34
src/test/suite/fixtures/recorded/actions/giveBlueQuote.yml
Normal file
34
src/test/suite/fixtures/recorded/actions/giveBlueQuote.yml
Normal file
@ -0,0 +1,34 @@
|
||||
spokenForm: give blue quote
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: blue, character: '"'}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: |
|
||||
"hello"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 6}
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 7}
|
||||
marks:
|
||||
blue.":
|
||||
start: {line: 0, character: 6}
|
||||
end: {line: 0, character: 7}
|
||||
finalState:
|
||||
documentContents: |
|
||||
"hello"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 6}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 7}
|
||||
fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: blue, character: '"'}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}]
|
@ -0,0 +1,41 @@
|
||||
spokenForm: give blue quote and quote
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: list
|
||||
elements:
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: blue, character: '"'}
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: '"'}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: |
|
||||
"hello"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 6}
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 7}
|
||||
marks:
|
||||
blue.":
|
||||
start: {line: 0, character: 6}
|
||||
end: {line: 0, character: 7}
|
||||
default.":
|
||||
start: {line: 0, character: 0}
|
||||
end: {line: 0, character: 1}
|
||||
finalState:
|
||||
documentContents: |
|
||||
"hello"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 6}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 7}
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
fullTargets: [{type: list, elements: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: blue, character: '"'}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}, {type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: '"'}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}]}]
|
28
src/test/suite/fixtures/recorded/actions/giveCap.yml
Normal file
28
src/test/suite/fixtures/recorded/actions/giveCap.yml
Normal file
@ -0,0 +1,28 @@
|
||||
spokenForm: give cap
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: c}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: a b c d
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 2}
|
||||
active: {line: 0, character: 7}
|
||||
marks:
|
||||
default.c:
|
||||
start: {line: 0, character: 4}
|
||||
end: {line: 0, character: 5}
|
||||
finalState:
|
||||
documentContents: a b c d
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 4}
|
||||
active: {line: 0, character: 5}
|
||||
fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: c}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}]
|
28
src/test/suite/fixtures/recorded/actions/giveDot.yml
Normal file
28
src/test/suite/fixtures/recorded/actions/giveDot.yml
Normal file
@ -0,0 +1,28 @@
|
||||
spokenForm: give dot
|
||||
languageId: markdown
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: .}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: a b.
|
||||
selections:
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 3}
|
||||
active: {line: 0, character: 3}
|
||||
marks:
|
||||
default..:
|
||||
start: {line: 0, character: 3}
|
||||
end: {line: 0, character: 4}
|
||||
finalState:
|
||||
documentContents: a b.
|
||||
selections:
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 1}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 3}
|
||||
active: {line: 0, character: 4}
|
||||
fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: .}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}]
|
30
src/test/suite/fixtures/recorded/actions/giveDot2.yml
Normal file
30
src/test/suite/fixtures/recorded/actions/giveDot2.yml
Normal file
@ -0,0 +1,30 @@
|
||||
spokenForm: give dot
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: .}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: a b.c
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 3}
|
||||
active: {line: 0, character: 3}
|
||||
- anchor: {line: 0, character: 4}
|
||||
active: {line: 0, character: 4}
|
||||
marks:
|
||||
default..:
|
||||
start: {line: 0, character: 3}
|
||||
end: {line: 0, character: 4}
|
||||
finalState:
|
||||
documentContents: a b.c
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 3}
|
||||
active: {line: 0, character: 4}
|
||||
fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: .}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}]
|
28
src/test/suite/fixtures/recorded/actions/giveDrum.yml
Normal file
28
src/test/suite/fixtures/recorded/actions/giveDrum.yml
Normal file
@ -0,0 +1,28 @@
|
||||
spokenForm: give drum
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: d}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: a b c d
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 2}
|
||||
active: {line: 0, character: 7}
|
||||
marks:
|
||||
default.d:
|
||||
start: {line: 0, character: 6}
|
||||
end: {line: 0, character: 7}
|
||||
finalState:
|
||||
documentContents: a b c d
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 7}
|
||||
fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: d}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}]
|
@ -0,0 +1,48 @@
|
||||
spokenForm: give equals past colon
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: range
|
||||
start:
|
||||
type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: '='}
|
||||
end:
|
||||
type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: ':'}
|
||||
excludeStart: false
|
||||
excludeEnd: false
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: |
|
||||
const values: string = "hello"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 5}
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 12}
|
||||
- anchor: {line: 0, character: 14}
|
||||
active: {line: 0, character: 20}
|
||||
- anchor: {line: 0, character: 24}
|
||||
active: {line: 0, character: 29}
|
||||
marks:
|
||||
default.=:
|
||||
start: {line: 0, character: 21}
|
||||
end: {line: 0, character: 22}
|
||||
"default.:":
|
||||
start: {line: 0, character: 12}
|
||||
end: {line: 0, character: 13}
|
||||
finalState:
|
||||
documentContents: |
|
||||
const values: string = "hello"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 5}
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 12}
|
||||
- anchor: {line: 0, character: 24}
|
||||
active: {line: 0, character: 29}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 22}
|
||||
active: {line: 0, character: 12}
|
||||
fullTargets: [{type: range, excludeAnchor: false, excludeActive: false, anchor: {type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: '='}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}, active: {type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: ':'}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}}]
|
34
src/test/suite/fixtures/recorded/actions/giveHarp.yml
Normal file
34
src/test/suite/fixtures/recorded/actions/giveHarp.yml
Normal file
@ -0,0 +1,34 @@
|
||||
spokenForm: give harp
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: h}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: |
|
||||
"hello"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 6}
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 7}
|
||||
marks:
|
||||
default.h:
|
||||
start: {line: 0, character: 1}
|
||||
end: {line: 0, character: 6}
|
||||
finalState:
|
||||
documentContents: |
|
||||
"hello"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 7}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 6}
|
||||
fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: h}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}]
|
@ -0,0 +1,37 @@
|
||||
spokenForm: give harp and whale
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: list
|
||||
elements:
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: h}
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: w}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: hello world
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 5}
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 11}
|
||||
marks:
|
||||
default.h:
|
||||
start: {line: 0, character: 0}
|
||||
end: {line: 0, character: 5}
|
||||
default.w:
|
||||
start: {line: 0, character: 6}
|
||||
end: {line: 0, character: 11}
|
||||
finalState:
|
||||
documentContents: hello world
|
||||
selections:
|
||||
- anchor: {line: 0, character: 5}
|
||||
active: {line: 0, character: 5}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 5}
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 11}
|
||||
fullTargets: [{type: list, elements: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: h}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}, {type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: w}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}]}]
|
34
src/test/suite/fixtures/recorded/actions/giveQuote.yml
Normal file
34
src/test/suite/fixtures/recorded/actions/giveQuote.yml
Normal file
@ -0,0 +1,34 @@
|
||||
spokenForm: give quote
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: '"'}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: |
|
||||
"hello"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 6}
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 7}
|
||||
marks:
|
||||
default.":
|
||||
start: {line: 0, character: 0}
|
||||
end: {line: 0, character: 1}
|
||||
finalState:
|
||||
documentContents: |
|
||||
"hello"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 6}
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 7}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: '"'}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}]
|
41
src/test/suite/fixtures/recorded/actions/giveQuoteAndAir.yml
Normal file
41
src/test/suite/fixtures/recorded/actions/giveQuoteAndAir.yml
Normal file
@ -0,0 +1,41 @@
|
||||
spokenForm: give quote and air
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: list
|
||||
elements:
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: '"'}
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: a}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: |
|
||||
"a!
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 2}
|
||||
- anchor: {line: 0, character: 2}
|
||||
active: {line: 0, character: 3}
|
||||
marks:
|
||||
default.":
|
||||
start: {line: 0, character: 0}
|
||||
end: {line: 0, character: 1}
|
||||
default.a:
|
||||
start: {line: 0, character: 1}
|
||||
end: {line: 0, character: 2}
|
||||
finalState:
|
||||
documentContents: |
|
||||
"a!
|
||||
selections:
|
||||
- anchor: {line: 0, character: 2}
|
||||
active: {line: 0, character: 3}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 2}
|
||||
fullTargets: [{type: list, elements: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: '"'}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}, {type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: a}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}]}]
|
@ -0,0 +1,41 @@
|
||||
spokenForm: give quote and bang
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: list
|
||||
elements:
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: '"'}
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: '!'}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: |
|
||||
"a!
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 2}
|
||||
- anchor: {line: 0, character: 2}
|
||||
active: {line: 0, character: 3}
|
||||
marks:
|
||||
default.":
|
||||
start: {line: 0, character: 0}
|
||||
end: {line: 0, character: 1}
|
||||
default.!:
|
||||
start: {line: 0, character: 2}
|
||||
end: {line: 0, character: 3}
|
||||
finalState:
|
||||
documentContents: |
|
||||
"a!
|
||||
selections:
|
||||
- anchor: {line: 0, character: 1}
|
||||
active: {line: 0, character: 2}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 1}
|
||||
- anchor: {line: 0, character: 2}
|
||||
active: {line: 0, character: 3}
|
||||
fullTargets: [{type: list, elements: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: '"'}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}, {type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: '!'}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}]}]
|
45
src/test/suite/fixtures/recorded/actions/giveVestAndHarp.yml
Normal file
45
src/test/suite/fixtures/recorded/actions/giveVestAndHarp.yml
Normal file
@ -0,0 +1,45 @@
|
||||
spokenForm: give vest and harp
|
||||
languageId: typescript
|
||||
command:
|
||||
actionName: deselect
|
||||
partialTargets:
|
||||
- type: list
|
||||
elements:
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: v}
|
||||
- type: primitive
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: h}
|
||||
extraArgs: []
|
||||
initialState:
|
||||
documentContents: |
|
||||
const values: string = "hello"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 5}
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 12}
|
||||
- anchor: {line: 0, character: 14}
|
||||
active: {line: 0, character: 20}
|
||||
- anchor: {line: 0, character: 24}
|
||||
active: {line: 0, character: 29}
|
||||
marks:
|
||||
default.v:
|
||||
start: {line: 0, character: 6}
|
||||
end: {line: 0, character: 12}
|
||||
default.h:
|
||||
start: {line: 0, character: 24}
|
||||
end: {line: 0, character: 29}
|
||||
finalState:
|
||||
documentContents: |
|
||||
const values: string = "hello"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 5}
|
||||
- anchor: {line: 0, character: 14}
|
||||
active: {line: 0, character: 20}
|
||||
thatMark:
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 12}
|
||||
- anchor: {line: 0, character: 24}
|
||||
active: {line: 0, character: 29}
|
||||
fullTargets: [{type: list, elements: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: v}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}, {type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: h}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: identity}}]}]
|
@ -318,6 +318,7 @@ export type ActionType =
|
||||
| "clearAndSetSelection"
|
||||
| "copyToClipboard"
|
||||
| "cutToClipboard"
|
||||
| "deselect"
|
||||
| "editNewLineAfter"
|
||||
| "editNewLineBefore"
|
||||
| "extractVariable"
|
||||
|
Loading…
Reference in New Issue
Block a user