Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

void Foo() { }

---

[Range] =
[Domain] = 0:0-2:0
>
0|
1| void Foo() { }
2|
<
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
class MyClass { }
---

[Range] =
[Domain] = 0:15-0:16
[#1 Range] =
[#1 Domain] = 0:0-0:17
>-----------------<
0| class MyClass { }


[#2 Range] =
[#2 Domain] = 0:15-0:16
>-<
0| class MyClass { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

void Foo() { }

---

[Range] =
[Domain] = 0:0-2:0
>
0|
1| void Foo() { }
2|
<
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
class MyClass { }
---

[Range] =
[Domain] = 0:15-0:16
[#1 Range] =
[#1 Domain] = 0:0-0:17
>-----------------<
0| class MyClass { }


[#2 Range] =
[#2 Domain] = 0:15-0:16
>-<
0| class MyClass { }
4 changes: 2 additions & 2 deletions packages/common/src/scopeSupportFacets/c.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = {
"interior.ternary": supported,
"interior.loop": supported,

// Unsupported
/* UNSUPPORTED */

fieldAccess: unsupported,

// Not applicable (C and C++)
/* NOT APPLICABLE (C and C++) */

// Element and tags
element: notApplicable,
Expand Down
87 changes: 56 additions & 31 deletions packages/common/src/scopeSupportFacets/csharp.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";

const { supported, notApplicable } = ScopeSupportFacetLevel;
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

export const csharpScopeSupport: LanguageScopeSupportFacetMap = {
switchStatementSubject: supported,
Expand All @@ -28,11 +28,13 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = {
"functionCallee.constructor": supported,

namedFunction: supported,
"namedFunction.iteration.document": supported,
"namedFunction.constructor": supported,
"namedFunction.method": supported,
"namedFunction.method.iteration.class": supported,

functionName: supported,
"functionName.iteration.document": supported,
"functionName.constructor": supported,
"functionName.method": supported,
"functionName.method.iteration.class": supported,
Expand Down Expand Up @@ -169,46 +171,69 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = {
"interior.ternary": supported,
"interior.try": supported,

// Not applicable
/* UNSUPPORTED */

"collectionItem.unenclosed.iteration": notApplicable,
"collectionItem.unenclosed": notApplicable,
"functionName.iteration.block": notApplicable,
"functionName.iteration.document": notApplicable,
"interior.cell": notApplicable,
"interior.command": notApplicable,
fieldAccess: unsupported,

/* NOT APPLICABLE */

// Element and tags
element: notApplicable,
tags: notApplicable,
startTag: notApplicable,
endTag: notApplicable,
"interior.element": notApplicable,
"interior.resource": notApplicable,
"textFragment.element": notApplicable,
"key.attribute": notApplicable,
"name.argument.actual.iteration": notApplicable,
"value.attribute": notApplicable,

// Keyword argument
"name.argument.actual": notApplicable,
"name.assignment.pattern": notApplicable,
"name.resource.iteration": notApplicable,
"name.resource": notApplicable,
"name.variable.pattern": notApplicable,
"name.argument.actual.iteration": notApplicable,
"value.argument.actual": notApplicable,
"value.argument.actual.iteration": notApplicable,

// Functions in blocks
"functionName.iteration.block": notApplicable,
"namedFunction.iteration.block": notApplicable,
"namedFunction.iteration.document": notApplicable,
"section.iteration.document": notApplicable,
"section.iteration.parent": notApplicable,
"textFragment.element": notApplicable,
"type.resource.iteration": notApplicable,

// Resource syntax
"interior.resource": notApplicable,
"type.resource": notApplicable,
"type.alias": notApplicable,
"value.argument.actual.iteration": notApplicable,
"value.argument.actual": notApplicable,
"value.attribute": notApplicable,
"value.resource.iteration": notApplicable,
"type.resource.iteration": notApplicable,
"name.resource": notApplicable,
"name.resource.iteration": notApplicable,
"value.resource": notApplicable,
"value.typeAlias": notApplicable,
"value.resource.iteration": notApplicable,

// Pattern destructing
"name.assignment.pattern": notApplicable,
"name.variable.pattern": notApplicable,
"value.variable.pattern": notApplicable,

// Type alias
"type.alias": notApplicable,
"value.typeAlias": notApplicable,

// Section
section: notApplicable,
"section.iteration.document": notApplicable,
"section.iteration.parent": notApplicable,

// Command
command: notApplicable,
element: notApplicable,
endTag: notApplicable,
environment: notApplicable,
"interior.command": notApplicable,

// Notebook cell
notebookCell: notApplicable,
"interior.cell": notApplicable,

// Collection item
"collectionItem.unenclosed.iteration": notApplicable,
"collectionItem.unenclosed": notApplicable,

// Miscellaneous
environment: notApplicable,
pairDelimiter: notApplicable,
regularExpression: notApplicable,
section: notApplicable,
startTag: notApplicable,
tags: notApplicable,
};
14 changes: 7 additions & 7 deletions queries/csharp.scm
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@
(if_statement) @ifStatement

(
(compilation_unit) @statement.iteration @name.iteration
(#document-range! @statement.iteration @name.iteration)
(compilation_unit) @statement.iteration @class.iteration @className.iteration
(#document-range! @statement.iteration @class.iteration @className.iteration)
)

(
(compilation_unit) @name.iteration @namedFunction.iteration @functionName.iteration
(#document-range! @name.iteration @namedFunction.iteration @functionName.iteration)
)

(_
Expand Down Expand Up @@ -175,11 +180,6 @@
)
) @class @type @_.domain

(
(compilation_unit) @class.iteration @className.iteration
(#document-range! @class.iteration @className.iteration)
)

;; Treat interior of all bodies as iteration scopes for class and classname, eg
;;!! private static void foo() { }
;;! ***
Expand Down
Loading