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

fix(treesitter): make vim.treesitter.stop() detach parser #29530

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zeertzjq
Copy link
Member

@zeertzjq zeertzjq commented Jul 1, 2024

Fix #29506

@clason
Copy link
Member

clason commented Jul 1, 2024

This will affect non-highlighting users of treesitter parsers, which vim.treesitter.{start,stop} until now did not (directly) affect.

I think this might be an opportunity to talk about how we want this API to look long-term. In this case, I would prefer that destroying a parser is controlled by an optional keyword (default tbd). @lewis6991 ?

@lewis6991
Copy link
Member

We probably need some kind of registration mechanism so each application can keep a parser alive if it needs it.

The simplest method would be to require each application to hold a reference to the parser, and the internal table can be changed to hold weak references. That'll cause the parser to be automatically destroyed when necessary.

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

Successfully merging this pull request may close these issues.

Unexpected active the treesitter parser
3 participants
-