Skip to content

Commit f43ac2b

Browse files
More csharp scopes and facet cleanup
1 parent 0c0cebb commit f43ac2b

File tree

7 files changed

+105
-44
lines changed

7 files changed

+105
-44
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
void Foo() { }
3+
4+
---
5+
6+
[Range] =
7+
[Domain] = 0:0-2:0
8+
>
9+
0|
10+
1| void Foo() { }
11+
2|
12+
<
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
class MyClass { }
22
---
33

4-
[Range] =
5-
[Domain] = 0:15-0:16
4+
[#1 Range] =
5+
[#1 Domain] = 0:0-0:17
6+
>-----------------<
7+
0| class MyClass { }
8+
9+
10+
[#2 Range] =
11+
[#2 Domain] = 0:15-0:16
612
>-<
713
0| class MyClass { }
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
void Foo() { }
3+
4+
---
5+
6+
[Range] =
7+
[Domain] = 0:0-2:0
8+
>
9+
0|
10+
1| void Foo() { }
11+
2|
12+
<
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
class MyClass { }
22
---
33

4-
[Range] =
5-
[Domain] = 0:15-0:16
4+
[#1 Range] =
5+
[#1 Domain] = 0:0-0:17
6+
>-----------------<
7+
0| class MyClass { }
8+
9+
10+
[#2 Range] =
11+
[#2 Domain] = 0:15-0:16
612
>-<
713
0| class MyClass { }

packages/common/src/scopeSupportFacets/c.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = {
100100
"interior.ternary": supported,
101101
"interior.loop": supported,
102102

103-
// Unsupported
103+
/* UNSUPPORTED */
104104

105105
fieldAccess: unsupported,
106106

107-
// Not applicable (C and C++)
107+
/* NOT APPLICABLE (C and C++) */
108108

109109
// Element and tags
110110
element: notApplicable,

packages/common/src/scopeSupportFacets/csharp.ts

Lines changed: 56 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
22
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
33

4-
const { supported, notApplicable } = ScopeSupportFacetLevel;
4+
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;
55

66
export const csharpScopeSupport: LanguageScopeSupportFacetMap = {
77
switchStatementSubject: supported,
@@ -28,11 +28,13 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = {
2828
"functionCallee.constructor": supported,
2929

3030
namedFunction: supported,
31+
"namedFunction.iteration.document": notApplicable,
3132
"namedFunction.constructor": supported,
3233
"namedFunction.method": supported,
3334
"namedFunction.method.iteration.class": supported,
3435

3536
functionName: supported,
37+
"functionName.iteration.document": notApplicable,
3638
"functionName.constructor": supported,
3739
"functionName.method": supported,
3840
"functionName.method.iteration.class": supported,
@@ -169,46 +171,69 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = {
169171
"interior.ternary": supported,
170172
"interior.try": supported,
171173

172-
// Not applicable
174+
/* UNSUPPORTED */
173175

174-
"collectionItem.unenclosed.iteration": notApplicable,
175-
"collectionItem.unenclosed": notApplicable,
176-
"functionName.iteration.block": notApplicable,
177-
"functionName.iteration.document": notApplicable,
178-
"interior.cell": notApplicable,
179-
"interior.command": notApplicable,
176+
fieldAccess: unsupported,
177+
178+
/* NOT APPLICABLE */
179+
180+
// Element and tags
181+
element: notApplicable,
182+
tags: notApplicable,
183+
startTag: notApplicable,
184+
endTag: notApplicable,
180185
"interior.element": notApplicable,
181-
"interior.resource": notApplicable,
186+
"textFragment.element": notApplicable,
182187
"key.attribute": notApplicable,
183-
"name.argument.actual.iteration": notApplicable,
188+
"value.attribute": notApplicable,
189+
190+
// Keyword argument
184191
"name.argument.actual": notApplicable,
185-
"name.assignment.pattern": notApplicable,
186-
"name.resource.iteration": notApplicable,
187-
"name.resource": notApplicable,
188-
"name.variable.pattern": notApplicable,
192+
"name.argument.actual.iteration": notApplicable,
193+
"value.argument.actual": notApplicable,
194+
"value.argument.actual.iteration": notApplicable,
195+
196+
// Functions in blocks
197+
"functionName.iteration.block": notApplicable,
189198
"namedFunction.iteration.block": notApplicable,
190-
"namedFunction.iteration.document": notApplicable,
191-
"section.iteration.document": notApplicable,
192-
"section.iteration.parent": notApplicable,
193-
"textFragment.element": notApplicable,
194-
"type.resource.iteration": notApplicable,
199+
200+
// Resource syntax
201+
"interior.resource": notApplicable,
195202
"type.resource": notApplicable,
196-
"type.alias": notApplicable,
197-
"value.argument.actual.iteration": notApplicable,
198-
"value.argument.actual": notApplicable,
199-
"value.attribute": notApplicable,
200-
"value.resource.iteration": notApplicable,
203+
"type.resource.iteration": notApplicable,
204+
"name.resource": notApplicable,
205+
"name.resource.iteration": notApplicable,
201206
"value.resource": notApplicable,
202-
"value.typeAlias": notApplicable,
207+
"value.resource.iteration": notApplicable,
208+
209+
// Pattern destructing
210+
"name.assignment.pattern": notApplicable,
211+
"name.variable.pattern": notApplicable,
203212
"value.variable.pattern": notApplicable,
213+
214+
// Type alias
215+
"type.alias": notApplicable,
216+
"value.typeAlias": notApplicable,
217+
218+
// Section
219+
section: notApplicable,
220+
"section.iteration.document": notApplicable,
221+
"section.iteration.parent": notApplicable,
222+
223+
// Command
204224
command: notApplicable,
205-
element: notApplicable,
206-
endTag: notApplicable,
207-
environment: notApplicable,
225+
"interior.command": notApplicable,
226+
227+
// Notebook cell
208228
notebookCell: notApplicable,
229+
"interior.cell": notApplicable,
230+
231+
// Collection item
232+
"collectionItem.unenclosed.iteration": notApplicable,
233+
"collectionItem.unenclosed": notApplicable,
234+
235+
// Miscellaneous
236+
environment: notApplicable,
209237
pairDelimiter: notApplicable,
210238
regularExpression: notApplicable,
211-
section: notApplicable,
212-
startTag: notApplicable,
213-
tags: notApplicable,
214239
};

queries/csharp.scm

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,13 @@
5151
(if_statement) @ifStatement
5252

5353
(
54-
(compilation_unit) @statement.iteration @name.iteration
55-
(#document-range! @statement.iteration @name.iteration)
54+
(compilation_unit) @statement.iteration @class.iteration @className.iteration
55+
(#document-range! @statement.iteration @class.iteration @className.iteration)
56+
)
57+
58+
(
59+
(compilation_unit) @name.iteration @namedFunction.iteration @functionName.iteration
60+
(#document-range! @name.iteration @namedFunction.iteration @functionName.iteration)
5661
)
5762

5863
(_
@@ -175,11 +180,6 @@
175180
)
176181
) @class @type @_.domain
177182

178-
(
179-
(compilation_unit) @class.iteration @className.iteration
180-
(#document-range! @class.iteration @className.iteration)
181-
)
182-
183183
;; Treat interior of all bodies as iteration scopes for class and classname, eg
184184
;;!! private static void foo() { }
185185
;;! ***

0 commit comments

Comments
 (0)