Skip to content

Commit 2e2a159

Browse files
sonnyvesalipokey
andauthored
add dart class support (#2677)
## 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 --------- Co-authored-by: Pokey Rule <[email protected]>
1 parent effff0d commit 2e2a159

File tree

5 files changed

+66
-2
lines changed

5 files changed

+66
-2
lines changed

data/fixtures/scopes/dart/class.scope

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class MyClass {
2+
3+
}
4+
---
5+
6+
[Content] =
7+
[Removal] =
8+
[Domain] = 0:0-2:1
9+
>---------------
10+
0| class MyClass {
11+
1|
12+
2| }
13+
-<
14+
15+
[Insertion delimiter] = "\n\n"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
class MyClass {
2+
3+
}
4+
---
5+
6+
[Content] = 0:6-0:13
7+
>-------<
8+
0| class MyClass {
9+
10+
[Removal] = 0:6-0:14
11+
>--------<
12+
0| class MyClass {
13+
14+
[Leading delimiter] = 0:5-0:6
15+
>-<
16+
0| class MyClass {
17+
18+
[Trailing delimiter] = 0:13-0:14
19+
>-<
20+
0| class MyClass {
21+
22+
[Domain] = 0:0-2:1
23+
>---------------
24+
0| class MyClass {
25+
1|
26+
2| }
27+
-<
28+
29+
[Insertion delimiter] = " "

data/playground/dart.dart

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
foo() {
2-
if (true) {}
2+
final hi = '';
3+
if (hi.isNotEmpty) {
4+
5+
//
6+
}
7+
8+
9+
else if (true) {
10+
//
11+
}
312

413
final list = [1, 2, 3];
514

615
final map = {
716
'hi': 1,
817
};
918
}
19+
20+
class Something{
21+
22+
}

packages/common/src/scopeSupportFacets/dart.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ export const dartScopeSupport: LanguageScopeSupportFacetMap = {
88
ifStatement: supported,
99
list: supported,
1010
map: supported,
11+
class: supported,
12+
className: supported,
1113
};

queries/dart.scm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
;;!! if () {}
32
;;! ^^^^^^^^
43
(if_statement) @ifStatement
@@ -16,3 +15,9 @@
1615
(set_or_map_literal)
1716
(map_pattern)
1817
] @map
18+
19+
;;!! class Foo {}
20+
;;! ^^^^^^^^^^^^
21+
(class_definition
22+
name: (_) @className
23+
) @class @className.domain

0 commit comments

Comments
 (0)