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 spoken form to API #46

Merged
merged 2 commits into from
Aug 1, 2021
Merged
Changes from all 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
13 changes: 12 additions & 1 deletion src/command.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
from talon import actions, Module
from talon import actions, Module, speech_system
from typing import Any, List

mod = Module()

last_phrase = None


def on_phrase(d):
global last_phrase
last_phrase = d

speech_system.register("pre:phrase", on_phrase)


class NotSet:
def __repr__(self):
Expand Down Expand Up @@ -68,8 +77,10 @@ def cursorless_multiple_target_command(
):
"""Execute multi-target cursorless command"""
args = list(filter(lambda x: x is not NotSet, [arg1, arg2, arg3]))
spoken_form = " ".join(last_phrase["phrase"])
Copy link
Member

Choose a reason for hiding this comment

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

Just to check, if I say "disk take air", this won't pick up the initial "disk" right?

Copy link
Member Author

Choose a reason for hiding this comment

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

It will. So we are going to have some discipline when we do the test cases.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm. Ok I'm gonna approve this one just so you're not blocked on adding tests to your other PRs but not sure I'm in love with passing through the whole command to every cursorless command. Let's discuss later

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I think we could improve this. Just unsure of the best solution right now.

actions.user.vscode_with_plugin_and_wait(
"cursorless.command",
spoken_form,
action,
targets,
*args,
Expand Down