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 reformat action to public api #2358

Merged
merged 5 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
7 changes: 7 additions & 0 deletions changelog/2024-05-reformatPublicAPI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
tags: [enhancement]
pullRequest: 2358
---

- Added public `user.cursorless_reformat` action to the Cursorless api
eg: `user.cursorless_reformat(cursorless_target, "ALL_CAPS")`
2 changes: 1 addition & 1 deletion cursorless-talon/src/actions/reformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@mod.action_class
class Actions:
def private_cursorless_reformat(
def cursorless_reformat(
target: CursorlessExplicitTarget, # pyright: ignore [reportGeneralTypeIssues]
formatters: str,
):
Expand Down
2 changes: 1 addition & 1 deletion cursorless-talon/src/cursorless.talon
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tag: user.cursorless
user.private_cursorless_paste(cursorless_destination)

{user.cursorless_reformat_action} <user.formatters> at <user.cursorless_target>:
user.private_cursorless_reformat(cursorless_target, formatters)
user.cursorless_reformat(cursorless_target, formatters)

{user.cursorless_call_action} <user.cursorless_target> on <user.cursorless_target>:
user.private_cursorless_call(cursorless_target_1, cursorless_target_2)
Expand Down
3 changes: 3 additions & 0 deletions docs/user/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ Cursorless exposes a couple talon actions and captures that you can use to defin
- `user.cursorless_insert(destination: CursorlessDestination, text: Union[str, List[str]])`:
Insert text at destination.
eg: `user.cursorless_insert(cursorless_destination, "hello")`
- `user.cursorless_reformat(target: CursorlessTarget, formatters: str)`
Reformat target with specified formatters.
eg: `user.cursorless_reformat(cursorless_target, "ALL_CAPS")`

#### Snippet actions

Expand Down
Loading