Skip to content

Commit

Permalink
Add elm treesitter textobjects (helix-editor#6084)
Browse files Browse the repository at this point in the history
  • Loading branch information
magopian authored and wes-adams committed Jul 3, 2023
1 parent 2eaab42 commit eb26b53
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
2 changes: 1 addition & 1 deletion book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
| eex || | | |
| ejs || | | |
| elixir |||| `elixir-ls` |
| elm || | | `elm-language-server` |
| elm || | | `elm-language-server` |
| elvish || | | `elvish` |
| env || | | |
| erb || | | |
Expand Down
63 changes: 63 additions & 0 deletions runtime/queries/elm/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
(line_comment) @comment.inside
(line_comment)+ @comment.around
(block_comment) @comment.inside
(block_comment)+ @comment.around

((type_annotation)?
(value_declaration
(function_declaration_left (lower_case_identifier))
(eq)
(_) @function.inside
)
) @function.around

(parenthesized_expr
(anonymous_function_expr
(
(arrow)
(_) @function.inside
)
)
) @function.around

(value_declaration
(function_declaration_left
(lower_pattern
(lower_case_identifier) @parameter.inside @parameter.around
)
)
)

(value_declaration
(function_declaration_left
(pattern) @parameter.inside @parameter.around
)
)

(value_declaration
(function_declaration_left
(tuple_pattern
(pattern) @parameter.inside
) @parameter.around
)
)

(value_declaration
(function_declaration_left
(record_pattern
(lower_pattern
(lower_case_identifier) @parameter.inside
)
) @parameter.around
)
)

(parenthesized_expr
(anonymous_function_expr
(
(backslash)
(pattern) @parameter.inside
(arrow)
)
)
)

0 comments on commit eb26b53

Please sign in to comment.