zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.91k stars 2.69k forks source link

Extension API for extending language queries #16861

Open XiNiHa opened 2 weeks ago

XiNiHa commented 2 weeks ago

Check for existing issues

Describe the feature

Currently, extensions can't extend language queries of existing languages. Since things like providing custom injections and highlights are only possible by writing language queries, this limits extensions to implement some critical features, like providing an embedded language injection pattern, resulting in manually adding them one by one to the upstream. While it looks like overriding them is possible, that is not scalable and is likely to clash if multiple extensions try to override the same language. A stabilized interface to merge additions from extensions would be very helpful here.

Continued from #5184

If applicable, add mockups / screenshots to help present your vision of the feature

No response

lougreenwood commented 2 weeks ago

@XiNiHa

I just opened a discussion on a similar topic... IMO the way that exensions handle tree sitter queries seems messy and counter to Tree Sitter's implicit recommendation that grammar and queries are defined together in a single project.

https://github.com/zed-industries/zed/discussions/16860