Skip to content

Commit 9503996

Browse files
Merge branch 'main' into dependabot/npm_and_yarn/packages/cheatsheet-local/webpack-5.94.0
2 parents 125aca3 + 72c46b7 commit 9503996

File tree

7 files changed

+73
-15
lines changed

7 files changed

+73
-15
lines changed

.github/actions/test-neovim-lua/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ description: "Set up Neovim Lua environment and run Busted tests"
33
runs:
44
using: "composite"
55
steps:
6-
- uses: leafo/gh-actions-lua@v9
6+
- uses: leafo/gh-actions-lua@v10
77
with:
8-
luaVersion: "luajit-2.1.0-beta3"
8+
luaVersion: "luajit-openresty"
99
- uses: leafo/gh-actions-luarocks@v4
1010
- shell: bash
1111
run: |

cursorless-talon/src/spoken_scope_forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ def init_scope_spoken_forms(graphemes_talon_list: dict[str, str]):
1212
def create_flattened_talon_list(ctx: Context, graphemes_talon_list: dict[str, str]):
1313
lists_to_merge = {
1414
"cursorless_scope_type": "simple",
15-
"cursorless_surrounding_pair_scope_type": "surroundingPair",
1615
"cursorless_selectable_only_paired_delimiter": "surroundingPair",
1716
"cursorless_wrapper_selectable_paired_delimiter": "surroundingPair",
17+
"cursorless_surrounding_pair_scope_type": "surroundingPair",
1818
}
1919
# If the user have no custom regex scope type, then that list is missing from the context
2020
if "user.cursorless_custom_regex_scope_type" in ctx.lists.keys(): # noqa: SIM118
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
languageId: python
2+
command:
3+
version: 7
4+
spokenForm: change tail
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- {type: extendThroughEndOf}
11+
usePrePhraseSnapshot: true
12+
initialState:
13+
documentContents: |-
14+
"""foo
15+
bar
16+
"""
17+
selections:
18+
- anchor: {line: 0, character: 3}
19+
active: {line: 0, character: 3}
20+
marks: {}
21+
finalState:
22+
documentContents: |-
23+
"""
24+
bar
25+
"""
26+
selections:
27+
- anchor: {line: 0, character: 3}
28+
active: {line: 0, character: 3}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
languageId: typescript
2+
command:
3+
version: 7
4+
spokenForm: change string
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: surroundingPair, delimiter: string}
12+
usePrePhraseSnapshot: true
13+
initialState:
14+
documentContents: "`hello`"
15+
selections:
16+
- anchor: {line: 0, character: 1}
17+
active: {line: 0, character: 1}
18+
marks: {}
19+
finalState:
20+
documentContents: ""
21+
selections:
22+
- anchor: {line: 0, character: 0}
23+
active: {line: 0, character: 0}

packages/common/src/types/command/PartialTargetDescriptor.types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ export interface SurroundingPairScopeType {
251251
export interface SurroundingPairInteriorScopeType {
252252
type: "surroundingPairInterior";
253253
delimiter: SurroundingPairName;
254+
// If true don't yield multiline pairs
255+
requireSingleLine?: boolean;
254256
}
255257

256258
export interface OneOfScopeType {

packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export class HeadTailStage implements ModifierStage {
2727
{
2828
type: "surroundingPairInterior",
2929
delimiter: "any",
30+
requireSingleLine: true,
3031
},
3132
],
3233
},

packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/SurroundingPairInteriorScopeHandler.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import type { TargetScope } from "../scope.types";
55
import type { ScopeIteratorRequirements } from "../scopeHandler.types";
66
import { type ScopeHandler } from "../scopeHandler.types";
77
import type { ScopeHandlerFactory } from "../ScopeHandlerFactory";
8-
import { map } from "itertools";
98

109
export class SurroundingPairInteriorScopeHandler extends BaseScopeHandler {
1110
protected isHierarchical = true;
@@ -32,28 +31,33 @@ export class SurroundingPairInteriorScopeHandler extends BaseScopeHandler {
3231
return this.surroundingPairScopeHandler.iterationScopeType;
3332
}
3433

35-
generateScopeCandidates(
34+
*generateScopeCandidates(
3635
editor: TextEditor,
3736
position: Position,
3837
direction: Direction,
3938
hints: ScopeIteratorRequirements,
4039
): Iterable<TargetScope> {
41-
return map(
42-
this.surroundingPairScopeHandler.generateScopes(
43-
editor,
44-
position,
45-
direction,
46-
hints,
47-
),
48-
(scope) => ({
40+
const scopes = this.surroundingPairScopeHandler.generateScopes(
41+
editor,
42+
position,
43+
direction,
44+
hints,
45+
);
46+
47+
for (const scope of scopes) {
48+
if (this.scopeType.requireSingleLine && !scope.domain.isSingleLine) {
49+
continue;
50+
}
51+
52+
yield {
4953
editor,
5054
domain: scope.domain,
5155
getTargets(isReversed) {
5256
return scope
5357
.getTargets(isReversed)
5458
.flatMap((target) => target.getInterior()!);
5559
},
56-
}),
57-
);
60+
};
61+
}
5862
}
5963
}

0 commit comments

Comments
 (0)