-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is the Cursorless side of the community wrapper snippets talonhub/community#1315 ## Checklist - [-] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [-] 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 --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Co-authored-by: Pokey Rule <[email protected]>
- Loading branch information
1 parent
6c4a18c
commit 409b3de
Showing
10 changed files
with
175 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
tags: [enhancement] | ||
pullRequest: 1998 | ||
--- | ||
|
||
- Add support for using community snippets for wrapping / cursorless insertion instead of snippets defined in Cursorless. See [Using community snippets](../docs/user/experimental/snippets.md#using-community-snippets) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
mode: command | ||
mode: user.cursorless_spoken_form_test | ||
tag: user.cursorless | ||
and not tag: user.cursorless_use_community_snippets | ||
- | ||
|
||
{user.cursorless_insert_snippet_action} <user.cursorless_insertion_snippet>: | ||
user.private_cursorless_insert_snippet(cursorless_insertion_snippet) | ||
|
||
{user.cursorless_insert_snippet_action} {user.cursorless_insertion_snippet_single_phrase} <user.text> [{user.cursorless_phrase_terminator}]: | ||
user.private_cursorless_insert_snippet_with_phrase(cursorless_insertion_snippet_single_phrase, text) | ||
|
||
{user.cursorless_wrapper_snippet} {user.cursorless_wrap_action} <user.cursorless_target>: | ||
user.private_cursorless_wrap_with_snippet(cursorless_wrap_action, cursorless_target, cursorless_wrapper_snippet) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
mode: command | ||
mode: user.cursorless_spoken_form_test | ||
tag: user.cursorless | ||
and tag: user.cursorless_use_community_snippets | ||
- | ||
|
||
# These snippets are defined in community | ||
|
||
{user.cursorless_insert_snippet_action} {user.snippet} <user.cursorless_destination>: | ||
user.private_cursorless_insert_community_snippet(snippet, cursorless_destination) | ||
|
||
{user.snippet_wrapper} {user.cursorless_wrap_action} <user.cursorless_target>: | ||
user.private_cursorless_wrap_with_community_snippet(snippet_wrapper, cursorless_target) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/cursorless-engine/src/test/fixtures/communitySnippets.fixture.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { ActionDescriptor } from "@cursorless/common"; | ||
import { spokenFormTest } from "./spokenFormTest"; | ||
|
||
const verticalRangeAction: ActionDescriptor = { | ||
name: "insertSnippet", | ||
destination: { | ||
type: "primitive", | ||
insertionMode: "after", | ||
target: { | ||
type: "primitive", | ||
mark: { | ||
character: "a", | ||
symbolColor: "default", | ||
type: "decoratedSymbol", | ||
}, | ||
}, | ||
}, | ||
snippetDescription: { | ||
body: "```\n$0\n```", | ||
type: "custom", | ||
}, | ||
}; | ||
|
||
/** | ||
* These are spoken forms that have more than one way to say them, so we have to | ||
* pick one in our spoken form generator, meaning we can't test the other in our | ||
* Talon tests by relying on our recorded test fixtures alone. | ||
*/ | ||
export const communitySnippetsSpokenFormsFixture = [ | ||
spokenFormTest("snippet code after air", verticalRangeAction, undefined, { | ||
useCommunitySnippets: true, | ||
}), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters