Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for user define custom actions #125

Merged
merged 25 commits into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5516872
Added user defined custom actions
AndreasArvidsson Dec 9, 2021
13570df
Ran black
AndreasArvidsson Dec 9, 2021
59d275b
Refactored four preparations of a public api
AndreasArvidsson Dec 10, 2021
246f646
Added support for custom headers in csv files
AndreasArvidsson Dec 10, 2021
ce55bdc
Makeshift actions use new execute command
AndreasArvidsson Dec 10, 2021
4d506d1
Merge branch 'develop' into custom_actions
AndreasArvidsson Dec 10, 2021
fc9afc8
Update src/actions/actions.py
AndreasArvidsson Dec 14, 2021
d215896
Update src/actions/actions.py
AndreasArvidsson Dec 14, 2021
1f0a7d9
Merge branch 'develop' into custom_actions
AndreasArvidsson Dec 14, 2021
91837f6
Update src/actions/actions.py
AndreasArvidsson Dec 14, 2021
405ead4
Cleanup
AndreasArvidsson Dec 14, 2021
2adb242
Added vscode command arguments
AndreasArvidsson Dec 14, 2021
36cf7c4
Added documentation
AndreasArvidsson Dec 14, 2021
6ef86cc
Update docs/custom-actions.md
AndreasArvidsson Dec 14, 2021
aeba79f
Update docs/custom-actions.md
AndreasArvidsson Dec 14, 2021
299ab13
Update docs/custom-actions.md
AndreasArvidsson Dec 14, 2021
74a004f
Update docs/custom-actions.md
AndreasArvidsson Dec 14, 2021
646932d
Update docs/public-api.md
AndreasArvidsson Dec 14, 2021
96212f8
Update docs/public-api.md
AndreasArvidsson Dec 14, 2021
54e7788
Update docs/public-api.md
AndreasArvidsson Dec 14, 2021
6be003c
Update docs/public-api.md
AndreasArvidsson Dec 14, 2021
bcf7bbf
Moved custom actions into customisation markdown
AndreasArvidsson Dec 14, 2021
fafd629
Update docs/customization.md
AndreasArvidsson Dec 14, 2021
094e14d
Update docs/customization.md
AndreasArvidsson Dec 14, 2021
c9356ee
Moved public api into customization markdown
AndreasArvidsson Dec 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/custom-actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Cursorless custom VSCode actions
AndreasArvidsson marked this conversation as resolved.
Show resolved Hide resolved

You can use Cursorless to run any built in VSCode command on a specific target.
AndreasArvidsson marked this conversation as resolved.
Show resolved Hide resolved

Just add your custom commands to: `actions_custom.csv`
AndreasArvidsson marked this conversation as resolved.
Show resolved Hide resolved

```csv
Spoken form, VSCode command
custom, editor.action.addCommentLine
AndreasArvidsson marked this conversation as resolved.
Show resolved Hide resolved
```

You can now use the command: `custom blue air` to comment the line containing the token with the `blue a` hat.
AndreasArvidsson marked this conversation as resolved.
Show resolved Hide resolved
22 changes: 22 additions & 0 deletions docs/public-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Cursorless public API
AndreasArvidsson marked this conversation as resolved.
Show resolved Hide resolved

AndreasArvidsson marked this conversation as resolved.
Show resolved Hide resolved
## Public Talon captures
* `<user.cursorless_target>`
Represents a cursorless target. This target can be a single mark, multiple marks or a range.
AndreasArvidsson marked this conversation as resolved.
Show resolved Hide resolved

## Public Talon actions
* `user.cursorless_command(action_id: str, target: cursorless_target)`
Perform a Cursorless command on the given target
eg: `user.cursorless_command("setSelection", cursorless_target)`
* `user.cursorless_vscode_command(command_id: str, target: cursorless_target)`
Performs a VSCode command on the given target
eg: `user.cursorless_vscode_command("editor.action.addCommentLine", cursorless_target)`

## Example of combining capture and action
```talon
select <user.cursorless_target>:
user.cursorless_command("setSelection", cursorless_target)
AndreasArvidsson marked this conversation as resolved.
Show resolved Hide resolved

comment <user.cursorless_target>:
user.cursorless_vscode_command("editor.action.addCommentLine", cursorless_target)
AndreasArvidsson marked this conversation as resolved.
Show resolved Hide resolved
```