Skip to content

Commit fd93230

Browse files
Merge branch 'main' into contiguous_scope
2 parents 0ccdcc6 + c6f5600 commit fd93230

File tree

87 files changed

+1450
-306
lines changed

Some content is hidden

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

87 files changed

+1450
-306
lines changed

.eslintrc.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111
"ecmaVersion": 6,
1212
"sourceType": "module"
1313
},
14-
"plugins": ["@typescript-eslint", "unused-imports", "import", "unicorn"],
14+
"plugins": [
15+
"@typescript-eslint",
16+
"unused-imports",
17+
"import",
18+
"unicorn",
19+
"mocha"
20+
],
1521
"rules": {
1622
"import/no-relative-packages": "error",
1723
"@typescript-eslint/consistent-type-assertions": [
@@ -53,7 +59,9 @@
5359
],
5460
"no-throw-literal": "warn",
5561
"semi": "off",
56-
"unicorn/prefer-module": "error"
62+
"unicorn/prefer-module": "error",
63+
"mocha/no-skipped-tests": "error",
64+
"mocha/no-exclusive-tests": "error"
5765
},
5866
"overrides": [
5967
{
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
tags: [enhancement]
3+
pullRequest: 2103
4+
---
5+
6+
- Added `break` action. This action will break a line in two. eg `"break air"`
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
tags: [enhancement]
3+
pullRequest: 2094
4+
---
5+
6+
- Added `visible` modifier. This modifier returns all visible ranges. In most cases this will just be a single range starting from the first visible line and ending at the last visible line. If there are visible folded regions these break the visible range into po multiple ranges.
Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
from ..get_list import get_lists
1+
from ..get_list import get_lists, get_raw_list
22

33

44
def get_scopes():
5-
return get_lists(
6-
["scope_type"],
7-
"scopeType",
5+
complex_scopes = get_raw_list("glyph_scope_type")
6+
return [
7+
*get_lists(
8+
["scope_type"],
9+
"scopeType",
10+
{
11+
"argumentOrParameter": "Argument",
12+
"boundedNonWhitespaceSequence": "Non whitespace sequence stopped by surrounding pair delimeters",
13+
},
14+
),
815
{
9-
"argumentOrParameter": "Argument",
10-
"boundedNonWhitespaceSequence": "Non whitespace sequence stopped by surrounding pair delimeters",
16+
"id": "glyph",
17+
"type": "scopeType",
18+
"variations": [
19+
{
20+
"spokenForm": f"{complex_scopes['glyph']} <character>",
21+
"description": "Instance of single character <character>",
22+
},
23+
],
1124
},
12-
)
25+
]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from talon import Module
2+
3+
mod = Module()
4+
5+
mod.list(
6+
"cursorless_glyph_scope_type",
7+
desc="Cursorless glyph scope type",
8+
)
9+
mod.list(
10+
"cursorless_glyph_scope_type_plural",
11+
desc="Plural version of Cursorless glyph scope type",
12+
)
13+
14+
15+
@mod.capture(rule="{user.cursorless_glyph_scope_type} <user.any_alphanumeric_key>")
16+
def cursorless_glyph_scope_type(m) -> dict[str, str]:
17+
return {
18+
"type": "glyph",
19+
"character": m.any_alphanumeric_key,
20+
}
21+
22+
23+
@mod.capture(
24+
rule="{user.cursorless_glyph_scope_type_plural} <user.any_alphanumeric_key>"
25+
)
26+
def cursorless_glyph_scope_type_plural(m) -> dict[str, str]:
27+
return {
28+
"type": "glyph",
29+
"character": m.any_alphanumeric_key,
30+
}

cursorless-talon/src/spoken_forms.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"actions.csv": {
44
"simple_action": {
55
"bottom": "scrollToBottom",
6+
"break": "breakLine",
67
"break point": "toggleLineBreakpoint",
78
"carve": "cutToClipboard",
89
"center": "scrollToCenter",
@@ -170,6 +171,9 @@
170171
},
171172
"surrounding_pair_scope_type": {
172173
"string": "string"
174+
},
175+
"glyph_scope_type": {
176+
"glyph": "glyph"
173177
}
174178
},
175179
"paired_delimiters.csv": {

cursorless-talon/src/spoken_forms.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def ret(filename: str, *args: P.args, **kwargs: P.kwargs) -> R:
6868
"wrapper_only_paired_delimiter": "pairedDelimiter",
6969
"surrounding_pair_scope_type": "pairedDelimiter",
7070
"scope_type": "simpleScopeTypeType",
71+
"glyph_scope_type": "complexScopeTypeType",
7172
"custom_regex_scope_type": "customRegex",
7273
}
7374

@@ -125,7 +126,7 @@ def handle_new_values(csv_name: str, values: list[SpokenFormEntry]):
125126
handle_csv("experimental/miscellaneous.csv"),
126127
handle_csv(
127128
"modifier_scope_types.csv",
128-
pluralize_lists=["scope_type"],
129+
pluralize_lists=["scope_type", "glyph_scope_type"],
129130
extra_allowed_values=[
130131
"private.fieldAccess",
131132
"private.switchStatementSubject",

docs/user/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Welcome to Cursorless! You may find it helpful to start with the [tutorial video
88

99
This guide assumes you've already [installed Cursorless](installation.md).
1010

11-
Once you understand the concepts, you can pull up a cheatsheet for reference using either `"cursorless reference"` or `"cursorless cheatsheet"` commands within VSCode.
11+
Once you understand the concepts, you can pull up a cheatsheet for reference by saying either `"cursorless reference"` or `"cursorless cheatsheet"` with VSCode focused.
1212

1313
You can get back to these docs by saying `"cursorless docs"`, `"cursorless help"` within VSCode.
1414

@@ -717,6 +717,16 @@ eg:
717717
- `join air`: Join the line with the token containing the letter 'a' with its next line.
718718
- `join block air`: Joines all lines in the paragraph with the token containing the letter 'a' together into a single line.
719719
720+
### Break
721+
722+
Break line in two.
723+
724+
- `"break <TARGET>"`
725+
726+
eg:
727+
728+
- `break air`: Break the line with the token containing the letter 'a'. 'a' is now the first token on the new line.
729+
720730
## Paired delimiters
721731
722732
| Default spoken form | Delimiter name | Symbol inserted before target | Symbol inserted after target | Is wrapper? | Is selectable? |

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"eslint-config-prettier": "^8.8.0",
3737
"eslint-import-resolver-typescript": "3.5.5",
3838
"eslint-plugin-import": "2.28.1",
39+
"eslint-plugin-mocha": "10.2.0",
3940
"eslint-plugin-unicorn": "49.0.0",
4041
"eslint-plugin-unused-imports": "^3.0.0",
4142
"prettier": "3.0.3",
@@ -61,6 +62,6 @@
6162
"engines": {
6263
"node": ">=18.18.2"
6364
},
64-
"packageManager": "pnpm@8.6.12",
65+
"packageManager": "pnpm@8.12.0",
6566
"type": "module"
6667
}

packages/cheatsheet/src/lib/sampleSpokenFormInfos/defaults.json

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@
1414
}
1515
]
1616
},
17+
{
18+
"id": "breakLine",
19+
"type": "action",
20+
"variations": [
21+
{
22+
"spokenForm": "break <target>",
23+
"description": "Break line"
24+
}
25+
]
26+
},
1727
{
1828
"id": "callAsFunction",
1929
"type": "action",
@@ -228,6 +238,16 @@
228238
}
229239
]
230240
},
241+
{
242+
"id": "joinLines",
243+
"type": "action",
244+
"variations": [
245+
{
246+
"spokenForm": "join <target>",
247+
"description": "Join lines"
248+
}
249+
]
250+
},
231251
{
232252
"id": "moveToTarget",
233253
"type": "action",
@@ -905,6 +925,16 @@
905925
"description": "Trailing delimiter range"
906926
}
907927
]
928+
},
929+
{
930+
"id": "visible",
931+
"type": "modifier",
932+
"variations": [
933+
{
934+
"spokenForm": "visible",
935+
"description": "Visible"
936+
}
937+
]
908938
}
909939
]
910940
},
@@ -1058,6 +1088,16 @@
10581088
}
10591089
]
10601090
},
1091+
{
1092+
"id": "show_scope_sidebar",
1093+
"type": "command",
1094+
"variations": [
1095+
{
1096+
"spokenForm": "bar cursorless",
1097+
"description": "Show cursorless sidebar"
1098+
}
1099+
]
1100+
},
10611101
{
10621102
"id": "show_scope_visualizer",
10631103
"type": "command",
@@ -1272,6 +1312,16 @@
12721312
}
12731313
]
12741314
},
1315+
{
1316+
"id": "glyph",
1317+
"type": "scopeType",
1318+
"variations": [
1319+
{
1320+
"spokenForm": "glyph <character>",
1321+
"description": "Instance of single character <character>"
1322+
}
1323+
]
1324+
},
12751325
{
12761326
"id": "identifier",
12771327
"type": "scopeType",
@@ -1537,7 +1587,7 @@
15371587
"type": "scopeType",
15381588
"variations": [
15391589
{
1540-
"spokenForm": "word",
1590+
"spokenForm": "sub",
15411591
"description": "Word"
15421592
}
15431593
]

0 commit comments

Comments
 (0)