; Text-object queries for SiSU Spine markup. ; ; Capture conventions follow nvim-treesitter/textobjects: ; @.outer -> select including delimiters / surrounding whitespace ; @.inner -> select content only ; ; Hosts that consume these (Neovim's nvim-treesitter-textobjects, Helix, ; Emacs treesit) bind keys such as `af` / `if` to .outer / .inner. ; ================================================================= ; Headings (sectioning units) ; ================================================================= ; A whole heading line is a "section header" object. Heading sections ; (the heading plus its body content up to the next heading of equal or ; higher level) are not directly expressible in tree-sitter without ; additional grammar work; hosts can synthesise that from these captures. (heading_part) @class.outer (heading_part content: (heading_content) @class.inner) (heading_segment) @class.outer (heading_segment content: (heading_content) @class.inner) ; ================================================================= ; Block elements (code / poem / block / group / table / quote) ; ================================================================= ; Whole block including delimiters; raw_content is the inner. (code_block_curly) @function.outer (code_block_curly content: (raw_content) @function.inner) (code_block_tic) @function.outer (code_block_tic content: (raw_content) @function.inner) (poem_block_curly) @function.outer (poem_block_curly content: (raw_content) @function.inner) (poem_block_tic) @function.outer (poem_block_tic content: (raw_content) @function.inner) (block_block_curly) @function.outer (block_block_curly content: (raw_content) @function.inner) (block_block_tic) @function.outer (block_block_tic content: (raw_content) @function.inner) (group_block_curly) @function.outer (group_block_curly content: (raw_content) @function.inner) (group_block_tic) @function.outer (group_block_tic content: (raw_content) @function.inner) (table_block_curly) @function.outer (table_block_curly content: (raw_content) @function.inner) (table_block_tic) @function.outer (table_block_tic content: (raw_content) @function.inner) (quote_block_tic) @function.outer (quote_block_tic content: (raw_content) @function.inner) (pipe_table) @function.outer ; ================================================================= ; Footnotes and editor notes ; ================================================================= ; Both share the same outer/inner shape; the inner skips the markers and ; closing delimiters. (footnote) @comment.outer (footnote (_)+ @comment.inner) (editor_note) @comment.outer (editor_note (_)+ @comment.inner) ; ================================================================= ; Links and images ; ================================================================= (link) @parameter.outer (link text: (link_text) @parameter.inner) (image) @parameter.outer (image spec: (image_spec) @parameter.inner) ; ================================================================= ; Paragraph / inline-formatting runs ; ================================================================= (paragraph) @block.outer (paragraph (_)+ @block.inner) ; Inline formatting pairs - useful as fine-grained text objects. ; The same delimiter character pattern (e.g. `*{` / `}*`) opens and ; closes each, so .inner is everything between them. (emphasis) @assignment.outer (bold) @assignment.outer (italic) @assignment.outer (underline) @assignment.outer (citation_mark) @assignment.outer (superscript) @assignment.outer (subscript) @assignment.outer (inserted) @assignment.outer (strikethrough) @assignment.outer (monospace_inline) @assignment.outer ; ================================================================= ; Book index entries ; ================================================================= (book_index) @attribute.outer (book_index (index_content) @attribute.inner) ; ================================================================= ; Header fields ; ================================================================= (header_field) @assignment.outer (header_field value: (header_value) @assignment.inner)