mirror of
https://github.com/Silverquark/dance.git
synced 2024-09-11 10:45:43 +03:00
misc: rename input to more accurate identifiers
This commit is contained in:
parent
6ae428812e
commit
3430afbfa4
@ -81,7 +81,7 @@ character.
|
|||||||
|
|
||||||
Most keybindings exposed by Dance are actually implemented by running several
|
Most keybindings exposed by Dance are actually implemented by running several
|
||||||
Dance commands in a row. For instance, `dance.modes.set.normal` is actually a
|
Dance commands in a row. For instance, `dance.modes.set.normal` is actually a
|
||||||
wrapper around `dance.modes.set` with the argument `{ input: "normal" }`.
|
wrapper around `dance.modes.set` with the argument `{ mode: "normal" }`.
|
||||||
Commands that take an input, like `dance.modes.set`, will prompt a user for a
|
Commands that take an input, like `dance.modes.set`, will prompt a user for a
|
||||||
value if no argument is given.
|
value if no argument is given.
|
||||||
|
|
||||||
|
@ -100,12 +100,10 @@ function determineSupportedInputs(f: Builder.ParsedFunction) {
|
|||||||
supported.push("may be repeated with a given number of repetitions");
|
supported.push("may be repeated with a given number of repetitions");
|
||||||
} else if (match = /^RegisterOr<"(\w+)"(?:, .+)?>$/.exec(type)) {
|
} else if (match = /^RegisterOr<"(\w+)"(?:, .+)?>$/.exec(type)) {
|
||||||
supported.push(`accepts a register (by default, it uses \`${match[1]}\`)`);
|
supported.push(`accepts a register (by default, it uses \`${match[1]}\`)`);
|
||||||
} else if (match = /^InputOr<(\w+)>$/.exec(type)) {
|
|
||||||
supported.push(`takes an input of type \`${match[1]}\``);
|
|
||||||
} else if (match = /^Argument<(.+)>( \| undefined)$/.exec(type)) {
|
} else if (match = /^Argument<(.+)>( \| undefined)$/.exec(type)) {
|
||||||
supported.push(`takes an argument \`${name}\` of type \`${match[1]}\``);
|
supported.push(`takes an argument \`${name}\` of type \`${match[1]}\``);
|
||||||
} else if (name === "input") {
|
} else if (match = /^InputOr<"(\w+?)", (.+)>/.exec(type)) {
|
||||||
supported.push(`takes an input of type \`${type}\``);
|
supported.push(`takes an input \`${match[1]}\` of type \`${match[2]}\``);
|
||||||
} else if (name === "argument") {
|
} else if (name === "argument") {
|
||||||
supported.push(`accepts an argument of type \`${type}\``);
|
supported.push(`accepts an argument of type \`${type}\``);
|
||||||
} else if (/^(Context|vscode.Text(Editor|Document))$/.test(type) || name === "selections") {
|
} else if (/^(Context|vscode.Text(Editor|Document))$/.test(type) || name === "selections") {
|
||||||
|
114
src/commands/README.md
generated
114
src/commands/README.md
generated
@ -173,19 +173,19 @@
|
|||||||
<tr><td><a href="#selections.select"><code>selections.select</code></a></td><td>Select within selections</td><td><code>S</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
<tr><td><a href="#selections.select"><code>selections.select</code></a></td><td>Select within selections</td><td><code>S</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
||||||
<tr><td><a href="./selections.ts#L301"><code>selections.clear.main</code></a></td><td>Clear main selections</td><td><code>Alt+Space</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
<tr><td><a href="./selections.ts#L301"><code>selections.clear.main</code></a></td><td>Clear main selections</td><td><code>Alt+Space</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
||||||
<tr><td><a href="./selections.ts#L300"><code>selections.clear.secondary</code></a></td><td>Clear secondary selections</td><td><code>Space</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
<tr><td><a href="./selections.ts#L300"><code>selections.clear.secondary</code></a></td><td>Clear secondary selections</td><td><code>Space</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
||||||
<tr><td><a href="./selections.ts#L793"><code>selections.copy.above</code></a></td><td>Copy selections above</td><td><code>Shift+Alt+C</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
<tr><td><a href="./selections.ts#L795"><code>selections.copy.above</code></a></td><td>Copy selections above</td><td><code>Shift+Alt+C</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
||||||
<tr><td><a href="./selections.ts#L645"><code>selections.faceBackward</code></a></td><td>Backward selections</td><td></td></tr>
|
<tr><td><a href="./selections.ts#L647"><code>selections.faceBackward</code></a></td><td>Backward selections</td><td></td></tr>
|
||||||
<tr><td><a href="./selections.ts#L644"><code>selections.faceForward</code></a></td><td>Forward selections</td><td><code>Shift+Alt+;</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
<tr><td><a href="./selections.ts#L646"><code>selections.faceForward</code></a></td><td>Forward selections</td><td><code>Shift+Alt+;</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
||||||
<tr><td><a href="./selections.ts#L298"><code>selections.filter.regexp</code></a></td><td>Keep matching selections</td><td><code>Alt+K</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
<tr><td><a href="./selections.ts#L298"><code>selections.filter.regexp</code></a></td><td>Keep matching selections</td><td><code>Alt+K</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
||||||
<tr><td><a href="./selections.ts#L299"><code>selections.filter.regexp.inverse</code></a></td><td>Clear matching selections</td><td><code>Shift+Alt+K</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
<tr><td><a href="./selections.ts#L299"><code>selections.filter.regexp.inverse</code></a></td><td>Clear matching selections</td><td><code>Shift+Alt+K</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
||||||
<tr><td><a href="./selections.ts#L872"><code>selections.hideIndices</code></a></td><td>Hide selection indices</td><td></td></tr>
|
<tr><td><a href="./selections.ts#L874"><code>selections.hideIndices</code></a></td><td>Hide selection indices</td><td></td></tr>
|
||||||
<tr><td><a href="./selections.ts#L684"><code>selections.orderAscending</code></a></td><td>Order selections ascending</td><td></td></tr>
|
<tr><td><a href="./selections.ts#L686"><code>selections.orderAscending</code></a></td><td>Order selections ascending</td><td></td></tr>
|
||||||
<tr><td><a href="./selections.ts#L683"><code>selections.orderDescending</code></a></td><td>Order selections descending</td><td></td></tr>
|
<tr><td><a href="./selections.ts#L685"><code>selections.orderDescending</code></a></td><td>Order selections descending</td><td></td></tr>
|
||||||
<tr><td><a href="./selections.ts#L254"><code>selections.pipe.append</code></a></td><td>Pipe and append</td><td><code>Shift+1</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
<tr><td><a href="./selections.ts#L254"><code>selections.pipe.append</code></a></td><td>Pipe and append</td><td><code>Shift+1</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
||||||
<tr><td><a href="./selections.ts#L255"><code>selections.pipe.prepend</code></a></td><td>Pipe and prepend</td><td><code>Shift+Alt+1</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
<tr><td><a href="./selections.ts#L255"><code>selections.pipe.prepend</code></a></td><td>Pipe and prepend</td><td><code>Shift+Alt+1</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
||||||
<tr><td><a href="./selections.ts#L253"><code>selections.pipe.replace</code></a></td><td>Pipe and replace</td><td><code>Shift+\</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
<tr><td><a href="./selections.ts#L253"><code>selections.pipe.replace</code></a></td><td>Pipe and replace</td><td><code>Shift+\</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
||||||
<tr><td><a href="./selections.ts#L563"><code>selections.reduce.edges</code></a></td><td>Reduce selections to their ends</td><td><code>Shift+Alt+S</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
<tr><td><a href="./selections.ts#L565"><code>selections.reduce.edges</code></a></td><td>Reduce selections to their ends</td><td><code>Shift+Alt+S</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
||||||
<tr><td><a href="./selections.ts#L871"><code>selections.showIndices</code></a></td><td>Show selection indices</td><td></td></tr>
|
<tr><td><a href="./selections.ts#L873"><code>selections.showIndices</code></a></td><td>Show selection indices</td><td></td></tr>
|
||||||
<tr><td><a href="#selections.sort"><code>selections.sort</code></a></td><td>Sort selections</td><td></td></tr>
|
<tr><td><a href="#selections.sort"><code>selections.sort</code></a></td><td>Sort selections</td><td></td></tr>
|
||||||
<tr><td><a href="#selections.split"><code>selections.split</code></a></td><td>Split selections</td><td><code>Shift+S</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
<tr><td><a href="#selections.split"><code>selections.split</code></a></td><td>Split selections</td><td><code>Shift+S</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
||||||
<tr><td><a href="#selections.splitLines"><code>selections.splitLines</code></a></td><td>Split selections at line boundaries</td><td><code>Alt+S</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
<tr><td><a href="#selections.splitLines"><code>selections.splitLines</code></a></td><td>Split selections at line boundaries</td><td><code>Alt+S</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
|
||||||
@ -388,6 +388,7 @@ Replace characters.
|
|||||||
|
|
||||||
This command:
|
This command:
|
||||||
- may be repeated with a given number of repetitions.
|
- may be repeated with a given number of repetitions.
|
||||||
|
- takes an input `input` of type `string`.
|
||||||
|
|
||||||
Default keybinding: `r` (normal)
|
Default keybinding: `r` (normal)
|
||||||
|
|
||||||
@ -641,8 +642,8 @@ This command:
|
|||||||
Run code.
|
Run code.
|
||||||
|
|
||||||
There are two ways to invoke this command. The first one is to provide an
|
There are two ways to invoke this command. The first one is to provide an
|
||||||
`input` string argument. This input must be a valid JavaScript string, and
|
`code` string argument. This code must be a valid JavaScript string, and will
|
||||||
will be executed with full access to the [Dance API](../api/README.md). For
|
be executed with full access to the [Dance API](../api/README.md). For
|
||||||
instance,
|
instance,
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@ -738,14 +739,15 @@ code execution is enabled, or `commands` otherwise.
|
|||||||
|
|
||||||
This command:
|
This command:
|
||||||
- accepts a register (by default, it uses `null`).
|
- accepts a register (by default, it uses `null`).
|
||||||
- accepts an argument of type `Record<"code" | "input", string | readonly string[]>`.
|
- accepts an argument of type `{ code?: string | readonly string[] }`.
|
||||||
- may be repeated with a given number of repetitions.
|
- may be repeated with a given number of repetitions.
|
||||||
- may be repeated with a given number of repetitions.
|
- may be repeated with a given number of repetitions.
|
||||||
- takes an argument `commands` of type `command.Any[]`.
|
- takes an argument `commands` of type `command.Any[]`.
|
||||||
|
- takes an input `code` of type `string | readonly string[]`.
|
||||||
|
|
||||||
<a name=".selectRegister" />
|
<a name=".selectRegister" />
|
||||||
|
|
||||||
### [`selectRegister`](./misc.ts#L186-L200)
|
### [`selectRegister`](./misc.ts#L184-L198)
|
||||||
|
|
||||||
Select register for next command.
|
Select register for next command.
|
||||||
|
|
||||||
@ -755,22 +757,25 @@ press is awaited again and the returned register will be specific to the
|
|||||||
current document.
|
current document.
|
||||||
|
|
||||||
|
|
||||||
|
This command:
|
||||||
|
- takes an input `register` of type `string | Register`.
|
||||||
|
|
||||||
Default keybinding: `"` (normal)
|
Default keybinding: `"` (normal)
|
||||||
|
|
||||||
<a name=".updateRegister" />
|
<a name=".updateRegister" />
|
||||||
|
|
||||||
### [`updateRegister`](./misc.ts#L216-L227)
|
### [`updateRegister`](./misc.ts#L214-L225)
|
||||||
|
|
||||||
Update the contents of a register.
|
Update the contents of a register.
|
||||||
|
|
||||||
|
|
||||||
This command:
|
This command:
|
||||||
- accepts a register (by default, it uses `dquote`).
|
- accepts a register (by default, it uses `dquote`).
|
||||||
|
- takes an input `input` of type `string`.
|
||||||
|
|
||||||
<a name=".updateCount" />
|
<a name=".updateCount" />
|
||||||
|
|
||||||
### [`updateCount`](./misc.ts#L253-L282)
|
### [`updateCount`](./misc.ts#L251-L280)
|
||||||
|
|
||||||
Update Dance count.
|
Update Dance count.
|
||||||
|
|
||||||
@ -795,14 +800,15 @@ Update the current counter used to repeat the next command.
|
|||||||
This command:
|
This command:
|
||||||
- may be repeated with a given number of repetitions.
|
- may be repeated with a given number of repetitions.
|
||||||
- takes an argument `addDigits` of type `number`.
|
- takes an argument `addDigits` of type `number`.
|
||||||
|
- takes an input `count` of type `number`.
|
||||||
|
|
||||||
<a name=".openMenu" />
|
<a name=".openMenu" />
|
||||||
|
|
||||||
### [`openMenu`](./misc.ts#L310-L332)
|
### [`openMenu`](./misc.ts#L308-L330)
|
||||||
|
|
||||||
Open menu.
|
Open menu.
|
||||||
|
|
||||||
If no input is specified, a prompt will ask for the name of the menu to open.
|
If no menu is specified, a prompt will ask for the name of the menu to open.
|
||||||
|
|
||||||
Alternatively, a `menu` can be inlined in the arguments.
|
Alternatively, a `menu` can be inlined in the arguments.
|
||||||
|
|
||||||
@ -818,10 +824,11 @@ This command:
|
|||||||
- takes an argument `pass` of type `any[]`.
|
- takes an argument `pass` of type `any[]`.
|
||||||
- takes an argument `prefix` of type `string`.
|
- takes an argument `prefix` of type `string`.
|
||||||
- takes an argument `title` of type `string`.
|
- takes an argument `title` of type `string`.
|
||||||
|
- takes an input `menu` of type `string | Menu`.
|
||||||
|
|
||||||
<a name=".changeInput" />
|
<a name=".changeInput" />
|
||||||
|
|
||||||
### [`changeInput`](./misc.ts#L373-L387)
|
### [`changeInput`](./misc.ts#L371-L385)
|
||||||
|
|
||||||
Change current input.
|
Change current input.
|
||||||
|
|
||||||
@ -862,6 +869,10 @@ Other variants are provided to switch to insert mode:
|
|||||||
| Insert at line start | `insert.lineStart` | `s-i` (normal) | `[".select.lineStart", { shift: "jump", skipBlank: true }], [".modes.set", { mode: "insert", +mode }], [".selections.reduce", { where: "start", record: false, empty: true, ... }]` |
|
| Insert at line start | `insert.lineStart` | `s-i` (normal) | `[".select.lineStart", { shift: "jump", skipBlank: true }], [".modes.set", { mode: "insert", +mode }], [".selections.reduce", { where: "start", record: false, empty: true, ... }]` |
|
||||||
| Insert at line end | `insert.lineEnd` | `s-a` (normal) | `[".select.lineEnd" , { shift: "jump" }], [".modes.set", { mode: "insert", +mode }], [".selections.reduce", { where: "end" , record: false, empty: true, ... }]` |
|
| Insert at line end | `insert.lineEnd` | `s-a` (normal) | `[".select.lineEnd" , { shift: "jump" }], [".modes.set", { mode: "insert", +mode }], [".selections.reduce", { where: "end" , record: false, empty: true, ... }]` |
|
||||||
|
|
||||||
|
|
||||||
|
This command:
|
||||||
|
- takes an input `mode` of type `string`.
|
||||||
|
|
||||||
<a name="modes.set.temporarily" />
|
<a name="modes.set.temporarily" />
|
||||||
|
|
||||||
### [`modes.set.temporarily`](./modes.ts#L34-L46)
|
### [`modes.set.temporarily`](./modes.ts#L34-L46)
|
||||||
@ -878,6 +889,7 @@ Set Dance mode temporarily.
|
|||||||
|
|
||||||
This command:
|
This command:
|
||||||
- may be repeated with a given number of repetitions.
|
- may be repeated with a given number of repetitions.
|
||||||
|
- takes an input `mode` of type `string`.
|
||||||
|
|
||||||
## [`search`](./search.ts)
|
## [`search`](./search.ts)
|
||||||
|
|
||||||
@ -898,7 +910,7 @@ Search.
|
|||||||
|
|
||||||
This command:
|
This command:
|
||||||
- accepts a register (by default, it uses `slash`).
|
- accepts a register (by default, it uses `slash`).
|
||||||
- accepts an argument of type `{ input?: string | RegExp }`.
|
- accepts an argument of type `{ re?: string | RegExp }`.
|
||||||
- may be repeated with a given number of repetitions.
|
- may be repeated with a given number of repetitions.
|
||||||
- takes an argument `add` of type `boolean`.
|
- takes an argument `add` of type `boolean`.
|
||||||
- takes an argument `interactive` of type `boolean`.
|
- takes an argument `interactive` of type `boolean`.
|
||||||
@ -968,6 +980,7 @@ Select to character (excluded).
|
|||||||
This command:
|
This command:
|
||||||
- may be repeated with a given number of repetitions.
|
- may be repeated with a given number of repetitions.
|
||||||
- takes an argument `include` of type `boolean`.
|
- takes an argument `include` of type `boolean`.
|
||||||
|
- takes an input `input` of type `string`.
|
||||||
|
|
||||||
Default keybinding: `t` (normal)
|
Default keybinding: `t` (normal)
|
||||||
|
|
||||||
@ -1057,6 +1070,7 @@ Select object.
|
|||||||
This command:
|
This command:
|
||||||
- takes an argument `inner` of type `boolean`.
|
- takes an argument `inner` of type `boolean`.
|
||||||
- takes an argument `where` of type `"start" | "end"`.
|
- takes an argument `where` of type `"start" | "end"`.
|
||||||
|
- takes an input `input` of type `string`.
|
||||||
|
|
||||||
## [`select`](./select.ts)
|
## [`select`](./select.ts)
|
||||||
|
|
||||||
@ -1361,14 +1375,15 @@ See https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#changes
|
|||||||
|
|
||||||
#### Additional commands
|
#### Additional commands
|
||||||
|
|
||||||
| Title | Identifier | Keybinding | Commands |
|
| Title | Identifier | Keybinding | Commands |
|
||||||
| ------------------- | -------------- | -------------- | ----------------------------------------------------------------------------------------------------- |
|
| ------------------- | -------------- | -------------- | ---------------------------------------------------------------------------------------------------------- |
|
||||||
| Pipe and replace | `pipe.replace` | `\|` (normal) | `[".selections.pipe", { +input,register }], [".edit.insert", { register: "\|" , ... }]` |
|
| Pipe and replace | `pipe.replace` | `\|` (normal) | `[".selections.pipe", { +expression,register }], [".edit.insert", { register: "\|" , ... }]` |
|
||||||
| Pipe and append | `pipe.append` | `!` (normal) | `[".selections.pipe", { +input,register }], [".edit.insert", { register: "\|", where: "end" , ... }]` |
|
| Pipe and append | `pipe.append` | `!` (normal) | `[".selections.pipe", { +expression,register }], [".edit.insert", { register: "\|", where: "end" , ... }]` |
|
||||||
| Pipe and prepend | `pipe.prepend` | `a-!` (normal) | `[".selections.pipe", { +input,register }], [".edit.insert", { register: "\|", where: "start", ... }]` |
|
| Pipe and prepend | `pipe.prepend` | `a-!` (normal) | `[".selections.pipe", { +expression,register }], [".edit.insert", { register: "\|", where: "start", ... }]` |
|
||||||
|
|
||||||
This command:
|
This command:
|
||||||
- accepts a register (by default, it uses `pipe`).
|
- accepts a register (by default, it uses `pipe`).
|
||||||
|
- takes an input `expression` of type `string`.
|
||||||
|
|
||||||
Default keybinding: `a-|` (normal)
|
Default keybinding: `a-|` (normal)
|
||||||
|
|
||||||
@ -1381,17 +1396,17 @@ Filter selections.
|
|||||||
|
|
||||||
#### Variants
|
#### Variants
|
||||||
|
|
||||||
| Title | Identifier | Keybinding | Commands |
|
| Title | Identifier | Keybinding | Commands |
|
||||||
| -------------------------- | ----------------------- | ------------------ | ------------------------------------------------------------------- |
|
| -------------------------- | ----------------------- | ------------------ | ------------------------------------------------------------------------ |
|
||||||
| Keep matching selections | `filter.regexp` | `a-k` (normal) | `[".selections.filter", { defaultInput: "/" , ... }]` |
|
| Keep matching selections | `filter.regexp` | `a-k` (normal) | `[".selections.filter", { defaultExpression: "/" , ... }]` |
|
||||||
| Clear matching selections | `filter.regexp.inverse` | `s-a-k` (normal) | `[".selections.filter", { defaultInput: "/", inverse: true, ... }]` |
|
| Clear matching selections | `filter.regexp.inverse` | `s-a-k` (normal) | `[".selections.filter", { defaultExpression: "/", inverse: true, ... }]` |
|
||||||
| Clear secondary selections | `clear.secondary` | `space` (normal) | `[".selections.filter", { input: "i === count" , ... }]` |
|
| Clear secondary selections | `clear.secondary` | `space` (normal) | `[".selections.filter", { expression: "i === count" , ... }]` |
|
||||||
| Clear main selections | `clear.main` | `a-space` (normal) | `[".selections.filter", { input: "i !== count" , ... }]` |
|
| Clear main selections | `clear.main` | `a-space` (normal) | `[".selections.filter", { expression: "i !== count" , ... }]` |
|
||||||
|
|
||||||
This command:
|
This command:
|
||||||
- accepts an argument of type `{ input?: string }`.
|
- accepts an argument of type `{ expression?: string }`.
|
||||||
- may be repeated with a given number of repetitions.
|
- may be repeated with a given number of repetitions.
|
||||||
- takes an argument `defaultInput` of type `string`.
|
- takes an argument `defaultExpression` of type `string`.
|
||||||
- takes an argument `interactive` of type `boolean`.
|
- takes an argument `interactive` of type `boolean`.
|
||||||
- takes an argument `inverse` of type `boolean`.
|
- takes an argument `inverse` of type `boolean`.
|
||||||
|
|
||||||
@ -1399,26 +1414,26 @@ Default keybinding: `$` (normal)
|
|||||||
|
|
||||||
<a name="selections.select" />
|
<a name="selections.select" />
|
||||||
|
|
||||||
### [`selections.select`](./selections.ts#L340-L350)
|
### [`selections.select`](./selections.ts#L342-L352)
|
||||||
|
|
||||||
Select within selections.
|
Select within selections.
|
||||||
|
|
||||||
|
|
||||||
This command:
|
This command:
|
||||||
- accepts an argument of type `{ input?: string | RegExp }`.
|
- accepts an argument of type `{ re?: string | RegExp }`.
|
||||||
- takes an argument `interactive` of type `boolean`.
|
- takes an argument `interactive` of type `boolean`.
|
||||||
|
|
||||||
Default keybinding: `s` (normal)
|
Default keybinding: `s` (normal)
|
||||||
|
|
||||||
<a name="selections.split" />
|
<a name="selections.split" />
|
||||||
|
|
||||||
### [`selections.split`](./selections.ts#L369-L380)
|
### [`selections.split`](./selections.ts#L371-L382)
|
||||||
|
|
||||||
Split selections.
|
Split selections.
|
||||||
|
|
||||||
|
|
||||||
This command:
|
This command:
|
||||||
- accepts an argument of type `{ input?: string | RegExp }`.
|
- accepts an argument of type `{ re?: string | RegExp }`.
|
||||||
- takes an argument `excludeEmpty` of type `boolean`.
|
- takes an argument `excludeEmpty` of type `boolean`.
|
||||||
- takes an argument `interactive` of type `boolean`.
|
- takes an argument `interactive` of type `boolean`.
|
||||||
|
|
||||||
@ -1426,7 +1441,7 @@ Default keybinding: `s-s` (normal)
|
|||||||
|
|
||||||
<a name="selections.splitLines" />
|
<a name="selections.splitLines" />
|
||||||
|
|
||||||
### [`selections.splitLines`](./selections.ts#L405-L416)
|
### [`selections.splitLines`](./selections.ts#L407-L418)
|
||||||
|
|
||||||
Split selections at line boundaries.
|
Split selections at line boundaries.
|
||||||
|
|
||||||
@ -1439,7 +1454,7 @@ Default keybinding: `a-s` (normal)
|
|||||||
|
|
||||||
<a name="selections.expandToLines" />
|
<a name="selections.expandToLines" />
|
||||||
|
|
||||||
### [`selections.expandToLines`](./selections.ts#L459-L466)
|
### [`selections.expandToLines`](./selections.ts#L461-L468)
|
||||||
|
|
||||||
Expand to lines.
|
Expand to lines.
|
||||||
|
|
||||||
@ -1451,7 +1466,7 @@ Default keybinding: `a-x` (normal)
|
|||||||
|
|
||||||
<a name="selections.trimLines" />
|
<a name="selections.trimLines" />
|
||||||
|
|
||||||
### [`selections.trimLines`](./selections.ts#L493-L500)
|
### [`selections.trimLines`](./selections.ts#L495-L502)
|
||||||
|
|
||||||
Trim lines.
|
Trim lines.
|
||||||
|
|
||||||
@ -1463,7 +1478,7 @@ Default keybinding: `s-a-x` (normal)
|
|||||||
|
|
||||||
<a name="selections.trimWhitespace" />
|
<a name="selections.trimWhitespace" />
|
||||||
|
|
||||||
### [`selections.trimWhitespace`](./selections.ts#L525-L532)
|
### [`selections.trimWhitespace`](./selections.ts#L527-L534)
|
||||||
|
|
||||||
Trim whitespace.
|
Trim whitespace.
|
||||||
|
|
||||||
@ -1475,7 +1490,7 @@ Default keybinding: `_` (normal)
|
|||||||
|
|
||||||
<a name="selections.reduce" />
|
<a name="selections.reduce" />
|
||||||
|
|
||||||
### [`selections.reduce`](./selections.ts#L551-L570)
|
### [`selections.reduce`](./selections.ts#L553-L572)
|
||||||
|
|
||||||
Reduce selections to their cursor.
|
Reduce selections to their cursor.
|
||||||
|
|
||||||
@ -1495,7 +1510,7 @@ Default keybinding: `;` (normal)
|
|||||||
|
|
||||||
<a name="selections.changeDirection" />
|
<a name="selections.changeDirection" />
|
||||||
|
|
||||||
### [`selections.changeDirection`](./selections.ts#L632-L647)
|
### [`selections.changeDirection`](./selections.ts#L634-L649)
|
||||||
|
|
||||||
Change direction of selections.
|
Change direction of selections.
|
||||||
|
|
||||||
@ -1513,7 +1528,7 @@ Default keybinding: `a-;` (normal)
|
|||||||
|
|
||||||
<a name="selections.changeOrder" />
|
<a name="selections.changeOrder" />
|
||||||
|
|
||||||
### [`selections.changeOrder`](./selections.ts#L672-L686)
|
### [`selections.changeOrder`](./selections.ts#L674-L688)
|
||||||
|
|
||||||
Reverse selections.
|
Reverse selections.
|
||||||
|
|
||||||
@ -1527,13 +1542,18 @@ Reverse selections.
|
|||||||
|
|
||||||
<a name="selections.sort" />
|
<a name="selections.sort" />
|
||||||
|
|
||||||
### [`selections.sort`](./selections.ts#L699-L711)
|
### [`selections.sort`](./selections.ts#L701-L713)
|
||||||
|
|
||||||
Sort selections.
|
Sort selections.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
This command:
|
||||||
|
- takes an input `expression` of type `string`.
|
||||||
|
|
||||||
<a name="selections.copy" />
|
<a name="selections.copy" />
|
||||||
|
|
||||||
### [`selections.copy`](./selections.ts#L784-L802)
|
### [`selections.copy`](./selections.ts#L786-L804)
|
||||||
|
|
||||||
Copy selections below.
|
Copy selections below.
|
||||||
|
|
||||||
@ -1551,7 +1571,7 @@ Default keybinding: `s-c` (normal)
|
|||||||
|
|
||||||
<a name="selections.merge" />
|
<a name="selections.merge" />
|
||||||
|
|
||||||
### [`selections.merge`](./selections.ts#L836-L841)
|
### [`selections.merge`](./selections.ts#L838-L843)
|
||||||
|
|
||||||
Merge contiguous selections.
|
Merge contiguous selections.
|
||||||
|
|
||||||
@ -1561,13 +1581,13 @@ Default keybinding: `a-_` (normal)
|
|||||||
|
|
||||||
<a name="selections.open" />
|
<a name="selections.open" />
|
||||||
|
|
||||||
### [`selections.open`](./selections.ts#L845-L848)
|
### [`selections.open`](./selections.ts#L847-L850)
|
||||||
|
|
||||||
Open selected file.
|
Open selected file.
|
||||||
|
|
||||||
<a name="selections.toggleIndices" />
|
<a name="selections.toggleIndices" />
|
||||||
|
|
||||||
### [`selections.toggleIndices`](./selections.ts#L862-L879)
|
### [`selections.toggleIndices`](./selections.ts#L864-L881)
|
||||||
|
|
||||||
Toggle selection indices.
|
Toggle selection indices.
|
||||||
|
|
||||||
|
18
src/commands/load-all.ts
generated
18
src/commands/load-all.ts
generated
@ -575,7 +575,7 @@ export const commands: Commands = function () {
|
|||||||
),
|
),
|
||||||
"dance.selections.filter": new CommandDescriptor(
|
"dance.selections.filter": new CommandDescriptor(
|
||||||
"dance.selections.filter",
|
"dance.selections.filter",
|
||||||
(_, argument) => _.runAsync((_) => selections_filter(_, argument, argument["defaultInput"], argument["inverse"], argument["interactive"], getCount(_, argument))),
|
(_, argument) => _.runAsync((_) => selections_filter(_, argument, argument["defaultExpression"], argument["inverse"], argument["interactive"], getCount(_, argument))),
|
||||||
CommandDescriptor.Flags.RequiresActiveEditor,
|
CommandDescriptor.Flags.RequiresActiveEditor,
|
||||||
),
|
),
|
||||||
"dance.selections.merge": new CommandDescriptor(
|
"dance.selections.merge": new CommandDescriptor(
|
||||||
@ -590,7 +590,7 @@ export const commands: Commands = function () {
|
|||||||
),
|
),
|
||||||
"dance.selections.pipe": new CommandDescriptor(
|
"dance.selections.pipe": new CommandDescriptor(
|
||||||
"dance.selections.pipe",
|
"dance.selections.pipe",
|
||||||
(_, argument) => _.runAsync((_) => selections_pipe(_, getRegister(_, argument, "pipe", Register.Flags.CanWrite), getInputOr("input", argument))),
|
(_, argument) => _.runAsync((_) => selections_pipe(_, getRegister(_, argument, "pipe", Register.Flags.CanWrite), getInputOr("expression", argument))),
|
||||||
CommandDescriptor.Flags.RequiresActiveEditor,
|
CommandDescriptor.Flags.RequiresActiveEditor,
|
||||||
),
|
),
|
||||||
"dance.selections.reduce": new CommandDescriptor(
|
"dance.selections.reduce": new CommandDescriptor(
|
||||||
@ -1188,43 +1188,43 @@ export const commands: Commands = function () {
|
|||||||
commands,
|
commands,
|
||||||
"dance.selections.pipe.replace",
|
"dance.selections.pipe.replace",
|
||||||
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
|
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
|
||||||
[[".selections.pipe", { $include: ["input","register"] }], [".edit.insert", { register: "|" , $exclude: ["input","register"] }]],
|
[[".selections.pipe", { $include: ["expression","register"] }], [".edit.insert", { register: "|" , $exclude: ["expression","register"] }]],
|
||||||
);
|
);
|
||||||
describeAdditionalCommand(
|
describeAdditionalCommand(
|
||||||
commands,
|
commands,
|
||||||
"dance.selections.pipe.append",
|
"dance.selections.pipe.append",
|
||||||
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
|
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
|
||||||
[[".selections.pipe", { $include: ["input","register"] }], [".edit.insert", { register: "|", where: "end" , $exclude: ["input","register"] }]],
|
[[".selections.pipe", { $include: ["expression","register"] }], [".edit.insert", { register: "|", where: "end" , $exclude: ["expression","register"] }]],
|
||||||
);
|
);
|
||||||
describeAdditionalCommand(
|
describeAdditionalCommand(
|
||||||
commands,
|
commands,
|
||||||
"dance.selections.pipe.prepend",
|
"dance.selections.pipe.prepend",
|
||||||
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
|
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
|
||||||
[[".selections.pipe", { $include: ["input","register"] }], [".edit.insert", { register: "|", where: "start", $exclude: ["input","register"] }]],
|
[[".selections.pipe", { $include: ["expression","register"] }], [".edit.insert", { register: "|", where: "start", $exclude: ["expression","register"] }]],
|
||||||
);
|
);
|
||||||
describeAdditionalCommand(
|
describeAdditionalCommand(
|
||||||
commands,
|
commands,
|
||||||
"dance.selections.filter.regexp",
|
"dance.selections.filter.regexp",
|
||||||
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
|
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
|
||||||
[[".selections.filter", { defaultInput: "/" , $exclude: [] }]],
|
[[".selections.filter", { defaultExpression: "/" , $exclude: [] }]],
|
||||||
);
|
);
|
||||||
describeAdditionalCommand(
|
describeAdditionalCommand(
|
||||||
commands,
|
commands,
|
||||||
"dance.selections.filter.regexp.inverse",
|
"dance.selections.filter.regexp.inverse",
|
||||||
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
|
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
|
||||||
[[".selections.filter", { defaultInput: "/", inverse: true, $exclude: [] }]],
|
[[".selections.filter", { defaultExpression: "/", inverse: true, $exclude: [] }]],
|
||||||
);
|
);
|
||||||
describeAdditionalCommand(
|
describeAdditionalCommand(
|
||||||
commands,
|
commands,
|
||||||
"dance.selections.clear.secondary",
|
"dance.selections.clear.secondary",
|
||||||
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
|
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
|
||||||
[[".selections.filter", { input: "i === count" , $exclude: [] }]],
|
[[".selections.filter", { expression: "i === count" , $exclude: [] }]],
|
||||||
);
|
);
|
||||||
describeAdditionalCommand(
|
describeAdditionalCommand(
|
||||||
commands,
|
commands,
|
||||||
"dance.selections.clear.main",
|
"dance.selections.clear.main",
|
||||||
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
|
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
|
||||||
[[".selections.filter", { input: "i !== count" , $exclude: [] }]],
|
[[".selections.filter", { expression: "i !== count" , $exclude: [] }]],
|
||||||
);
|
);
|
||||||
describeAdditionalCommand(
|
describeAdditionalCommand(
|
||||||
commands,
|
commands,
|
||||||
|
@ -40,8 +40,8 @@ const runHistory: string[] = [];
|
|||||||
* Run code.
|
* Run code.
|
||||||
*
|
*
|
||||||
* There are two ways to invoke this command. The first one is to provide an
|
* There are two ways to invoke this command. The first one is to provide an
|
||||||
* `input` string argument. This input must be a valid JavaScript string, and
|
* `code` string argument. This code must be a valid JavaScript string, and will
|
||||||
* will be executed with full access to the [Dance API](../api/README.md). For
|
* be executed with full access to the [Dance API](../api/README.md). For
|
||||||
* instance,
|
* instance,
|
||||||
*
|
*
|
||||||
* ```json
|
* ```json
|
||||||
@ -137,7 +137,7 @@ const runHistory: string[] = [];
|
|||||||
*/
|
*/
|
||||||
export async function run(
|
export async function run(
|
||||||
_: Context,
|
_: Context,
|
||||||
argument: Record<"code" | "input", string | readonly string[]>,
|
argument: { code?: string | readonly string[] },
|
||||||
codeOr: InputOr<"code", string | readonly string[]>,
|
codeOr: InputOr<"code", string | readonly string[]>,
|
||||||
|
|
||||||
count: number,
|
count: number,
|
||||||
@ -146,11 +146,9 @@ export async function run(
|
|||||||
|
|
||||||
commands?: Argument<command.Any[]>,
|
commands?: Argument<command.Any[]>,
|
||||||
) {
|
) {
|
||||||
argument["code"] ??= argument["input"];
|
|
||||||
|
|
||||||
if (Array.isArray(commands)) {
|
if (Array.isArray(commands)) {
|
||||||
if (typeof argument["code"] === "string" && runIsEnabled()) {
|
if (typeof argument["code"] === "string" && runIsEnabled()) {
|
||||||
// Prefer "input" to the "commands" array.
|
// Prefer "code" to the "commands" array.
|
||||||
} else {
|
} else {
|
||||||
return apiCommands(...commands);
|
return apiCommands(...commands);
|
||||||
}
|
}
|
||||||
@ -198,16 +196,16 @@ export async function selectRegister(
|
|||||||
_: Context,
|
_: Context,
|
||||||
registerOr: InputOr<"register", string | Register>,
|
registerOr: InputOr<"register", string | Register>,
|
||||||
) {
|
) {
|
||||||
const input = await registerOr(() => keypressForRegister(_));
|
const register = await registerOr(() => keypressForRegister(_));
|
||||||
|
|
||||||
if (typeof input === "string") {
|
if (typeof register === "string") {
|
||||||
if (input.length === 0) {
|
if (register.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_.extension.currentRegister = _.extension.registers.getPossiblyScoped(input, _.document);
|
_.extension.currentRegister = _.extension.registers.getPossiblyScoped(register, _.document);
|
||||||
} else {
|
} else {
|
||||||
_.extension.currentRegister = input;
|
_.extension.currentRegister = register;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,7 +308,7 @@ const menuHistory: string[] = [];
|
|||||||
/**
|
/**
|
||||||
* Open menu.
|
* Open menu.
|
||||||
*
|
*
|
||||||
* If no input is specified, a prompt will ask for the name of the menu to open.
|
* If no menu is specified, a prompt will ask for the name of the menu to open.
|
||||||
*
|
*
|
||||||
* Alternatively, a `menu` can be inlined in the arguments.
|
* Alternatively, a `menu` can be inlined in the arguments.
|
||||||
*
|
*
|
||||||
|
@ -32,17 +32,17 @@ export async function search(
|
|||||||
interactive: Argument<boolean> = true,
|
interactive: Argument<boolean> = true,
|
||||||
shift: Shift = Shift.Jump,
|
shift: Shift = Shift.Jump,
|
||||||
|
|
||||||
argument: { input?: string | RegExp },
|
argument: { re?: string | RegExp },
|
||||||
) {
|
) {
|
||||||
return manipulateSelectionsInteractively(_, "input", argument, interactive, {
|
return manipulateSelectionsInteractively(_, "re", argument, interactive, {
|
||||||
...promptRegexpOpts("mu"),
|
...promptRegexpOpts("mu"),
|
||||||
value: (await register.get())?.[0],
|
value: (await register.get())?.[0],
|
||||||
}, (input, selections) => {
|
}, (re, selections) => {
|
||||||
if (typeof input === "string") {
|
if (typeof re === "string") {
|
||||||
input = new RegExp(input, "mu");
|
re = new RegExp(re, "mu");
|
||||||
}
|
}
|
||||||
|
|
||||||
register.set([input.source]);
|
register.set([re.source]);
|
||||||
|
|
||||||
const newSelections = add ? selections.slice() : [],
|
const newSelections = add ? selections.slice() : [],
|
||||||
regexpMatches = [] as RegExpMatchArray[];
|
regexpMatches = [] as RegExpMatchArray[];
|
||||||
@ -52,7 +52,7 @@ export async function search(
|
|||||||
|
|
||||||
for (let j = 0; j < repetitions; j++) {
|
for (let j = 0; j < repetitions; j++) {
|
||||||
const searchResult = nextImpl(
|
const searchResult = nextImpl(
|
||||||
input as RegExp, direction, newSelection, undefined, undefined, document,
|
re as RegExp, direction, newSelection, undefined, undefined, document,
|
||||||
/* allowWrapping= */ shift !== Shift.Extend, regexpMatches, regexpMatches.length);
|
/* allowWrapping= */ shift !== Shift.Extend, regexpMatches, regexpMatches.length);
|
||||||
|
|
||||||
if (searchResult === undefined) {
|
if (searchResult === undefined) {
|
||||||
@ -74,7 +74,7 @@ export async function search(
|
|||||||
Selections.set(newSelections);
|
Selections.set(newSelections);
|
||||||
_.extension.registers.updateRegExpMatches(regexpMatches);
|
_.extension.registers.updateRegExpMatches(regexpMatches);
|
||||||
|
|
||||||
return register.set([input.source]).then(() => input as RegExp);
|
return register.set([re.source]).then(() => re as RegExp);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,18 +248,18 @@ const pipeHistory: string[] = [];
|
|||||||
*
|
*
|
||||||
* #### Additional commands
|
* #### Additional commands
|
||||||
*
|
*
|
||||||
* | Title | Identifier | Keybinding | Commands |
|
* | Title | Identifier | Keybinding | Commands |
|
||||||
* | ------------------- | -------------- | -------------- | ----------------------------------------------------------------------------------------------------- |
|
* | ------------------- | -------------- | -------------- | ---------------------------------------------------------------------------------------------------------- |
|
||||||
* | Pipe and replace | `pipe.replace` | `|` (normal) | `[".selections.pipe", { +input,register }], [".edit.insert", { register: "|" , ... }]` |
|
* | Pipe and replace | `pipe.replace` | `|` (normal) | `[".selections.pipe", { +expression,register }], [".edit.insert", { register: "|" , ... }]` |
|
||||||
* | Pipe and append | `pipe.append` | `!` (normal) | `[".selections.pipe", { +input,register }], [".edit.insert", { register: "|", where: "end" , ... }]` |
|
* | Pipe and append | `pipe.append` | `!` (normal) | `[".selections.pipe", { +expression,register }], [".edit.insert", { register: "|", where: "end" , ... }]` |
|
||||||
* | Pipe and prepend | `pipe.prepend` | `a-!` (normal) | `[".selections.pipe", { +input,register }], [".edit.insert", { register: "|", where: "start", ... }]` |
|
* | Pipe and prepend | `pipe.prepend` | `a-!` (normal) | `[".selections.pipe", { +expression,register }], [".edit.insert", { register: "|", where: "start", ... }]` |
|
||||||
*/
|
*/
|
||||||
export async function pipe(
|
export async function pipe(
|
||||||
_: Context,
|
_: Context,
|
||||||
register: RegisterOr<"pipe", Register.Flags.CanWrite>,
|
register: RegisterOr<"pipe", Register.Flags.CanWrite>,
|
||||||
inputOr: InputOr<"input", string>,
|
expressionOr: InputOr<"expression", string>,
|
||||||
) {
|
) {
|
||||||
const input = await inputOr(() => prompt({
|
const expression = await expressionOr(() => prompt({
|
||||||
prompt: "Expression",
|
prompt: "Expression",
|
||||||
validateInput(value) {
|
validateInput(value) {
|
||||||
try {
|
try {
|
||||||
@ -276,7 +276,7 @@ export async function pipe(
|
|||||||
selectionsStrings = selections.map((selection) => document.getText(selection));
|
selectionsStrings = selections.map((selection) => document.getText(selection));
|
||||||
|
|
||||||
const results = await Promise.all(_.run((_) => selectionsStrings.map((string, i, strings) =>
|
const results = await Promise.all(_.run((_) => selectionsStrings.map((string, i, strings) =>
|
||||||
switchRun(input!, { $: string, $$: strings, i, n: strings.length }),
|
switchRun(expression!, { $: string, $$: strings, i, n: strings.length }),
|
||||||
)));
|
)));
|
||||||
|
|
||||||
const strings = results.map(resultToString);
|
const strings = results.map(resultToString);
|
||||||
@ -293,18 +293,18 @@ const filterHistory: string[] = [];
|
|||||||
*
|
*
|
||||||
* #### Variants
|
* #### Variants
|
||||||
*
|
*
|
||||||
* | Title | Identifier | Keybinding | Commands |
|
* | Title | Identifier | Keybinding | Commands |
|
||||||
* | -------------------------- | ----------------------- | ------------------ | ------------------------------------------------------------------- |
|
* | -------------------------- | ----------------------- | ------------------ | ------------------------------------------------------------------------ |
|
||||||
* | Keep matching selections | `filter.regexp` | `a-k` (normal) | `[".selections.filter", { defaultInput: "/" , ... }]` |
|
* | Keep matching selections | `filter.regexp` | `a-k` (normal) | `[".selections.filter", { defaultExpression: "/" , ... }]` |
|
||||||
* | Clear matching selections | `filter.regexp.inverse` | `s-a-k` (normal) | `[".selections.filter", { defaultInput: "/", inverse: true, ... }]` |
|
* | Clear matching selections | `filter.regexp.inverse` | `s-a-k` (normal) | `[".selections.filter", { defaultExpression: "/", inverse: true, ... }]` |
|
||||||
* | Clear secondary selections | `clear.secondary` | `space` (normal) | `[".selections.filter", { input: "i === count" , ... }]` |
|
* | Clear secondary selections | `clear.secondary` | `space` (normal) | `[".selections.filter", { expression: "i === count" , ... }]` |
|
||||||
* | Clear main selections | `clear.main` | `a-space` (normal) | `[".selections.filter", { input: "i !== count" , ... }]` |
|
* | Clear main selections | `clear.main` | `a-space` (normal) | `[".selections.filter", { expression: "i !== count" , ... }]` |
|
||||||
*/
|
*/
|
||||||
export function filter(
|
export function filter(
|
||||||
_: Context,
|
_: Context,
|
||||||
|
|
||||||
argument: { input?: string },
|
argument: { expression?: string },
|
||||||
defaultInput?: Argument<string>,
|
defaultExpression?: Argument<string>,
|
||||||
inverse: Argument<boolean> = false,
|
inverse: Argument<boolean> = false,
|
||||||
interactive: Argument<boolean> = true,
|
interactive: Argument<boolean> = true,
|
||||||
count: number = 0,
|
count: number = 0,
|
||||||
@ -312,7 +312,7 @@ export function filter(
|
|||||||
const document = _.document,
|
const document = _.document,
|
||||||
strings = _.selections.map((selection) => document.getText(selection));
|
strings = _.selections.map((selection) => document.getText(selection));
|
||||||
|
|
||||||
return manipulateSelectionsInteractively(_, "input", argument, interactive, {
|
return manipulateSelectionsInteractively(_, "expression", argument, interactive, {
|
||||||
prompt: "Expression",
|
prompt: "Expression",
|
||||||
validateInput(value) {
|
validateInput(value) {
|
||||||
try {
|
try {
|
||||||
@ -321,19 +321,21 @@ export function filter(
|
|||||||
return (e as Error)?.message ?? `${e}`;
|
return (e as Error)?.message ?? `${e}`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
value: defaultInput,
|
value: defaultExpression,
|
||||||
valueSelection: defaultInput ? [defaultInput.length, defaultInput.length] : undefined,
|
valueSelection: defaultExpression
|
||||||
|
? [defaultExpression.length, defaultExpression.length]
|
||||||
|
: undefined,
|
||||||
history: filterHistory,
|
history: filterHistory,
|
||||||
}, (input, selections) => {
|
}, (expression, selections) => {
|
||||||
return Selections.filterByIndex(async (i) => {
|
return Selections.filterByIndex(async (i) => {
|
||||||
const context = { $: strings[i], $$: strings, i, n: strings.length, count };
|
const context = { $: strings[i], $$: strings, i, n: strings.length, count };
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return !!(await switchRun(input, context)) !== inverse;
|
return !!(await switchRun(expression, context)) !== inverse;
|
||||||
} catch {
|
} catch {
|
||||||
return inverse;
|
return inverse;
|
||||||
}
|
}
|
||||||
}, selections).then(Selections.set).then(() => input);
|
}, selections).then(Selections.set).then(() => expression);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,22 +348,22 @@ export function select(
|
|||||||
_: Context,
|
_: Context,
|
||||||
|
|
||||||
interactive: Argument<boolean> = true,
|
interactive: Argument<boolean> = true,
|
||||||
argument: { input?: string | RegExp },
|
argument: { re?: string | RegExp },
|
||||||
) {
|
) {
|
||||||
return manipulateSelectionsInteractively(
|
return manipulateSelectionsInteractively(
|
||||||
_,
|
_,
|
||||||
"input",
|
"re",
|
||||||
argument,
|
argument,
|
||||||
interactive,
|
interactive,
|
||||||
promptRegexpOpts("mu"),
|
promptRegexpOpts("mu"),
|
||||||
(input, selections) => {
|
(re, selections) => {
|
||||||
if (typeof input === "string") {
|
if (typeof re === "string") {
|
||||||
input = new RegExp(input, "mu");
|
re = new RegExp(re, "mu");
|
||||||
}
|
}
|
||||||
|
|
||||||
Selections.set(Selections.bottomToTop(Selections.selectWithin(input, selections)));
|
Selections.set(Selections.bottomToTop(Selections.selectWithin(re, selections)));
|
||||||
|
|
||||||
return Promise.resolve(input);
|
return Promise.resolve(re);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -376,20 +378,20 @@ export function split(
|
|||||||
|
|
||||||
excludeEmpty: Argument<boolean> = false,
|
excludeEmpty: Argument<boolean> = false,
|
||||||
interactive: Argument<boolean> = true,
|
interactive: Argument<boolean> = true,
|
||||||
argument: { input?: string | RegExp },
|
argument: { re?: string | RegExp },
|
||||||
) {
|
) {
|
||||||
return manipulateSelectionsInteractively(
|
return manipulateSelectionsInteractively(
|
||||||
_,
|
_,
|
||||||
"input",
|
"re",
|
||||||
argument,
|
argument,
|
||||||
interactive,
|
interactive,
|
||||||
promptRegexpOpts("mu"),
|
promptRegexpOpts("mu"),
|
||||||
(input, selections) => {
|
(re, selections) => {
|
||||||
if (typeof input === "string") {
|
if (typeof re === "string") {
|
||||||
input = new RegExp(input, "mu");
|
re = new RegExp(re, "mu");
|
||||||
}
|
}
|
||||||
|
|
||||||
let split = Selections.split(input, selections);
|
let split = Selections.split(re, selections);
|
||||||
|
|
||||||
if (excludeEmpty) {
|
if (excludeEmpty) {
|
||||||
split = split.filter((s) => !s.isEmpty);
|
split = split.filter((s) => !s.isEmpty);
|
||||||
@ -397,7 +399,7 @@ export function split(
|
|||||||
|
|
||||||
Selections.set(Selections.bottomToTop(split));
|
Selections.set(Selections.bottomToTop(split));
|
||||||
|
|
||||||
return Promise.resolve(input);
|
return Promise.resolve(re);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -62,12 +62,12 @@ export class StatusBar implements vscode.Disposable {
|
|||||||
this.countSegment = this.addSegment(
|
this.countSegment = this.addSegment(
|
||||||
"Dance - Reset count",
|
"Dance - Reset count",
|
||||||
"symbol-number",
|
"symbol-number",
|
||||||
{ command: "dance.updateCount", arguments: [{ input: "0" }], title: "" },
|
{ command: "dance.updateCount", arguments: [{ count: "0" }], title: "" },
|
||||||
);
|
);
|
||||||
this.registerSegment = this.addSegment(
|
this.registerSegment = this.addSegment(
|
||||||
"Dance - Unset register",
|
"Dance - Unset register",
|
||||||
"clone",
|
"clone",
|
||||||
{ command: "dance.selectRegister", arguments: [{ input: "" }], title: "" },
|
{ command: "dance.selectRegister", arguments: [{ register: "" }], title: "" },
|
||||||
);
|
);
|
||||||
this.errorSegment = this.addSegment(
|
this.errorSegment = this.addSegment(
|
||||||
"Dance - Copy and dismiss error",
|
"Dance - Copy and dismiss error",
|
||||||
|
@ -120,7 +120,7 @@ foo bar
|
|||||||
## 1 search-b
|
## 1 search-b
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "b" }
|
- .search { re: "b" }
|
||||||
|
|
||||||
```
|
```
|
||||||
foo bar
|
foo bar
|
||||||
|
@ -8,7 +8,7 @@ a b c d
|
|||||||
## 1 pipe-replace-with-regexp
|
## 1 pipe-replace-with-regexp
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .selections.pipe.replace { input: String.raw`/\s/-/g` }
|
- .selections.pipe.replace { expression: String.raw`/\s/-/g` }
|
||||||
|
|
||||||
```
|
```
|
||||||
a-b-c d
|
a-b-c d
|
||||||
@ -18,7 +18,7 @@ a-b-c d
|
|||||||
## 1 pipe-replace-with-regexp-newline
|
## 1 pipe-replace-with-regexp-newline
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .selections.pipe.replace { input: String.raw`/\s/\n/g` }
|
- .selections.pipe.replace { expression: String.raw`/\s/\n/g` }
|
||||||
|
|
||||||
```
|
```
|
||||||
a
|
a
|
||||||
@ -32,7 +32,7 @@ c d
|
|||||||
## 1 pipe-replace-with-regexp-backslash-n
|
## 1 pipe-replace-with-regexp-backslash-n
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .selections.pipe.replace { input: String.raw`/\s/\\n/g` }
|
- .selections.pipe.replace { expression: String.raw`/\s/\\n/g` }
|
||||||
|
|
||||||
```
|
```
|
||||||
a\nb\nc d
|
a\nb\nc d
|
||||||
@ -42,7 +42,7 @@ a\nb\nc d
|
|||||||
## 1 pipe-replace-with-regexp-backslash-newline
|
## 1 pipe-replace-with-regexp-backslash-newline
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .selections.pipe.replace { input: String.raw`/\s/\\\n/g` }
|
- .selections.pipe.replace { expression: String.raw`/\s/\\\n/g` }
|
||||||
|
|
||||||
```
|
```
|
||||||
a\
|
a\
|
||||||
@ -56,7 +56,7 @@ c d
|
|||||||
## 1 pipe-replace-with-js
|
## 1 pipe-replace-with-js
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .selections.pipe.replace { input: String.raw`$.replace(/\s/g, "-")` }
|
- .selections.pipe.replace { expression: String.raw`$.replace(/\s/g, "-")` }
|
||||||
|
|
||||||
```
|
```
|
||||||
a-b-c d
|
a-b-c d
|
||||||
@ -66,7 +66,7 @@ a-b-c d
|
|||||||
## 1 pipe-replace-with-js-newline
|
## 1 pipe-replace-with-js-newline
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .selections.pipe.replace { input: String.raw`$.replace(/\s/g, "\n")` }
|
- .selections.pipe.replace { expression: String.raw`$.replace(/\s/g, "\n")` }
|
||||||
|
|
||||||
```
|
```
|
||||||
a
|
a
|
||||||
|
12
test/suite/commands/pipe.test.ts
generated
12
test/suite/commands/pipe.test.ts
generated
@ -28,7 +28,7 @@ suite("./test/suite/commands/pipe.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.selections.pipe.replace", { input: String.raw`/\s/-/g` });
|
await executeCommand("dance.selections.pipe.replace", { expression: String.raw`/\s/-/g` });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/pipe.md:8:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/pipe.md:8:1", 6, String.raw`
|
||||||
@ -45,7 +45,7 @@ suite("./test/suite/commands/pipe.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.selections.pipe.replace", { input: String.raw`/\s/\n/g` });
|
await executeCommand("dance.selections.pipe.replace", { expression: String.raw`/\s/\n/g` });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/pipe.md:18:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/pipe.md:18:1", 6, String.raw`
|
||||||
@ -66,7 +66,7 @@ suite("./test/suite/commands/pipe.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.selections.pipe.replace", { input: String.raw`/\s/\\n/g` });
|
await executeCommand("dance.selections.pipe.replace", { expression: String.raw`/\s/\\n/g` });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/pipe.md:32:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/pipe.md:32:1", 6, String.raw`
|
||||||
@ -83,7 +83,7 @@ suite("./test/suite/commands/pipe.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.selections.pipe.replace", { input: String.raw`/\s/\\\n/g` });
|
await executeCommand("dance.selections.pipe.replace", { expression: String.raw`/\s/\\\n/g` });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/pipe.md:42:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/pipe.md:42:1", 6, String.raw`
|
||||||
@ -104,7 +104,7 @@ suite("./test/suite/commands/pipe.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.selections.pipe.replace", { input: String.raw`$.replace(/\s/g, "-")` });
|
await executeCommand("dance.selections.pipe.replace", { expression: String.raw`$.replace(/\s/g, "-")` });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/pipe.md:56:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/pipe.md:56:1", 6, String.raw`
|
||||||
@ -121,7 +121,7 @@ suite("./test/suite/commands/pipe.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.selections.pipe.replace", { input: String.raw`$.replace(/\s/g, "\n")` });
|
await executeCommand("dance.selections.pipe.replace", { expression: String.raw`$.replace(/\s/g, "\n")` });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/pipe.md:66:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/pipe.md:66:1", 6, String.raw`
|
||||||
|
@ -10,7 +10,7 @@ kiwi orange kiwi
|
|||||||
## 1 search-apple
|
## 1 search-apple
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "apple" }
|
- .search { re: "apple" }
|
||||||
|
|
||||||
```
|
```
|
||||||
apple pineapple pear
|
apple pineapple pear
|
||||||
|
2
test/suite/commands/search-next.test.ts
generated
2
test/suite/commands/search-next.test.ts
generated
@ -30,7 +30,7 @@ suite("./test/suite/commands/search-next.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "apple" });
|
await executeCommand("dance.search", { re: "apple" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search-next.md:10:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search-next.md:10:1", 6, String.raw`
|
||||||
|
@ -8,7 +8,7 @@ foo bar
|
|||||||
## easy search-b
|
## easy search-b
|
||||||
[up](#easy)
|
[up](#easy)
|
||||||
|
|
||||||
- .search { input: "b" }
|
- .search { re: "b" }
|
||||||
|
|
||||||
```
|
```
|
||||||
foo bar
|
foo bar
|
||||||
@ -27,7 +27,7 @@ lazy dog quickly.
|
|||||||
## 1 search
|
## 1 search
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "brown" }
|
- .search { re: "brown" }
|
||||||
|
|
||||||
```
|
```
|
||||||
The quick brown fox
|
The quick brown fox
|
||||||
@ -39,7 +39,7 @@ lazy dog quickly.
|
|||||||
## 1 search-repeat
|
## 1 search-repeat
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "o", count: 2 }
|
- .search { re: "o", count: 2 }
|
||||||
|
|
||||||
```
|
```
|
||||||
The quick brown fox
|
The quick brown fox
|
||||||
@ -51,7 +51,7 @@ lazy dog quickly.
|
|||||||
## 1 search-start
|
## 1 search-start
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "quick" }
|
- .search { re: "quick" }
|
||||||
|
|
||||||
Search starts **after** the selection so the first "quick" is not matched.
|
Search starts **after** the selection so the first "quick" is not matched.
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ lazy dog quickly.
|
|||||||
## 1 search-start-wrap
|
## 1 search-start-wrap
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "quick " }
|
- .search { re: "quick " }
|
||||||
|
|
||||||
Search starts **after** the selection, but wraps over to find "quick ".
|
Search starts **after** the selection, but wraps over to find "quick ".
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ lazy dog quickly.
|
|||||||
## 1 search-wrap
|
## 1 search-wrap
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "Th" }
|
- .search { re: "Th" }
|
||||||
|
|
||||||
```
|
```
|
||||||
The quick brown fox
|
The quick brown fox
|
||||||
@ -91,7 +91,7 @@ lazy dog quickly.
|
|||||||
## 1 search-not-found
|
## 1 search-not-found
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "pig", $expect: /^no selections remain$/ }
|
- .search { re: "pig", $expect: /^no selections remain$/ }
|
||||||
|
|
||||||
No matches found. Selection is left untouched because otherwise there would be
|
No matches found. Selection is left untouched because otherwise there would be
|
||||||
no selection left.
|
no selection left.
|
||||||
@ -106,7 +106,7 @@ lazy dog quickly.
|
|||||||
## 1 search-backward
|
## 1 search-backward
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "Th", direction: -1 }
|
- .search { re: "Th", direction: -1 }
|
||||||
|
|
||||||
Note: Selection always faces forward (except when extending).
|
Note: Selection always faces forward (except when extending).
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ lazy dog quickly.
|
|||||||
## 1 search-backward-wrap
|
## 1 search-backward-wrap
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "he", direction: -1 }
|
- .search { re: "he", direction: -1 }
|
||||||
|
|
||||||
Search starts **before** the selection and wraps around to find the last "he".
|
Search starts **before** the selection and wraps around to find the last "he".
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ lazy dog quickly.
|
|||||||
## 1 search-backward-wrap-other
|
## 1 search-backward-wrap-other
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "he q", direction: -1 }
|
- .search { re: "he q", direction: -1 }
|
||||||
|
|
||||||
Search starts **before** the selection "q" but wraps around to find "he q".
|
Search starts **before** the selection "q" but wraps around to find "he q".
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ lazy dog quickly.
|
|||||||
## 1 search-backward-not-found
|
## 1 search-backward-not-found
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "pig", direction: -1, $expect: /^no selections remain$/ }
|
- .search { re: "pig", direction: -1, $expect: /^no selections remain$/ }
|
||||||
|
|
||||||
No matches found. Selection is left untouched because otherwise there would be
|
No matches found. Selection is left untouched because otherwise there would be
|
||||||
no selection left.
|
no selection left.
|
||||||
@ -163,7 +163,7 @@ lazy dog quickly.
|
|||||||
## 1 search-extend
|
## 1 search-extend
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "quick", shift: "extend" }
|
- .search { re: "quick", shift: "extend" }
|
||||||
|
|
||||||
```
|
```
|
||||||
The quick brown fox
|
The quick brown fox
|
||||||
@ -176,7 +176,7 @@ lazy dog quickly.
|
|||||||
## 1 search-extend-wrap
|
## 1 search-extend-wrap
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "T", shift: "extend", $expect: /^no selections remain$/ }
|
- .search { re: "T", shift: "extend", $expect: /^no selections remain$/ }
|
||||||
|
|
||||||
When extending, a selection is deleted if it would require wrapping to find the
|
When extending, a selection is deleted if it would require wrapping to find the
|
||||||
next match. In this case, the (only) main selection is left untouched because
|
next match. In this case, the (only) main selection is left untouched because
|
||||||
@ -192,7 +192,7 @@ lazy dog quickly.
|
|||||||
## 1 search-backward-extend
|
## 1 search-backward-extend
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "T", direction: -1, shift: "extend" }
|
- .search { re: "T", direction: -1, shift: "extend" }
|
||||||
|
|
||||||
When extending, the resulting selection may face backward.
|
When extending, the resulting selection may face backward.
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ lazy dog quickly.
|
|||||||
|
|
||||||
> behavior <- character
|
> behavior <- character
|
||||||
|
|
||||||
- .search { input: "T", direction: -1, shift: "extend" }
|
- .search { re: "T", direction: -1, shift: "extend" }
|
||||||
|
|
||||||
Note: "e" is included in character-selections because it is the anchor.
|
Note: "e" is included in character-selections because it is the anchor.
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ lazy dog quickly.
|
|||||||
## 1 search-backward-extend-other
|
## 1 search-backward-extend-other
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "Th", direction: -1, shift: "extend" }
|
- .search { re: "Th", direction: -1, shift: "extend" }
|
||||||
|
|
||||||
When extending, the resulting selection may face backward.
|
When extending, the resulting selection may face backward.
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ lazy dog quickly.
|
|||||||
|
|
||||||
> behavior <- character
|
> behavior <- character
|
||||||
|
|
||||||
- .search { input: "Th", direction: -1, shift: "extend" }
|
- .search { re: "Th", direction: -1, shift: "extend" }
|
||||||
|
|
||||||
Note: "e" is included in character-selections because it is the anchor.
|
Note: "e" is included in character-selections because it is the anchor.
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ lazy dog quickly.
|
|||||||
## 1 search-backward-extend-wrap
|
## 1 search-backward-extend-wrap
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .search { input: "lazy", direction: -1, shift: "extend", $expect: /^no selections remain$/ }
|
- .search { re: "lazy", direction: -1, shift: "extend", $expect: /^no selections remain$/ }
|
||||||
|
|
||||||
When extending, a selection is deleted if it would require wrapping to find the
|
When extending, a selection is deleted if it would require wrapping to find the
|
||||||
next match. In this case, the (only) main selection is left untouched because
|
next match. In this case, the (only) main selection is left untouched because
|
||||||
@ -281,7 +281,7 @@ lazy dog quickly.
|
|||||||
## 2 search
|
## 2 search
|
||||||
[up](#2)
|
[up](#2)
|
||||||
|
|
||||||
- .search { input: "o" }
|
- .search { re: "o" }
|
||||||
|
|
||||||
Forward search starts at "y" and finds "d**o**g" instead of "br**o**wn".
|
Forward search starts at "y" and finds "d**o**g" instead of "br**o**wn".
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ lazy dog quickly.
|
|||||||
## 2 search-extend
|
## 2 search-extend
|
||||||
[up](#2)
|
[up](#2)
|
||||||
|
|
||||||
- .search { input: "o", shift: "extend" }
|
- .search { re: "o", shift: "extend" }
|
||||||
|
|
||||||
Same, but extends instead of jumping.
|
Same, but extends instead of jumping.
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ lazy dog quickly.
|
|||||||
|
|
||||||
> behavior <- character
|
> behavior <- character
|
||||||
|
|
||||||
- .search { input: "o", shift: "extend" }
|
- .search { re: "o", shift: "extend" }
|
||||||
|
|
||||||
Same, but extends instead of jumping.
|
Same, but extends instead of jumping.
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ lazy dog quickly.
|
|||||||
## 2 search-wrap
|
## 2 search-wrap
|
||||||
[up](#2)
|
[up](#2)
|
||||||
|
|
||||||
- .search { input: "he" }
|
- .search { re: "he" }
|
||||||
|
|
||||||
Forward search starts at "y" and wraps to "T**he**" instead of "t**he**".
|
Forward search starts at "y" and wraps to "T**he**" instead of "t**he**".
|
||||||
|
|
||||||
@ -339,7 +339,7 @@ lazy dog quickly.
|
|||||||
## 2 search-extend-wrap
|
## 2 search-extend-wrap
|
||||||
[up](#2)
|
[up](#2)
|
||||||
|
|
||||||
- .search { input: "he", shift: "extend", $expect: /^no selections remain$/ }
|
- .search { re: "he", shift: "extend", $expect: /^no selections remain$/ }
|
||||||
|
|
||||||
When extending, Dance should not wrap around document edges to find "T**he**".
|
When extending, Dance should not wrap around document edges to find "T**he**".
|
||||||
"t**he**" is not considered at all. No-op due to no selections remaining.
|
"t**he**" is not considered at all. No-op due to no selections remaining.
|
||||||
@ -355,7 +355,7 @@ lazy dog quickly.
|
|||||||
## 2 search-backward
|
## 2 search-backward
|
||||||
[up](#2)
|
[up](#2)
|
||||||
|
|
||||||
- .search { input: "u", direction: -1 }
|
- .search { re: "u", direction: -1 }
|
||||||
|
|
||||||
Backward search starts at "b" and finds "q**u**ick" instead of "j**u**mps".
|
Backward search starts at "b" and finds "q**u**ick" instead of "j**u**mps".
|
||||||
|
|
||||||
@ -369,7 +369,7 @@ lazy dog quickly.
|
|||||||
## 2 search-backward-extend
|
## 2 search-backward-extend
|
||||||
[up](#2)
|
[up](#2)
|
||||||
|
|
||||||
- .search { input: "u", direction: -1, shift: "extend" }
|
- .search { re: "u", direction: -1, shift: "extend" }
|
||||||
|
|
||||||
Same, but extends instead of jumping.
|
Same, but extends instead of jumping.
|
||||||
|
|
||||||
@ -384,7 +384,7 @@ lazy dog quickly.
|
|||||||
## 2 search-backward-wrap
|
## 2 search-backward-wrap
|
||||||
[up](#2)
|
[up](#2)
|
||||||
|
|
||||||
- .search { input: "o", direction: -1 }
|
- .search { re: "o", direction: -1 }
|
||||||
|
|
||||||
Backward search starts at "b" and wraps to "d**o**g" instead of "br**o**wn".
|
Backward search starts at "b" and wraps to "d**o**g" instead of "br**o**wn".
|
||||||
|
|
||||||
@ -398,7 +398,7 @@ lazy dog quickly.
|
|||||||
## 2 search-backward-extend-wrap
|
## 2 search-backward-extend-wrap
|
||||||
[up](#2)
|
[up](#2)
|
||||||
|
|
||||||
- .search { input: "o", direction: -1, shift: "extend", $expect: /^no selections remain$/ }
|
- .search { re: "o", direction: -1, shift: "extend", $expect: /^no selections remain$/ }
|
||||||
|
|
||||||
When extending, Dance should not wrap around document edges to find "d**o**g".
|
When extending, Dance should not wrap around document edges to find "d**o**g".
|
||||||
"br**o**wn" is not considered at all. No-op due to no selections remaining.
|
"br**o**wn" is not considered at all. No-op due to no selections remaining.
|
||||||
|
54
test/suite/commands/search.test.ts
generated
54
test/suite/commands/search.test.ts
generated
@ -28,7 +28,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "b" });
|
await executeCommand("dance.search", { re: "b" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:8:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:8:1", 6, String.raw`
|
||||||
@ -47,7 +47,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "brown" });
|
await executeCommand("dance.search", { re: "brown" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:27:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:27:1", 6, String.raw`
|
||||||
@ -68,7 +68,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "o", count: 2 });
|
await executeCommand("dance.search", { re: "o", count: 2 });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:39:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:39:1", 6, String.raw`
|
||||||
@ -89,7 +89,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "quick" });
|
await executeCommand("dance.search", { re: "quick" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:51:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:51:1", 6, String.raw`
|
||||||
@ -110,7 +110,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "quick " });
|
await executeCommand("dance.search", { re: "quick " });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:65:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:65:1", 6, String.raw`
|
||||||
@ -131,7 +131,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "Th" });
|
await executeCommand("dance.search", { re: "Th" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:79:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:79:1", 6, String.raw`
|
||||||
@ -152,7 +152,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "pig", $expect: /^no selections remain$/ });
|
await executeCommand("dance.search", { re: "pig", $expect: /^no selections remain$/ });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:91:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:91:1", 6, String.raw`
|
||||||
@ -173,7 +173,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "Th", direction: -1 });
|
await executeCommand("dance.search", { re: "Th", direction: -1 });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:106:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:106:1", 6, String.raw`
|
||||||
@ -194,7 +194,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "he", direction: -1 });
|
await executeCommand("dance.search", { re: "he", direction: -1 });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:120:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:120:1", 6, String.raw`
|
||||||
@ -215,7 +215,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "he q", direction: -1 });
|
await executeCommand("dance.search", { re: "he q", direction: -1 });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:134:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:134:1", 6, String.raw`
|
||||||
@ -236,7 +236,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "pig", direction: -1, $expect: /^no selections remain$/ });
|
await executeCommand("dance.search", { re: "pig", direction: -1, $expect: /^no selections remain$/ });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:148:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:148:1", 6, String.raw`
|
||||||
@ -257,7 +257,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "quick", shift: "extend" });
|
await executeCommand("dance.search", { re: "quick", shift: "extend" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:163:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:163:1", 6, String.raw`
|
||||||
@ -279,7 +279,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "T", shift: "extend", $expect: /^no selections remain$/ });
|
await executeCommand("dance.search", { re: "T", shift: "extend", $expect: /^no selections remain$/ });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:176:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:176:1", 6, String.raw`
|
||||||
@ -300,7 +300,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "T", direction: -1, shift: "extend" });
|
await executeCommand("dance.search", { re: "T", direction: -1, shift: "extend" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:192:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:192:1", 6, String.raw`
|
||||||
@ -322,7 +322,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "character" });
|
await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "character" });
|
||||||
await executeCommand("dance.search", { input: "T", direction: -1, shift: "extend" });
|
await executeCommand("dance.search", { re: "T", direction: -1, shift: "extend" });
|
||||||
await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "caret" });
|
await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "caret" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
@ -344,7 +344,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "Th", direction: -1, shift: "extend" });
|
await executeCommand("dance.search", { re: "Th", direction: -1, shift: "extend" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:222:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:222:1", 6, String.raw`
|
||||||
@ -366,7 +366,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "character" });
|
await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "character" });
|
||||||
await executeCommand("dance.search", { input: "Th", direction: -1, shift: "extend" });
|
await executeCommand("dance.search", { re: "Th", direction: -1, shift: "extend" });
|
||||||
await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "caret" });
|
await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "caret" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
@ -388,7 +388,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "lazy", direction: -1, shift: "extend", $expect: /^no selections remain$/ });
|
await executeCommand("dance.search", { re: "lazy", direction: -1, shift: "extend", $expect: /^no selections remain$/ });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:252:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:252:1", 6, String.raw`
|
||||||
@ -410,7 +410,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "o" });
|
await executeCommand("dance.search", { re: "o" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:281:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:281:1", 6, String.raw`
|
||||||
@ -432,7 +432,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "o", shift: "extend" });
|
await executeCommand("dance.search", { re: "o", shift: "extend" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:295:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:295:1", 6, String.raw`
|
||||||
@ -455,7 +455,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "character" });
|
await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "character" });
|
||||||
await executeCommand("dance.search", { input: "o", shift: "extend" });
|
await executeCommand("dance.search", { re: "o", shift: "extend" });
|
||||||
await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "caret" });
|
await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "caret" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
@ -478,7 +478,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "he" });
|
await executeCommand("dance.search", { re: "he" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:325:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:325:1", 6, String.raw`
|
||||||
@ -500,7 +500,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "he", shift: "extend", $expect: /^no selections remain$/ });
|
await executeCommand("dance.search", { re: "he", shift: "extend", $expect: /^no selections remain$/ });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:339:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:339:1", 6, String.raw`
|
||||||
@ -523,7 +523,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "u", direction: -1 });
|
await executeCommand("dance.search", { re: "u", direction: -1 });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:355:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:355:1", 6, String.raw`
|
||||||
@ -545,7 +545,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "u", direction: -1, shift: "extend" });
|
await executeCommand("dance.search", { re: "u", direction: -1, shift: "extend" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:369:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:369:1", 6, String.raw`
|
||||||
@ -568,7 +568,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "o", direction: -1 });
|
await executeCommand("dance.search", { re: "o", direction: -1 });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:384:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:384:1", 6, String.raw`
|
||||||
@ -590,7 +590,7 @@ suite("./test/suite/commands/search.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.search", { input: "o", direction: -1, shift: "extend", $expect: /^no selections remain$/ });
|
await executeCommand("dance.search", { re: "o", direction: -1, shift: "extend", $expect: /^no selections remain$/ });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:398:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/search.md:398:1", 6, String.raw`
|
||||||
|
@ -10,7 +10,7 @@ baz
|
|||||||
## 1 select
|
## 1 select
|
||||||
[up](#1)
|
[up](#1)
|
||||||
|
|
||||||
- .selections.select { input: "b" }
|
- .selections.select { re: "b" }
|
||||||
|
|
||||||
```
|
```
|
||||||
foo bar
|
foo bar
|
||||||
|
2
test/suite/commands/selections-select.test.ts
generated
2
test/suite/commands/selections-select.test.ts
generated
@ -30,7 +30,7 @@ suite("./test/suite/commands/selections-select.md", function () {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
// Perform all operations.
|
// Perform all operations.
|
||||||
await executeCommand("dance.selections.select", { input: "b" });
|
await executeCommand("dance.selections.select", { re: "b" });
|
||||||
|
|
||||||
// Ensure document is as expected.
|
// Ensure document is as expected.
|
||||||
ExpectedDocument.assertEquals(editor, "./test/suite/commands/selections-select.md:10:1", 6, String.raw`
|
ExpectedDocument.assertEquals(editor, "./test/suite/commands/selections-select.md:10:1", 6, String.raw`
|
||||||
|
Loading…
Reference in New Issue
Block a user