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

Support auto-format for tree-sitter injections #13243

Open
nik-rev opened this issue Mar 31, 2025 · 0 comments
Open

Support auto-format for tree-sitter injections #13243

nik-rev opened this issue Mar 31, 2025 · 0 comments
Labels
C-enhancement Category: Improvements

Comments

@nik-rev
Copy link
Contributor

nik-rev commented Mar 31, 2025

Currently, when automatically formatting files with auto-format tree-sitter injections are not formatted.
It would be useful to have this feature primarily for working with markdown (and similar markup languages) where we can have many code blocks

Right now if you want to format those code blocks you have to use :pipe rustfmt for instance. Having auto-formatting for them would be quite useful.

as pointed out in #9425 (comment) this may not be possible to implement or very hard:

not quite sure if this is even feasible. For combined injections the formatter may only be able to handle the full combined text as valid syntax but it's hard/impossible to map that back to the original ranges.

It would also take a lot of.reaources as we would habe tu run O(N*maxdepth) parses + queries and formatter invocations

if implemented it should be opt-in (such as having format-injections options per-language and globally)

@nik-rev nik-rev added the C-enhancement Category: Improvements label Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

1 participant