Skip to content

Commit 820732a

Browse files
css scope migration (#2339)
## Checklist - [/] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [/] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [/] I have not broken the cheatsheet --------- Co-authored-by: Pokey Rule <[email protected]>
1 parent 1ca51b3 commit 820732a

File tree

14 files changed

+173
-17
lines changed

14 files changed

+173
-17
lines changed

data/fixtures/recorded/languages/scss/changeName2.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ initialState:
1616
@return $result;
1717
}
1818
selections:
19-
- anchor: {line: 1, character: 13}
20-
active: {line: 1, character: 13}
19+
- anchor: {line: 1, character: 0}
20+
active: {line: 1, character: 0}
2121
marks: {}
2222
finalState:
2323
documentContents: |-
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
a { color: red; }
2+
---
3+
4+
[#1 Range] =
5+
[#1 Domain] = 0:0-0:17
6+
>-----------------<
7+
0| a { color: red; }
8+
9+
10+
[#2 Range] =
11+
[#2 Domain] = 0:3-0:16
12+
>-------------<
13+
0| a { color: red; }
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* hello */
2+
---
3+
4+
[Range] =
5+
[Domain] = 0:0-0:11
6+
>-----------<
7+
0| /* hello */
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* hello */
2+
---
3+
4+
[Range] =
5+
[Domain] = 0:0-0:11
6+
>-----------<
7+
0| /* hello */
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
a { color: red; }
2+
---
3+
4+
[#1 Range] =
5+
[#1 Domain] = 0:0-0:17
6+
>-----------------<
7+
0| a { color: red; }
8+
9+
10+
[#2 Range] =
11+
[#2 Domain] = 0:3-0:16
12+
>-------------<
13+
0| a { color: red; }
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* hello */
2+
---
3+
4+
[Range] =
5+
[Domain] = 0:0-0:11
6+
>-----------<
7+
0| /* hello */
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
a { color: red; }
2+
---
3+
4+
[#1 Range] =
5+
[#1 Domain] = 0:0-0:17
6+
>-----------------<
7+
0| a { color: red; }
8+
9+
10+
[#2 Range] =
11+
[#2 Domain] = 0:3-0:16
12+
>-------------<
13+
0| a { color: red; }

packages/common/src/scopeSupportFacets/css.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;
1111
export const cssScopeSupport: LanguageScopeSupportFacetMap = {
1212
"comment.block": supported,
1313
"string.singleLine": supported,
14+
"name.iteration.block": supported,
15+
"name.iteration.document": supported,
1416

1517
"comment.line": unsupported,
1618
};

packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,21 @@ export const scopeSupportFacetInfos: Record<
124124
description: "A named method declaration in a class",
125125
scopeType: "namedFunction",
126126
},
127+
"namedFunction.method.iteration.class": {
128+
description: "Iteration scope for named functions: class bodies",
129+
scopeType: "namedFunction",
130+
isIteration: true,
131+
},
132+
"namedFunction.iteration": {
133+
description: "Iteration scope for named functions",
134+
scopeType: "namedFunction",
135+
isIteration: true,
136+
},
137+
"namedFunction.iteration.document": {
138+
description: "Iteration scope for named functions: the entire document",
139+
scopeType: "namedFunction",
140+
isIteration: true,
141+
},
127142
anonymousFunction: {
128143
description:
129144
"An anonymous function, eg a lambda function, an arrow function, etc",
@@ -133,6 +148,25 @@ export const scopeSupportFacetInfos: Record<
133148
description: "The name of a function",
134149
scopeType: "functionName",
135150
},
151+
"functionName.method": {
152+
description: "The name of a method in a class",
153+
scopeType: "functionName",
154+
},
155+
"functionName.method.iteration.class": {
156+
description: "Iteration scope for function names: class bodies",
157+
scopeType: "functionName",
158+
isIteration: true,
159+
},
160+
"functionName.iteration": {
161+
description: "Iteration scope for function names",
162+
scopeType: "functionName",
163+
isIteration: true,
164+
},
165+
"functionName.iteration.document": {
166+
description: "Iteration scope for function names: the entire document",
167+
scopeType: "functionName",
168+
isIteration: true,
169+
},
136170

137171
functionCall: {
138172
description: "A function call",
@@ -299,6 +333,17 @@ export const scopeSupportFacetInfos: Record<
299333
scopeType: "name",
300334
isIteration: true,
301335
},
336+
"name.iteration.block": {
337+
description:
338+
"Iteration scope for names: statement blocks (body of functions/if classes/for loops/etc).",
339+
scopeType: "name",
340+
isIteration: true,
341+
},
342+
"name.iteration.document": {
343+
description: "Iteration scope for names: the entire document",
344+
scopeType: "name",
345+
isIteration: true,
346+
},
302347
"key.attribute": {
303348
description: "Key (LHS) of an attribute eg in an xml element",
304349
scopeType: "collectionKey",

packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,15 @@ const scopeSupportFacets = [
3131
"className.iteration.block",
3232
"namedFunction",
3333
"namedFunction.method",
34+
"namedFunction.method.iteration.class",
35+
"namedFunction.iteration",
36+
"namedFunction.iteration.document",
3437
"anonymousFunction",
3538
"functionName",
39+
"functionName.method",
40+
"functionName.method.iteration.class",
41+
"functionName.iteration",
42+
"functionName.iteration.document",
3643

3744
"functionCall",
3845
"functionCall.constructor",
@@ -76,6 +83,8 @@ const scopeSupportFacets = [
7683
"name.resource.iteration",
7784
"name.argument.formal",
7885
"name.argument.formal.iteration",
86+
"name.iteration.block",
87+
"name.iteration.document",
7988

8089
"key.attribute",
8190
"key.mapPair",

0 commit comments

Comments
 (0)