Skip to content

Commit

Permalink
Some haskell tree-sitter query improvements (#312)
Browse files Browse the repository at this point in the history
- Delete fun and sig queries, as these can be a bit annoying.
- More stable `mid.<x>.<n>` captures.
  The previous ones don't always match, as they can be arbitrarily
  nested.
  • Loading branch information
mrcjkb authored Jul 27, 2023
1 parent 406812f commit 0646093
Showing 1 changed file with 5 additions and 22 deletions.
27 changes: 5 additions & 22 deletions after/queries/haskell/matchup.scm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"case" @open.case (_)
"of" @mid.case.1
(alts
(alt (_) "->" @mid.case.2 (_))
(alt) @mid.case.2
)
) @scope.case

Expand All @@ -19,7 +19,7 @@
(exp_lambda_case
"\case" @open.case
(alts
(alt (_) "->" @mid.case.1 (_))
(alt) @mid.case.1
)
) @scope.case

Expand All @@ -43,10 +43,10 @@
; -------- ADT data/constructors -------------
(adt
"data" @open.adt (_)
"=" @mid.adt.1
(constructors
"|" @mid.adt.2 (data_constructor)
)
(data_constructor
(constructor) @mid.adt.2
))
) @scope.adt

; --------------- ADT record ------------------
Expand Down Expand Up @@ -83,20 +83,3 @@
)
)
) @scope.class


; ------------- type signature ----------------
(signature
(variable) @open.sig
(fun
[ (type_apply)
(type_name)
] @mid.sig.1
)
) @scope.sig

; ------------- function/args -----------------
(function
(variable) @open.fun
(_) @mid.fun.1
) @scope.fun

0 comments on commit 0646093

Please sign in to comment.