Skip to content

Commit fe7e8e5

Browse files
Merge branch 'contiguous_scope' of github.com:cursorless-dev/cursorless into contiguous_scope
2 parents d3eb687 + 2852e37 commit fe7e8e5

Some content is hidden

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

51 files changed

+1706
-17
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ repos:
4040
# tests use strings with trailing white space to represent the final
4141
# document contents. For example
4242
# packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/ruby/changeCondition.yml
43-
exclude: ^packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/.*/[^/]*\.yml$|/generated/|^patches/
43+
exclude: ^packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/.*/[^/]*\.yml$|\.scope$|/generated/|^patches/
4444
- repo: local
4545
hooks:
4646
- id: eslint
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
tags: [enhancement]
3+
pullRequest: 1901
4+
---
5+
6+
- Added `join` action. This action will join multiple lines together. eg `"join air"` or `"join three lines air"`.

cursorless-talon/src/spoken_forms.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"hover": "showHover",
2727
"indent": "indentLine",
2828
"inspect": "showDebugHover",
29+
"join": "joinLines",
2930
"post": "setSelectionAfter",
3031
"pour": "editNewLineAfter",
3132
"pre": "setSelectionBefore",

docs/user/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,17 @@ eg:
706706
707707
Extracts the function call containing the decorated 'a' into its own variable.
708708
709+
### Join
710+
711+
Join multiple lines together.
712+
713+
- `"join <TARGET>"`
714+
715+
eg:
716+
717+
- `join air`: Join the line with the token containing the letter 'a' with its next line.
718+
- `join block air`: Joines all lines in the paragraph with the token containing the letter 'a' together into a single line.
719+
709720
## Paired delimiters
710721
711722
| Default spoken form | Delimiter name | Symbol inserted before target | Symbol inserted after target | Is wrapper? | Is selectable? |

