Skip to content

Commit 8b51d18

Browse files
authored
Migrate c sharp if statement (#2324)
## Checklist - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [-] 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) - [-] I have not broken the cheatsheet
1 parent 3b11650 commit 8b51d18

File tree

5 files changed

+27
-1
lines changed

5 files changed

+27
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
if (true) { }
2+
---
3+
4+
[Content] =
5+
[Removal] =
6+
[Domain] = 0:0-0:13
7+
>-------------<
8+
0| if (true) { }
9+
10+
[Insertion delimiter] = "\n"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* eslint-disable @typescript-eslint/naming-convention */
2+
3+
import {
4+
LanguageScopeSupportFacetMap,
5+
ScopeSupportFacetLevel,
6+
} from "./scopeSupportFacets.types";
7+
8+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
9+
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;
10+
11+
export const csharpScopeSupport: LanguageScopeSupportFacetMap = {
12+
ifStatement: supported,
13+
};

packages/common/src/scopeSupportFacets/getLanguageScopeSupport.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { javaScopeSupport } from "./java";
33
import { javascriptScopeSupport } from "./javascript";
44
import { jsonScopeSupport } from "./json";
55
import { pythonScopeSupport } from "./python";
6+
import { csharpScopeSupport } from "./csharp";
67
import { luaScopeSupport } from "./lua";
78
import { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
89
import { talonScopeSupport } from "./talon";
@@ -12,6 +13,8 @@ export function getLanguageScopeSupport(
1213
languageId: string,
1314
): LanguageScopeSupportFacetMap {
1415
switch (languageId) {
16+
case "csharp":
17+
return csharpScopeSupport;
1518
case "html":
1619
return htmlScopeSupport;
1720
case "java":

packages/cursorless-engine/src/languages/csharp.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ const nodeMatchers: Partial<
141141
Record<SimpleScopeTypeType, NodeMatcherAlternative>
142142
> = {
143143
...getMapMatchers,
144-
ifStatement: "if_statement",
145144
class: "class_declaration",
146145
className: "class_declaration[name]",
147146
condition: cascadingMatcher(

queries/csharp.scm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(if_statement) @ifStatement

0 commit comments

Comments
 (0)