Skip to content

Commit de8da0c

Browse files
authored
csharp migrate scopes (#2347)
## Checklist - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [x] 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) - [x] I have not broken the cheatsheet
1 parent 20d5ad1 commit de8da0c

File tree

13 files changed

+202
-3
lines changed

13 files changed

+202
-3
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
foo.bar(param => expression)
2+
---
3+
4+
[Content] =
5+
[Removal] =
6+
[Domain] = 0:8-0:27
7+
>-------------------<
8+
0| foo.bar(param => expression)
9+
10+
[Insertion delimiter] = "\n"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Func<int, int> product = (arg1, arg2) => arg1 * arg2;
2+
---
3+
4+
[Content] =
5+
[Domain] = 0:25-0:52
6+
>---------------------------<
7+
0| Func<int, int> product = (arg1, arg2) => arg1 * arg2;
8+
9+
[Removal] = 0:24-0:52
10+
>----------------------------<
11+
0| Func<int, int> product = (arg1, arg2) => arg1 * arg2;
12+
13+
[Leading delimiter] = 0:24-0:25
14+
>-<
15+
0| Func<int, int> product = (arg1, arg2) => arg1 * arg2;
16+
17+
[Insertion delimiter] = "\n"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(p1, p2) => {}
2+
---
3+
4+
[Content] =
5+
[Removal] =
6+
[Domain] = 0:0-0:14
7+
>--------------<
8+
0| (p1, p2) => {}
9+
10+
[Insertion delimiter] = "\n"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
public class Outer_class {
2+
public class Inner_class { }
3+
}
4+
---
5+
6+
[#1 Range] =
7+
[#1 Domain] = 0:0-2:1
8+
>--------------------------
9+
0| public class Outer_class {
10+
1| public class Inner_class { }
11+
2| }
12+
-<
13+
14+
15+
[#2 Range] =
16+
[#2 Domain] = 0:26-2:0
17+
>
18+
0| public class Outer_class {
19+
1| public class Inner_class { }
20+
2| }
21+
<
22+
23+
24+
[#3 Range] =
25+
[#3 Domain] = 1:28-1:31
26+
>---<
27+
1| public class Inner_class { }
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// starting content
2+
public class BankAccount {}
3+
// ending content
4+
---
5+
6+
[#1 Range] =
7+
[#1 Domain] = 0:0-2:17
8+
>-------------------
9+
0| // starting content
10+
1| public class BankAccount {}
11+
2| // ending content
12+
-----------------<
13+
14+
15+
[#2 Range] =
16+
[#2 Domain] = 1:26-1:26
17+
><
18+
1| public class BankAccount {}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
public class Outer_class {
2+
public class Inner_class { }
3+
}
4+
---
5+
6+
[#1 Range] =
7+
[#1 Domain] = 0:0-2:1
8+
>--------------------------
9+
0| public class Outer_class {
10+
1| public class Inner_class { }
11+
2| }
12+
-<
13+
14+
15+
[#2 Range] =
16+
[#2 Domain] = 0:26-2:0
17+
>
18+
0| public class Outer_class {
19+
1| public class Inner_class { }
20+
2| }
21+
<
22+
23+
24+
[#3 Range] =
25+
[#3 Domain] = 1:28-1:31
26+
>---<
27+
1| public class Inner_class { }
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// starting content
2+
public class BankAccount {}
3+
// ending content
4+
---
5+
6+
[#1 Range] =
7+
[#1 Domain] = 0:0-2:17
8+
>-------------------
9+
0| // starting content
10+
1| public class BankAccount {}
11+
2| // ending content
12+
-----------------<
13+
14+
15+
[#2 Range] =
16+
[#2 Domain] = 1:26-1:26
17+
><
18+
1| public class BankAccount {}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
public class BankAccount {}
2+
---
3+
4+
[Content] = 0:13-0:24
5+
>-----------<
6+
0| public class BankAccount {}
7+
8+
[Removal] = 0:13-0:25
9+
>------------<
10+
0| public class BankAccount {}
11+
12+
[Leading delimiter] = 0:12-0:13
13+
>-<
14+
0| public class BankAccount {}
15+
16+
[Trailing delimiter] = 0:24-0:25
17+
>-<
18+
0| public class BankAccount {}
19+
20+
[Domain] = 0:0-0:27
21+
>---------------------------<
22+
0| public class BankAccount {}
23+
24+
[Insertion delimiter] = " "

packages/common/src/scopeSupportFacets/csharp.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,10 @@ const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;
1111
export const csharpScopeSupport: LanguageScopeSupportFacetMap = {
1212
ifStatement: supported,
1313
class: supported,
14+
className: supported,
15+
anonymousFunction: supported,
16+
"class.iteration.document": supported,
17+
"class.iteration.block": supported,
18+
"className.iteration.document": supported,
19+
"className.iteration.block": supported,
1420
};

packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,32 @@ export const scopeSupportFacetInfos: Record<
8484
description: "A class in an object-oriented language",
8585
scopeType: "class",
8686
},
87+
"class.iteration.document": {
88+
description: "Iteration scope for classes. The entire document.",
89+
scopeType: "class",
90+
isIteration: true,
91+
},
92+
"class.iteration.block": {
93+
description:
94+
"Iteration scope for classes. Statement blocks(body of functions/if classes/for loops/etc).",
95+
scopeType: "class",
96+
isIteration: true,
97+
},
8798
className: {
8899
description: "The name of a class",
89100
scopeType: "className",
90101
},
102+
"className.iteration.document": {
103+
description: "Iteration scope for class names. The entire document.",
104+
scopeType: "className",
105+
isIteration: true,
106+
},
107+
"className.iteration.block": {
108+
description:
109+
"Iteration scope for class names. Statement blocks(body of functions/if classes/for loops/etc).",
110+
scopeType: "className",
111+
isIteration: true,
112+
},
91113

92114
namedFunction: {
93115
description: "A named function declaration",

0 commit comments

Comments
 (0)