Skip to content

Commit

Permalink
feat(enforce): add enforce support
Browse files Browse the repository at this point in the history
  • Loading branch information
simonvic authored and lewis6991 committed Feb 17, 2025
1 parent c331ac7 commit f96a946
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
23 changes: 23 additions & 0 deletions queries/enforce/context.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(if
(block) @context.end) @context

(decl_method
body: (_) @context.end) @context

(for
body: (_) @context.end) @context

(foreach
body: (_) @context.end) @context

(decl_class
body: (_) @context.end) @context

(decl_enum
body: (_) @context.end) @context

(switch
body: (_) @context.end) @context

(switch_case
label: (_) @context.end) @context
40 changes: 40 additions & 0 deletions test/lang/test.enforce
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// {{TEST}}

class Foo { // {{CONTEXT}}


void Foo() { // {{CONTEXT}}

// {{CURSOR}}

}

void foo() { // {{CONTEXT}}

if (true) { // {{CONTEXT}}

switch (foo) { // {{CONTEXT}}

case "foo": // {{CONTEXT}}

// {{CURSOR}}

break;

}

}

{ // {{CONTEXT}}

// {{CURSOR}}

}
}
}

enum Foo { // {{CONTEXT}}

// {{CURSOR}}

}

0 comments on commit f96a946

Please sign in to comment.