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 identity modifier. Added head tail modifier to csv #115

Merged
merged 5 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 2 additions & 4 deletions src/modifiers/head_tail.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from talon import Context, Module
from talon import Module

mod = Module()
ctx = Context()


mod.list("cursorless_head_tail", desc="Cursorless modifier for head or tail of line")
ctx.lists["self.cursorless_head_tail"] = {"head", "tail"}


@mod.capture(rule="{user.cursorless_head_tail}")
def cursorless_head_tail(m) -> str:
def cursorless_head_tail(m) -> dict:
return {"modifier": {"type": m.cursorless_head_tail}}
14 changes: 14 additions & 0 deletions src/modifiers/identity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from talon import Module

mod = Module()


mod.list(
"cursorless_identity",
desc="Cursorless modifier for identity. Use to break inference.",
pokey marked this conversation as resolved.
Show resolved Hide resolved
)


@mod.capture(rule="{user.cursorless_identity}")
def cursorless_head_tail(m) -> dict:
AndreasArvidsson marked this conversation as resolved.
Show resolved Hide resolved
return {"modifier": {"type": "identity"}}
8 changes: 8 additions & 0 deletions src/modifiers/modifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@
"bound": "excludeInterior",
}

head_tail = {
"head": "head",
"tail": "tail",
AndreasArvidsson marked this conversation as resolved.
Show resolved Hide resolved
}
identity = {"just": "identity"}


def on_ready():
init_csv_and_watch_changes(
"modifiers",
{
"delimiter_inclusion": delimiter_inclusions,
"head_tail": head_tail,
"identity": identity,
},
)

Expand Down
1 change: 1 addition & 0 deletions src/primitive_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"<user.cursorless_containing_scope>", # funk, state, class
"<user.cursorless_subtoken_scope>", # first past second word
"<user.cursorless_surrounding_pair>", # matching/pair [curly, round]
"<user.cursorless_identity>", # just
# "<user.cursorless_matching_paired_delimiter>", # matching
]

Expand Down