Skip to content
Open
Changes from 7 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
24 changes: 23 additions & 1 deletion lang/tags/object_oriented.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from talon import Context, Module, actions
from talon import Context, Module, actions, settings

ctx = Context()
mod = Module()
Expand All @@ -10,6 +10,28 @@

mod.list("code_common_method", desc="Commonly invoked method, e.g. 'foo' in '.foo()'")

mod.setting(
Comment thread
ZachWatkins marked this conversation as resolved.
Outdated
"code_class_formatter",
type=str,
default="PUBLIC_CAMEL_CASE",
desc="Formatter used when a class/type name is dictated as free text (e.g. 'returns' followed by a spoken class name)",
)

ctx.matches = r"""
tag: user.code_object_oriented
"""
Comment thread
ZachWatkins marked this conversation as resolved.
Outdated


@ctx.capture("user.code_type", rule="{user.code_type} | <user.text>")
Comment thread
ZachWatkins marked this conversation as resolved.
Outdated
def code_type(m) -> str:
"""Returns a type, allowing dictated text to be used as a class name"""
try:
return m.code_type
except AttributeError:
return actions.user.formatted_text(
m.text, settings.get("user.code_class_formatter")
)


@mod.action_class
class Actions:
Expand Down