packages/common/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,7 @@ export * from "./types/TestCaseFixture";
9494
export * from "./util/getEnvironmentVariableStrict";
9595
export * from "./util/CompositeKeyDefaultMap";
9696
export * from "./util/toPlainObject";
97+
export * from "./scopeSupportFacets/scopeSupportFacets.types";
98+
export * from "./scopeSupportFacets/scopeSupportFacetInfos";
99+
export * from "./scopeSupportFacets/textualScopeSupportFacetInfos";
100+
export * from "./scopeSupportFacets/getLanguageScopeSupport";
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { htmlScopeSupport } from "./html";
2+
import { javascriptScopeSupport } from "./javascript";
3+
import { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
4+
5+
export function getLanguageScopeSupport(
6+
languageId: string,
7+
): LanguageScopeSupportFacetMap {
8+
switch (languageId) {
9+
case "javascript":
10+
return javascriptScopeSupport;
11+
case "html":
12+
return htmlScopeSupport;
13+
}
14+
throw Error(`Unsupported language: '${languageId}'`);
15+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import {
2+
LanguageScopeSupportFacetMap,
3+
ScopeSupportFacetLevel,
4+
} from "./scopeSupportFacets.types";
5+
6+
const { supported, notApplicable } = ScopeSupportFacetLevel;
7+
8+
export const htmlScopeSupport: LanguageScopeSupportFacetMap = {
9+
["key.attribute"]: supported,
10+
["tags"]: supported,
11+
12+
namedFunction: notApplicable,
13+
["name.assignment"]: notApplicable,
14+
["key.mapPair"]: notApplicable,
15+
["key.mapPair.iteration"]: notApplicable,
16+
["value.mapPair"]: notApplicable,
17+
["value.mapPair.iteration"]: notApplicable,
18+
["value.assignment"]: notApplicable,
19+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import {
2+
LanguageScopeSupportFacetMap,
3+
ScopeSupportFacetLevel,
4+
} from "./scopeSupportFacets.types";
5+
6+
const { supported, notApplicable } = ScopeSupportFacetLevel;
7+
8+
export const javascriptScopeSupport: LanguageScopeSupportFacetMap = {
9+
namedFunction: supported,
10+
["name.assignment"]: supported,
11+
["key.mapPair"]: supported,
12+
["key.mapPair.iteration"]: supported,
13+
["value.mapPair"]: supported,
14+
["value.mapPair.iteration"]: supported,
15+
["value.assignment"]: supported,
16+
17+
["key.attribute"]: notApplicable,
18+
["tags"]: notApplicable,
19+
};
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import {
2+
ScopeSupportFacet,
3+
ScopeSupportFacetInfo,
4+
} from "./scopeSupportFacets.types";
5+
6+
export const scopeSupportFacetInfos: Record<
7+
ScopeSupportFacet,
8+
ScopeSupportFacetInfo
9+
> = {
10+
namedFunction: {
11+
description: "A named function",
12+
scopeType: "namedFunction",
13+
},
14+
["name.assignment"]: {
15+
description: "Name(LHS) of an assignment",
16+
scopeType: "name",
17+
},
18+
["key.attribute"]: {
19+
description: "Key(LHS) of an attribute",
20+
scopeType: "collectionKey",
21+
},
22+
["key.mapPair"]: {
23+
description: "Key(LHS) of a map pair",
24+
scopeType: "collectionKey",
25+
},
26+
["key.mapPair.iteration"]: {
27+
description: "Iteration of map pair keys",
28+
scopeType: "collectionKey",
29+
isIteration: true,
30+
},
31+
["value.assignment"]: {
32+
description: "Value(RHS) of an assignment",
33+
scopeType: "value",
34+
},
35+
["value.mapPair"]: {
36+
description: "Key(RHS) of a map pair",
37+
scopeType: "value",
38+
},
39+
["value.mapPair.iteration"]: {
40+
description: "Iteration of map pair values",
41+
scopeType: "value",
42+
isIteration: true,
43+
},
44+
["tags"]: {
45+
description: "Both tags in an xml element",
46+
scopeType: "xmlBothTags",
47+
},
48+
};
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import { SimpleScopeTypeType } from "../types/command/PartialTargetDescriptor.types";
2+
3+
const scopeSupportFacets = [
4+
// "list",
5+
// "list.interior",
6+
// "map",
7+
// "map.interior",
8+
// "collectionKey",
9+
"namedFunction",
10+
// "namedFunction.interior",
11+
// "functionName",
12+
// "anonymousFunction",
13+
// "anonymousFunction.interior",
14+
"name.assignment",
15+
"key.attribute",
16+
"key.mapPair",
17+
"key.mapPair.iteration",
18+
"value.assignment",
19+
"value.mapPair",
20+
"value.mapPair.iteration",
21+
// "value.assignment.removal",
22+
// "value.return",
23+
// "value.return.removal",
24+
// "value.collectionItem",
25+
// "value.collectionItem.removal",
26+
// "statement",
27+
// "ifStatement",
28+
// "condition.if",
29+
// "condition.while",
30+
// "condition.doWhile",
31+
// "condition.for",
32+
// "condition.ternary",
33+
// "branch",
34+
// "comment.line",
35+
// "comment.block",
36+
// "string.singleLine",
37+
// "string.multiLine",
38+
// "textFragment",
39+
// "functionCall",
40+
// "functionCallee",
41+
// "argumentOrParameter.argument",
42+
// "argumentOrParameter.argument.removal",
43+
// "argumentOrParameter.parameter",
44+
// "argumentOrParameter.parameter.removal",
45+
// "class",
46+
// "class.interior",
47+
// "className",
48+
// "type",
49+
"tags",
50+
] as const;
51+
52+
const textualScopeSupportFacets = [
53+
"character",
54+
"word",
55+
"token",
56+
"line",
57+
"paragraph",
58+
"document",
59+
] as const;
60+
61+
export interface ScopeSupportFacetInfo {
62+
readonly description: string;
63+
readonly scopeType: SimpleScopeTypeType;
64+
readonly isIteration?: boolean;
65+
}
66+
67+
export enum ScopeSupportFacetLevel {
68+
supported,
69+
unsupported,
70+
notApplicable,
71+
}
72+
73+
export type ScopeSupportFacet = (typeof scopeSupportFacets)[number];
74+
75+
export type TextualScopeSupportFacet =
76+
(typeof textualScopeSupportFacets)[number];
77+
78+
export type LanguageScopeSupportFacetMap = Partial<
79+
Record<ScopeSupportFacet, ScopeSupportFacetLevel>
80+
>;

0 commit comments

Comments
 (0)