Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: How to perform multiple edits of different types #25

Open
sandersantema opened this issue Mar 1, 2024 · 0 comments
Open

Comments

@sandersantema
Copy link

I'd like to perform multiple edits of different types but I couldn't figure out what's supposed to be the idiomatic way to create an Editor which provides multiple edits as all implementations of it have the in_order_edits function return iter::once.
This is assuming that an editor should even perform multiple edits and it should be done using the tree-sitter-edit api.

I've tried another approach using the tree-sitter rust bindings api to reparse the tree after each edit but couldn't get this to work, besides seeing as in_order_edits is plural I'd think it should be possible using tree-sitter-edit only without having to reparse the tree.

Some extra info about my usecase fyi, but irrelevant to the question really:
Looking through your repos for any example usage I came across marki. Accidentally I'm trying to use your library for the same purpose, albeit a bit different, namely bidirectionally converting latex files to anki notes. To do so, I for instance have to replace my custom latex cloze environment \begin{cloze}[<number>] ... \end{cloze} with anki's cloze syntax and other such changes, the bulk of which is to convert valid latex to valid mathjax and vice versa. I've got a really finicky hand written parser for this working but I'd like to replace it with edits based on treesitter queries, so that other people could use it with their own custom latex/ mathjax macros and for general reliability/ extensibility.

Hopefully you don't mind me opening an issue to ask a question.

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

No branches or pull requests

1 participant