zed
zed copied to clipboard
Use standard captures in injection queries
Before this commit, zed was using captures and properties for injection queries that did not match the tree sitter documentation This was breaking the Java extension when it came to its injections.scm, and would likely break other tree-sitter extensions as authors are instructed in the tree-sitter docs to use the standard captures and properties for injection queries.
Changed
The following properties and captures used for injections have changed to be the standard ones. In particular
- @language to @injection.language
- @content to @injection.content
- combined to injection.combined
- language to injection.language
Testing
Unit tests have been updated with the standard captures as well. In particular, cd crates/language && cargo test --lib and cd crates/editor && cargo test --lib both have been updated and pass on my machine.
Release Notes:
- Use standard captures in injection queries (#9656).
We require contributors to sign our Contributor License Agreement, and we don't have @michaelfortunato on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.
@cla-bot check
We require contributors to sign our Contributor License Agreement, and we don't have @michaelfortunato on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.
The cla-bot has been summoned, and re-checked this pull request!
@cla-bot check
The cla-bot has been summoned, and re-checked this pull request!
Yeah, good point @michaelfortunato - no reason to do it differently from the other tree-sitter stuff.
Sounds good. I had to resolve a conflict, I think it'll be able to merge now with your approval @maxbrunsfeld. Also https://github.com/zed-extensions/svelte/blob/main/languages/svelte/injections.scm will have to be updated as well.
Happy to rebase the PR against main if you still want this change. If not I will close the pull request. Thanks
@michaelfortunato Sorry for the delay. We now have extensions, so there are fewer languages to update in this repo, but we need to make the change in a backwards compatible way (accepting both capture names). If you are up for doing that backwards compatibility change, then we are still up for merging this.
As there hasn't been movement on this PR in 3 weeks, I'm going to close it for now. We're still interested in supporting these captures, it should just be backwards compatible with our existing captures :)