Skip to content

Commit

Permalink
Migrate c sharp if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
pokey committed May 8, 2024
1 parent 991fc6d commit 53dd73a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
10 changes: 10 additions & 0 deletions data/fixtures/scopes/csharp/ifStatement.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if (true) { }
---

[Content] =
[Removal] =
[Domain] = 0:0-0:13
>-------------<
0| if (true) { }

[Insertion delimiter] = "\n"
13 changes: 13 additions & 0 deletions packages/common/src/scopeSupportFacets/csharp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable @typescript-eslint/naming-convention */

import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

export const csharpScopeSupport: LanguageScopeSupportFacetMap = {
ifStatement: supported,
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { javaScopeSupport } from "./java";
import { javascriptScopeSupport } from "./javascript";
import { jsonScopeSupport } from "./json";
import { pythonScopeSupport } from "./python";
import { csharpScopeSupport } from "./csharp";
import { luaScopeSupport } from "./lua";
import { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { talonScopeSupport } from "./talon";
Expand All @@ -12,6 +13,8 @@ export function getLanguageScopeSupport(
languageId: string,
): LanguageScopeSupportFacetMap {
switch (languageId) {
case "csharp":
return csharpScopeSupport;
case "html":
return htmlScopeSupport;
case "java":
Expand Down
1 change: 0 additions & 1 deletion packages/cursorless-engine/src/languages/csharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ const nodeMatchers: Partial<
Record<SimpleScopeTypeType, NodeMatcherAlternative>
> = {
...getMapMatchers,
ifStatement: "if_statement",
class: "class_declaration",
className: "class_declaration[name]",
condition: cascadingMatcher(
Expand Down
1 change: 1 addition & 0 deletions queries/csharp.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(if_statement) @ifStatement

0 comments on commit 53dd73a

Please sign in to comment.