Skip to content

Commit 050cbc2

Browse files
Merge branch 'main' into migrateSnippets
2 parents c6ef011 + ab072ee commit 050cbc2

File tree

78 files changed

+949
-342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+949
-342
lines changed

cursorless-talon/src/apps/cursorless_vscode.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
ctx.matches = r"""
66
app: vscode
7+
# Disable Cursorless when VS Code is displaying a native OS dialog during which the command server
8+
# hotkey will not work.
9+
not win.title: /^(Open Folder|Open File|Save As|Open Workspace from File|Add Folder to Workspace|Save Workspace)$/i
710
"""
811

912
ctx.tags = ["user.cursorless"]

cursorless-talon/src/cheatsheet/cheat_sheet.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def cursorless_cheat_sheet_get_json():
128128
"wrapper_only_paired_delimiter",
129129
"wrapper_selectable_paired_delimiter",
130130
"selectable_only_paired_delimiter",
131+
"surrounding_pair_scope_type",
131132
],
132133
"pairedDelimiter",
133134
),

cursorless-talon/src/cheatsheet/sections/scopes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,14 @@ def get_scopes():
2323
},
2424
],
2525
},
26+
{
27+
"id": "pair",
28+
"type": "scopeType",
29+
"variations": [
30+
{
31+
"spokenForm": "<pair>",
32+
"description": "Paired delimiters",
33+
},
34+
],
35+
},
2636
]

cursorless-talon/src/modifiers/simple_scope_modifier.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
@mod.capture(
2626
rule=(
27-
"[{user.cursorless_every_scope_modifier} | {user.cursorless_ancestor_scope_modifier}] "
27+
"[{user.cursorless_every_scope_modifier} | {user.cursorless_ancestor_scope_modifier}+] "
2828
"<user.cursorless_scope_type>"
2929
),
3030
)
@@ -40,7 +40,7 @@ def cursorless_simple_scope_modifier(m) -> dict[str, Any]:
4040
return {
4141
"type": "containingScope",
4242
"scopeType": m.cursorless_scope_type,
43-
"ancestorIndex": 1,
43+
"ancestorIndex": len(m.cursorless_ancestor_scope_modifier_list),
4444
}
4545

4646
if settings.get("user.private_cursorless_use_preferred_scope"):

cursorless-talon/src/spoken_forms.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"drink": "editNewLineBefore",
2424
"drop": "insertEmptyLineBefore",
2525
"extract": "extractVariable",
26+
"flash": "flashTargets",
2627
"float": "insertEmptyLineAfter",
2728
"fold": "foldRegion",
2829
"follow split": "followLinkAside",

cursorless-talon/src/targets/destination.py

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Union
22

3-
from talon import Context, Module, actions
3+
from talon import Module
44

55
from .target_types import ListDestination, PrimitiveDestination
66

@@ -11,39 +11,12 @@
1111
desc="Cursorless insertion mode before/after",
1212
)
1313
mod.list("cursorless_insertion_mode_to", desc="Cursorless insertion mode to")
14-
mod.tag(
15-
"cursorless_disable_legacy_destination",
16-
desc="Disabled the Cursorless legacy destination(to after) support",
17-
)
18-
19-
ctx = Context()
20-
ctx.matches = r"""
21-
tag: user.cursorless_disable_legacy_destination
22-
"""
2314

2415

25-
# DEPRECATED @ 2023-08-01
2616
@mod.capture(
27-
rule="([{user.cursorless_insertion_mode_to}] {user.cursorless_insertion_mode_before_after}) | {user.cursorless_insertion_mode_to}"
28-
)
29-
def cursorless_insertion_mode(m) -> str:
30-
try:
31-
before_after = m.cursorless_insertion_mode_before_after
32-
if hasattr(m, "cursorless_insertion_mode_to"):
33-
words = m._unmapped
34-
actions.app.notify(
35-
f"'{' '.join(words)}' is deprecated. Please just say '{words[-1]}'"
36-
)
37-
return before_after
38-
except AttributeError:
39-
return "to"
40-
41-
42-
@ctx.capture(
43-
"user.cursorless_insertion_mode",
4417
rule="{user.cursorless_insertion_mode_before_after} | {user.cursorless_insertion_mode_to}",
4518
)
46-
def cursorless_insertion_mode_ctx(m) -> str:
19+
def cursorless_insertion_mode(m) -> str:
4720
try:
4821
return m.cursorless_insertion_mode_before_after
4922
except AttributeError:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
languageId: plaintext
2+
command:
3+
version: 7
4+
spokenForm: flash token
5+
action:
6+
name: flashTargets
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: token}
12+
usePrePhraseSnapshot: false
13+
initialState:
14+
documentContents: foo
15+
selections:
16+
- anchor: {line: 0, character: 0}
17+
active: {line: 0, character: 0}
18+
marks: {}
19+
finalState:
20+
documentContents: foo
21+
selections:
22+
- anchor: {line: 0, character: 0}
23+
active: {line: 0, character: 0}
24+
thatMark:
25+
- type: TokenTarget
26+
contentRange:
27+
start: {line: 0, character: 0}
28+
end: {line: 0, character: 3}
29+
isReversed: false
30+
hasExplicitRange: true
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
languageId: javascript
2+
command:
3+
version: 7
4+
spokenForm: change grand grand state
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: statement}
12+
ancestorIndex: 2
13+
usePrePhraseSnapshot: false
14+
initialState:
15+
documentContents: |-
16+
class MyClass {
17+
myFunk() {
18+
console.log("");
19+
}
20+
}
21+
selections:
22+
- anchor: {line: 2, character: 8}
23+
active: {line: 2, character: 8}
24+
marks: {}
25+
finalState:
26+
documentContents: ""
27+
selections:
28+
- anchor: {line: 0, character: 0}
29+
active: {line: 0, character: 0}
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
languageId: plaintext
22
command:
3-
version: 6
4-
spokenForm: change pair
3+
version: 7
4+
spokenForm: change every token inside
55
action:
66
name: clearAndSetSelection
77
target:
88
type: primitive
99
modifiers:
10-
- type: containingScope
11-
scopeType: {type: surroundingPair, delimiter: any}
10+
- type: everyScope
11+
scopeType: {type: token}
12+
- {type: interiorOnly}
1213
usePrePhraseSnapshot: false
1314
initialState:
14-
documentContents: ([)]
15+
documentContents: "'hello world'"
1516
selections:
1617
- anchor: {line: 0, character: 1}
1718
active: {line: 0, character: 1}
1819
marks: {}
1920
finalState:
20-
documentContents: (
21+
documentContents: "' '"
2122
selections:
2223
- anchor: {line: 0, character: 1}
2324
active: {line: 0, character: 1}
25+
- anchor: {line: 0, character: 2}
26+
active: {line: 0, character: 2}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
languageId: plaintext
2+
command:
3+
version: 7
4+
spokenForm: change last token inside
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: ordinalScope
11+
scopeType: {type: token}
12+
start: -1
13+
length: 1
14+
- {type: interiorOnly}
15+
usePrePhraseSnapshot: false
16+
initialState:
17+
documentContents: "'hello world'"
18+
selections:
19+
- anchor: {line: 0, character: 1}
20+
active: {line: 0, character: 1}
21+
marks: {}
22+
finalState:
23+
documentContents: "'hello '"
24+
selections:
25+
- anchor: {line: 0, character: 7}
26+
active: {line: 0, character: 7}

0 commit comments

Comments
 (0)