Skip to content

feat(typst): add textobjects#867

Open
anonymousgrasshopper wants to merge 2 commits intonvim-treesitter:mainfrom
anonymousgrasshopper:feat/typst
Open

feat(typst): add textobjects#867
anonymousgrasshopper wants to merge 2 commits intonvim-treesitter:mainfrom
anonymousgrasshopper:feat/typst

Conversation

@anonymousgrasshopper
Copy link
Contributor

This PR adds textobjects for typst.

All textobjects have been added, besides @attribute.*, @class.*, @frame.* and @comment.inner.

There is a tiny issue with @function.inner: typst lambdas can either contain a block as their value or not, e.g.

it => it

and

it => {
    // do stuff ...
}

are both valid, but @function.inner shouldn't match the braces in the second case (at least according to what is done for other languages). However, currently I match both with and without braces in the second case (instead of only without).

It's my first time writing nontrivial tree-sitter queries, I haven't tested everything thoroughly, and I probably don't know all the syntax features of typst, so there might be some errors or omissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant