Skip to content

Commit 532e523

Browse files
authored
Add VSCode task how-to doc (#2239)
## Checklist - [-] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [x] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [-] I have not broken the cheatsheet
1 parent 76be55e commit 532e523

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

docs/user/how-to.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,36 @@ To replace a target with the contents of the clipboard, say `"paste to <target>"
1313
`"to <target>"` is an example of a Destination. See [Destinations](reference/destinations.md) for more information.
1414

1515
:::
16+
17+
## How do I run a VSCode task / bash shell command on a target?
18+
19+
1. Add a [VSCode task](https://code.visualstudio.com/docs/editor/variables-reference) to your `tasks.json` (say `"please open tasks"`):
20+
21+
```json
22+
{
23+
"label": "Echo",
24+
"type": "shell",
25+
"command": "echo",
26+
"args": ["${selectedText}"]
27+
}
28+
```
29+
30+
(replace `echo` / `Echo` with your actual command name)
31+
32+
2. Add a spoken form to your `vscode.talon`:
33+
34+
```talon
35+
echo <user.cursorless_target>:
36+
user.cursorless_command("setSelection", cursorless_target)
37+
user.run_rpc_command("workbench.action.tasks.runTask", "Echo")
38+
```
39+
40+
(replace `echo` / `Echo` with your actual command name)
41+
42+
You can now say eg `"echo air past bat"`.
43+
44+
:::info
45+
46+
See the [Talon-side api docs](./customization.md#cursorless-public-api) for more on creating custom Cursorless commands
47+
48+
:::

0 commit comments

Comments
 (0)