-
-
Notifications
You must be signed in to change notification settings - Fork 88
Update cursorless reference, help terms and docs #599
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
Changes from all commits
2d8b57e
2ad91c2
e6c4925
19083fe
721f114
b337287
a9733b6
e2f1229
93bea1b
9b85b80
08eb80f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
import webbrowser | ||
from pathlib import Path | ||
|
||
from talon import Module, actions | ||
from talon import Context, Module, actions, app | ||
|
||
from .get_list import get_list, get_lists | ||
from .sections.actions import get_actions | ||
|
@@ -12,12 +12,29 @@ | |
from .sections.special_marks import get_special_marks | ||
|
||
mod = Module() | ||
ctx = Context() | ||
ctx.matches = r""" | ||
app: vscode | ||
""" | ||
|
||
cheatsheet_out_dir = Path(tempfile.mkdtemp()) | ||
instructions_url = "https://www.cursorless.org/docs/" | ||
|
||
|
||
@mod.action_class | ||
class Actions: | ||
def cursorless_cheat_sheet_show_html(): | ||
"""Show new cursorless html cheat sheet""" | ||
app.notify( | ||
'Please first focus an app that supports cursorless, eg say "focus code"' | ||
) | ||
|
||
def cursorless_open_instructions(): | ||
"""Open web page with cursorless instructions""" | ||
webbrowser.open(instructions_url) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no reason not to support this everywhere. This way if user first installs Cursorless and says "cursorless help", they'll get the docs no matter what |
||
|
||
|
||
@ctx.action_class("user") | ||
class Actions: | ||
def cursorless_cheat_sheet_show_html(): | ||
"""Show new cursorless html cheat sheet""" | ||
|
@@ -26,71 +43,68 @@ def cursorless_cheat_sheet_show_html(): | |
"cursorless.showCheatsheet", | ||
{ | ||
"version": 0, | ||
"spokenFormInfo": actions.user.cursorless_cheat_sheet_get_json(), | ||
"spokenFormInfo": cursorless_cheat_sheet_get_json(), | ||
"outputPath": str(cheatsheet_out_path), | ||
}, | ||
) | ||
webbrowser.open(cheatsheet_out_path.as_uri()) | ||
|
||
def cursorless_cheat_sheet_get_json(): | ||
"""Get cursorless cheat sheet json""" | ||
return { | ||
"sections": [ | ||
{ | ||
"name": "Actions", | ||
"id": "actions", | ||
"items": get_actions(), | ||
}, | ||
{ | ||
"name": "Scopes", | ||
"id": "scopes", | ||
"items": get_scopes(), | ||
}, | ||
{ | ||
"name": "Modifiers", | ||
"id": "modifiers", | ||
"items": get_modifiers(), | ||
}, | ||
{ | ||
"name": "Paired delimiters", | ||
"id": "pairedDelimiters", | ||
"items": get_lists( | ||
[ | ||
"wrapper_only_paired_delimiter", | ||
"wrapper_selectable_paired_delimiter", | ||
"selectable_only_paired_delimiter", | ||
], | ||
"pairedDelimiter", | ||
), | ||
}, | ||
{ | ||
"name": "Special marks", | ||
"id": "specialMarks", | ||
"items": get_special_marks(), | ||
}, | ||
{ | ||
"name": "Positions", | ||
"id": "positions", | ||
"items": get_list("position", "position"), | ||
}, | ||
{ | ||
"name": "Compound targets", | ||
"id": "compoundTargets", | ||
"items": get_compound_targets(), | ||
}, | ||
{ | ||
"name": "Colors", | ||
"id": "colors", | ||
"items": get_list("hat_color", "hatColor"), | ||
}, | ||
{ | ||
"name": "Shapes", | ||
"id": "shapes", | ||
"items": get_list("hat_shape", "hatShape"), | ||
}, | ||
] | ||
} | ||
|
||
def cursorless_open_instructions(): | ||
"""Open web page with cursorless instructions""" | ||
webbrowser.open(instructions_url) | ||
def cursorless_cheat_sheet_get_json(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move to local function rather than action, per discussion today |
||
"""Get cursorless cheat sheet json""" | ||
return { | ||
"sections": [ | ||
{ | ||
"name": "Actions", | ||
"id": "actions", | ||
"items": get_actions(), | ||
}, | ||
{ | ||
"name": "Scopes", | ||
"id": "scopes", | ||
"items": get_scopes(), | ||
}, | ||
{ | ||
"name": "Modifiers", | ||
"id": "modifiers", | ||
"items": get_modifiers(), | ||
}, | ||
{ | ||
"name": "Paired delimiters", | ||
"id": "pairedDelimiters", | ||
"items": get_lists( | ||
[ | ||
"wrapper_only_paired_delimiter", | ||
"wrapper_selectable_paired_delimiter", | ||
"selectable_only_paired_delimiter", | ||
], | ||
"pairedDelimiter", | ||
), | ||
}, | ||
{ | ||
"name": "Special marks", | ||
"id": "specialMarks", | ||
"items": get_special_marks(), | ||
}, | ||
{ | ||
"name": "Positions", | ||
"id": "positions", | ||
"items": get_list("position", "position"), | ||
}, | ||
{ | ||
"name": "Compound targets", | ||
"id": "compoundTargets", | ||
"items": get_compound_targets(), | ||
}, | ||
{ | ||
"name": "Colors", | ||
"id": "colors", | ||
"items": get_list("hat_color", "hatColor"), | ||
}, | ||
{ | ||
"name": "Shapes", | ||
"id": "shapes", | ||
"items": get_list("hat_shape", "hatShape"), | ||
}, | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{user.cursorless_homophone} (reference | ref | cheatsheet | cheat sheet): user.cursorless_cheat_sheet_show_html() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make all these active globally, though the cheatsheet just shows a helpful message, per above |
||
{user.cursorless_homophone} (instructions | docks | help) | help {user.cursorless_homophone}: | ||
user.cursorless_open_instructions() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
""" | ||
Stores terms that are used in many different places | ||
""" | ||
from talon import Context, Module | ||
|
||
mod = Module() | ||
ctx = Context() | ||
|
||
mod.list( | ||
"cursorless_homophone", | ||
"Various alternative pronunciations of 'cursorless' to improve accuracy", | ||
) | ||
|
||
ctx.lists["user.cursorless_homophone"] = [ | ||
"cursorless", | ||
"cursor less", | ||
"cursor list", | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like better UX than Talon just refusing to hear them when they say "cursorless cheatsheet" in the wrong place