Skip to content

Commit fed023b

Browse files
authored
Merge branch 'main' into pokey/implement-more-typescript-scope-types-using-queries
2 parents d9f004b + fcdf70c commit fed023b

File tree

99 files changed

+449
-394
lines changed

Some content is hidden

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

99 files changed

+449
-394
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ repos:
1414
entry: Forbid symlinks
1515
language: fail
1616
types: [symlink]
17+
- repo: https://github.com/Lucas-C/pre-commit-hooks
18+
rev: v1.5.1
19+
hooks:
20+
- id: forbid-crlf
1721
- repo: https://github.com/pre-commit/pre-commit-hooks
1822
rev: v4.4.0
1923
hooks:

cursorless-talon/.vscode/.ropeproject/config.py

Lines changed: 0 additions & 123 deletions
This file was deleted.
-6 Bytes
Binary file not shown.

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def get_modifiers():
2626
"previous",
2727
"next",
2828
"backward",
29+
"forward",
2930
]
3031
simple_modifiers = {
3132
key: value
@@ -125,6 +126,10 @@ def get_modifiers():
125126
"spokenForm": f"<scope> {complex_modifiers['backward']}",
126127
"description": "single instance of <scope> including target, going backwards",
127128
},
129+
{
130+
"spokenForm": f"<scope> {complex_modifiers['forward']}",
131+
"description": "single instance of <scope> including target, going forwards",
132+
},
128133
{
129134
"spokenForm": f"<number> <scope>s {complex_modifiers['backward']}",
130135
"description": "<number> instances of <scope> including target, going backwards",

data/playground/xml.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<root>
2-
<name id="some id">Some text</name>
3-
</root>
1+
<root>
2+
<name id="some id">Some text</name>
3+
</root>

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

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,16 @@
708708
}
709709
]
710710
},
711+
{
712+
"id": "inferPreviousMark",
713+
"type": "modifier",
714+
"variations": [
715+
{
716+
"spokenForm": "its",
717+
"description": "Infer previous mark"
718+
}
719+
]
720+
},
711721
{
712722
"id": "interiorOnly",
713723
"type": "modifier",
@@ -794,6 +804,14 @@
794804
"spokenForm": "previous <number> <scope>s",
795805
"description": "previous <number> instances of <scope>"
796806
},
807+
{
808+
"spokenForm": "<scope> backward",
809+
"description": "single instance of <scope> including target, going backwards"
810+
},
811+
{
812+
"spokenForm": "<scope> forward",
813+
"description": "single instance of <scope> including target, going forwards"
814+
},
797815
{
798816
"spokenForm": "<number> <scope>s backward",
799817
"description": "<number> instances of <scope> including target, going backwards"
@@ -1056,6 +1074,16 @@
10561074
}
10571075
]
10581076
},
1077+
{
1078+
"id": "branch",
1079+
"type": "scopeType",
1080+
"variations": [
1081+
{
1082+
"spokenForm": "branch",
1083+
"description": "Branch"
1084+
}
1085+
]
1086+
},
10591087
{
10601088
"id": "chapter",
10611089
"type": "scopeType",
@@ -1186,6 +1214,16 @@
11861214
}
11871215
]
11881216
},
1217+
{
1218+
"id": "identifier",
1219+
"type": "scopeType",
1220+
"variations": [
1221+
{
1222+
"spokenForm": "identifier",
1223+
"description": "Identifier"
1224+
}
1225+
]
1226+
},
11891227
{
11901228
"id": "ifStatement",
11911229
"type": "scopeType",
@@ -1196,6 +1234,16 @@
11961234
}
11971235
]
11981236
},
1237+
{
1238+
"id": "instance",
1239+
"type": "scopeType",
1240+
"variations": [
1241+
{
1242+
"spokenForm": "instance",
1243+
"description": "Instance"
1244+
}
1245+
]
1246+
},
11991247
{
12001248
"id": "line",
12011249
"type": "scopeType",
@@ -1386,6 +1434,16 @@
13861434
}
13871435
]
13881436
},
1437+
{
1438+
"id": "unit",
1439+
"type": "scopeType",
1440+
"variations": [
1441+
{
1442+
"spokenForm": "unit",
1443+
"description": "Unit"
1444+
}
1445+
]
1446+
},
13891447
{
13901448
"id": "url",
13911449
"type": "scopeType",

packages/cursorless-engine/src/core/commandRunner/selectionToStoredTarget.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { SelectionWithEditor } from "../../typings/Types";
33

44
/**
55
* Given a selection with an editor, constructs an appropriate `Target` to use
6-
* for a `that` mark. It uses an `UntypedTarget`, and if the selection is
7-
* empty, it sets `hasExplicitRange` to `false`.
6+
* for a `that` mark. It uses an `UntypedTarget` and sets `hasExplicitRange` to `true`.
87
*
98
* @param selection The selection with editor to be converted
109
* @returns A target that can be used for a `that` mark
@@ -14,5 +13,5 @@ export const selectionToStoredTarget = (selection: SelectionWithEditor) =>
1413
editor: selection.editor,
1514
isReversed: selection.selection.isReversed,
1615
contentRange: selection.selection,
17-
hasExplicitRange: !selection.selection.isEmpty,
16+
hasExplicitRange: true,
1817
});

packages/cursorless-engine/src/processTargets/targets/PlainTarget.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,10 @@ export default class PlainTarget extends BaseTarget {
2020
getTrailingDelimiterTarget = () => undefined;
2121
getRemovalRange = () => this.contentRange;
2222

23-
protected getCloneParameters = () => this.state;
23+
protected getCloneParameters() {
24+
return {
25+
...this.state,
26+
isToken: this.isToken,
27+
};
28+
}
2429
}

packages/cursorless-engine/src/processTargets/targets/PositionTarget.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,15 @@ export default class PositionTarget extends BaseTarget {
4444
if (
4545
this.insertionDelimiter === "\n" &&
4646
this.position === "after" &&
47-
this.thatTarget.contentRange.isSingleLine
47+
this.state.thatTarget!.contentRange.isSingleLine
4848
) {
49+
// If the target that we're wrapping is not a single line, then we
50+
// want to compute indentation based on the entire target. Otherwise,
51+
// we allow the editor to determine how to perform indentation.
52+
// Note that we use `this.state.thatTarget` rather than `this.thatTarget`
53+
// because we don't really want the transitive `thatTarget` behaviour, as
54+
// it's not really the "that" target that we're after; it's the target that
55+
// we're wrapping. Should rework this stuff as part of #803.
4956
return "insertLineAfter";
5057
}
5158

packages/cursorless-engine/src/testCaseRecorder/TestCaseRecorder.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,13 @@ export class TestCaseRecorder {
323323
await this.testCase.recordInitialState();
324324

325325
const editor = ide().activeTextEditor!;
326+
327+
if (editor.document.getText().includes("\r\n")) {
328+
throw Error(
329+
"Refusing to record a test when the document contains CRLF line endings. Please convert line endings to LF.",
330+
);
331+
}
332+
326333
// NB: We need to copy the editor options rather than storing a reference
327334
// because its properties are lazy
328335
this.originalTextEditorOptions = { ...editor.options };

0 commit comments

Comments
 (0)