Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added iteration scope for csharp functions #2665

Merged
merged 1 commit into from
Oct 12, 2024
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,7 @@
class MyClass { }
---

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

[Range] =
[Domain] = 0:15-0:16
>-<
0| class MyClass { }
2 changes: 2 additions & 0 deletions packages/common/src/scopeSupportFacets/csharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = {
namedFunction: supported,
"namedFunction.constructor": supported,
"namedFunction.method": supported,
"namedFunction.method.iteration.class": supported,

functionName: supported,
"functionName.constructor": supported,
"functionName.method": supported,
"functionName.method.iteration.class": supported,

"condition.for": supported,
"condition.while": supported,
Expand Down
8 changes: 8 additions & 0 deletions queries/csharp.scm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
(class_declaration
name: (identifier) @className
) @class @_.domain

(compilation_unit) @class.iteration @className.iteration
;; Treat interior of all bodies as iteration scopes for class and classname, eg
;;!! private static void foo() { }
Expand Down Expand Up @@ -89,6 +90,13 @@
)
] @namedFunction @functionName.domain

(class_declaration
body: (_
"{" @namedFunction.iteration.start.endOf @functionName.iteration.start.endOf
"}" @namedFunction.iteration.end.startOf @functionName.iteration.end.startOf
)
)

[
(invocation_expression)
(object_creation_expression)
Expand Down
Loading