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

Support insertSnippet action #96

Closed
wants to merge 8 commits into from
Closed

Support insertSnippet action #96

wants to merge 8 commits into from

Conversation

pokey
Copy link
Member

@pokey pokey commented Oct 26, 2021

See also cursorless-dev/cursorless#304

Still todo:

  • Add docs
  • Check DFA
  • Support "strict" mode for phrasal snippets

@pokey pokey marked this pull request as draft October 26, 2021 11:44
{user.cursorless_insert_snippet_action} <user.cursorless_insertion_snippet> <user.cursorless_target>:
user.cursorless_single_target_command(cursorless_insert_snippet_action, cursorless_target, cursorless_insertion_snippet)

{user.cursorless_insert_snippet_action} {user.cursorless_insertion_snippet_single_phrase} <user.text> [halt]:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

users may want to anchor this. I wonder if we should let them define it themselves? Use a tag?

# NOTE: Please do not change these dicts. Use the CSVs for customization.
# See https://github.com/pokey/cursorless-talon/blob/main/docs/customization.md
insertion_snippets_single_phrase = {
"funk": "functionDeclaration.name",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not in love with using this syntax here, but after the . indicates which variable will get the phrase

"""Perform cursorless wrap action"""
snippet_name, snippet_variable = snippet_description.split(".")
actions.user.cursorless_this_command(
action, snippet_name, {snippet_variable: text}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: text is formatted on VSCode side

@pokey
Copy link
Member Author

pokey commented Jan 27, 2022

Merged into cursorless-dev/cursorless#304 as part of monorepo

@pokey pokey closed this Jan 27, 2022
@pokey pokey deleted the insert-snippet branch January 27, 2022 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant