Skip to content

Commit 1c75319

Browse files
Merge branch 'pokey/issue69-Support-fully-compositional-modifiers' into textTheBasedItemScope
2 parents 1fef1e7 + 4e78c28 commit 1c75319

File tree

112 files changed

+1678
-988
lines changed

Some content is hidden

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

112 files changed

+1678
-988
lines changed

.vscode/launch.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,27 @@
4141
"!**/node_modules/**"
4242
]
4343
},
44+
{
45+
"name": "Run Single Extension Test",
46+
"type": "extensionHost",
47+
"request": "launch",
48+
"env": {
49+
"CURSORLESS_TEST": "true",
50+
"CURSORLESS_RUN_SINGLE_TEST": "true"
51+
},
52+
"args": [
53+
"--extensions-dir=${workspaceFolder}/.vscode-sandbox/extensions",
54+
"--extensionDevelopmentPath=${workspaceFolder}",
55+
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
56+
],
57+
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
58+
"preLaunchTask": "${defaultBuildTask}",
59+
"resolveSourceMapLocations": [
60+
"${workspaceFolder}/**",
61+
"!${workspaceFolder}/.vscode-sandbox/**",
62+
"!**/node_modules/**"
63+
]
64+
},
4465
{
4566
"name": "Update fixtures",
4667
"type": "extensionHost",

cursorless-talon/src/actions/actions_makeshift.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class MakeshiftAction:
3939
"editor.action.rename",
4040
restore_selection=True,
4141
await_command=False,
42-
post_command_sleep_ms=150,
42+
post_command_sleep_ms=200,
4343
),
4444
]
4545

cursorless-talon/src/csv_overrides.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ def update_dicts(
159159
key = obj["key"]
160160
if not is_removed(key):
161161
for k in key.split("|"):
162+
if value == "pasteFromClipboard" and k.endswith(" to"):
163+
# FIXME: This is a hack to work around the fact that the
164+
# spoken form of the `pasteFromClipboard` action used to be
165+
# "paste to", but now the spoken form is just "paste" and
166+
# the "to" is part of the positional target. Users who had
167+
# cursorless before this change would have "paste to" as
168+
# their spoken form and so would need to say "paste to to".
169+
k = k[:-3]
162170
results[obj["list"]][k.strip()] = value
163171

164172
# Assign result to talon context list

cursorless-talon/src/positional_target.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77

88
mod.list(
99
"cursorless_positional_connective",
10-
desc="The connective used to separate source and destination targets",
10+
desc='Connectives used to separate source and destination targets that indicate position, eg "before" or "after"',
1111
)
1212

1313
positional_connectives = {
1414
**POSITION_BEFORE,
1515
**POSITION_AFTER,
1616
}
1717

18-
print(positional_connectives)
1918
ctx.lists["self.cursorless_positional_connective"] = positional_connectives.keys()
2019

2120

docs/contributing/CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ locally, you need to run the extension in debug mode. To do so you need to run
3434
the `workbench.action.debug.selectandstart` command in VSCode and then select either "Run
3535
Extension" or "Extension Tests".
3636

37+
### Running a single test
38+
39+
The entire test suite takes a little while to run (1-2 mins), so if you'd like to repeat a single test, you can edit [`runSingleRecordedTest`](../../src/test/suite/runSingleRecordedTest.ts) to refer to the desired test and use the "Run Single Extension Test" launch config instead of the usual "Extension Tests".
40+
3741
## Code formatting
3842

3943
We use [`pre-commit`](https://pre-commit.com/) to automate autoformatting.

docs/contributing/parse-tree-patterns.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ We have a small domain-specific language that we use to define patterns to look
66

77
`GRAND_PARENT_TYPE.*.CHILD_TYPE[FIELD]!?`
88

9-
| Syntax | Description |
10-
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
11-
| TYPE | Match node type<br/>`node.type` |
12-
| Dot operator(`.`) | Type hierarchy between parent and child |
13-
| Wildcard op(`*`) | Match any type |
14-
| Negation op(`~`) | Match any type other than what is specified after `~` |
15-
| Important op(`!`) | Use this node as result instead of parent.<br/>By default the leftmost/top node is used |
16-
| Optional op(`?`) | Node is optional. Will match if available. |
17-
| Field op(`[field]`) | Get child field node for resulting node.<br/>Only evaluated on the resulting node at the end.<br/>`node.childForFieldName(field)` |
9+
| Syntax | Description |
10+
| ------------------- | --------------------------------------------------------------------------------------- |
11+
| TYPE | Match node type<br/>`node.type` |
12+
| Dot operator(`.`) | Type hierarchy between parent and child |
13+
| Wildcard op(`*`) | Match any type |
14+
| Negation op(`~`) | Match any type other than what is specified after `~` |
15+
| Important op(`!`) | Use this node as result instead of parent.<br/>By default the leftmost/top node is used |
16+
| Optional op(`?`) | Node is optional. Will match if available. |
17+
| Field op(`[field]`) | Return child node at given field.<br/>`node.childForFieldName(field)` |
18+
| Index op(`[n]`) | Return nth named child node. |
1819

1920
## Multiple patterns
2021

docs/user/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ The following colors are supported. Note that to target the default (gray) hat y
6464
| `"navy"` | navy | `userColor1` ||
6565
| `"apricot"` | apricot | `userColor2` ||
6666

67-
You can enable or disable colors in your VSCode settings, by searching for `cursorless.hatEnablement.colors` and checking the box next to the internal ID for the given shape as listed above.
67+
You can enable or disable colors in your VSCode settings, by searching for `cursorless.hatEnablement.colors` and checking the box next to the internal ID for the given shape as listed above. To navigate to your VSCode settings, either say "show settings", or go to File --> Preferences --> Settings.
6868

6969
You can also tweak the visible colors for any of these colors in your VSCode settings, by searching for `cursorless.colors` and changing the hex color code next to the internal ID for the given shape as listed above. Note that you can configure different colors for dark and light themes.
7070

@@ -93,7 +93,7 @@ The following shapes are supported. Note that to target the default (dot) shape
9393
| `"cross"` | ![Crosshairs](../../images/hats/crosshairs.svg) | `crosshairs` ||
9494
| `"bolt"` | ![Bolt](../../images/hats/bolt.svg) | `bolt` ||
9595

96-
You can enable or disable shapes in your VSCode settings, by searching for `cursorless.hatEnablement.shapes` and checking the box next to the internal ID for the given shape as listed above.
96+
You can enable or disable shapes in your VSCode settings, by searching for `cursorless.hatEnablement.shapes` and checking the box next to the internal ID for the given shape as listed above. To navigate to your VSCode settings, either say "show settings", or go to File --> Preferences --> Settings.
9797

9898
If you find these shape names unintuitive / tough to remember, their
9999
spoken forms can be [customized](customization.md) like any other spoken form

src/actions/BringMoveSwap.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ class BringMoveSwap implements Action {
9999
text = sources
100100
.map((source, i) => {
101101
const text = source.contentText;
102-
const delimiter = destination.delimiter ?? source.delimiter;
102+
const delimiter =
103+
(destination.isRaw ? null : destination.insertionDelimiter) ??
104+
(source.isRaw ? null : source.insertionDelimiter);
103105
return i > 0 && delimiter != null ? delimiter + text : text;
104106
})
105107
.join("");

src/actions/Clear.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { toRawTarget } from "../processTargets/modifiers/RawSelectionStage";
1+
import PlainTarget from "../processTargets/targets/PlainTarget";
22
import { Target } from "../typings/target.types";
33
import { Graph } from "../typings/Types";
44
import { setSelectionsAndFocusEditor } from "../util/setSelectionsAndFocusEditor";
@@ -12,9 +12,16 @@ export default class Clear implements Action {
1212

1313
async run([targets]: [Target[]]): Promise<ActionReturnValue> {
1414
const editor = ensureSingleEditor(targets);
15-
const rawTargets = targets.map(toRawTarget);
15+
const plainTargets = targets.map(
16+
(target) =>
17+
new PlainTarget({
18+
editor: target.editor,
19+
isReversed: target.isReversed,
20+
contentRange: target.contentRange,
21+
})
22+
);
1623

17-
const { thatMark } = await this.graph.actions.remove.run([rawTargets]);
24+
const { thatMark } = await this.graph.actions.remove.run([plainTargets]);
1825

1926
if (thatMark != null) {
2027
await setSelectionsAndFocusEditor(

src/actions/CutCopyPaste.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import RawSelectionTarget from "../processTargets/targets/RawSelectionTarget";
1+
import PlainTarget from "../processTargets/targets/PlainTarget";
22
import { Target } from "../typings/target.types";
33
import { Graph } from "../typings/Types";
44
import { getOutsideOverflow } from "../util/targetUtils";
@@ -19,10 +19,10 @@ export class Cut implements Action {
1919
return getOutsideOverflow(target.editor, target.contentRange, range).map(
2020
(overflow): Target =>
2121
// TODO Instead of creating a new target display decorations by range
22-
new RawSelectionTarget({
22+
new PlainTarget({
2323
editor: target.editor,
2424
contentRange: overflow,
25-
isReversed: false,
25+
isReversed: target.isReversed,
2626
})
2727
);
2828
});

0 commit comments

Comments
 (0)