Skip to content

Commit

Permalink
Odin textobjects (#12302)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Zadrożny <[email protected]>
  • Loading branch information
cornishon and Rheof authored Dec 20, 2024
1 parent 06d0f33 commit a91263d
Show file tree
Hide file tree
Showing 2 changed files with 23 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 @@ -147,7 +147,7 @@
| nunjucks || | | |
| ocaml || || `ocamllsp` |
| ocaml-interface || | | `ocamllsp` |
| odin || || `ols` |
| odin || || `ols` |
| ohm |||| |
| opencl |||| `clangd` |
| openscad || | | `openscad-lsp` |
Expand Down
22 changes: 22 additions & 0 deletions runtime/queries/odin/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(procedure_declaration (identifier) (procedure (block) @function.inside)) @function.around
(procedure_declaration (identifier) (procedure (uninitialized) @function.inside)) @function.around
(overloaded_procedure_declaration (identifier) @function.inside) @function.around

(procedure_type (parameters (parameter (identifier) @parameter.inside) @parameter.around))
(procedure (parameters (parameter (identifier) @parameter.inside) @parameter.around))

((procedure_declaration
(attributes (attribute "@" "(" (identifier) @attr_name ")"))
(identifier) (procedure (block) @test.inside)) @test.around
(#match? @attr_name "test"))

(comment) @comment.inside
(comment)+ @comment.around
(block_comment) @comment.inside
(block_comment)+ @comment.around

(struct_declaration (identifier) "::") @class.around
(enum_declaration (identifier) "::") @class.around
(union_declaration (identifier) "::") @class.around
(bit_field_declaration (identifier) "::") @class.around
(const_declaration (identifier) "::" [(array_type) (distinct_type) (bit_set_type) (pointer_type)]) @class.around

0 comments on commit a91263d

Please sign in to comment.