-
Notifications
You must be signed in to change notification settings - Fork 57
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 dprint-ignore for a region #411
Comments
dprint-plugin-markdown also has this for regions. It wouldn't be too difficult to add this. Essentially, detect one of these comments, then increment a count in the context, then format all nodes as ignore until a |
I realized that I sent this to the TS plugin repo unintentionally, but I'm assuming this would be something that would need to be implemented in each plugin separately. |
This is the right place to ask this. It needs to be done per plugin. The CLI to plugin interface is really simple and is essentially just "here's a file path and here's some text, please format it" |
Makes sense! |
I have a piece of code that is formatted to look like a table: https://github.com/microsoft/TypeScript/blob/7910c509c4545517489d6264571bb6c05248fb4a/src/testRunner/unittests/tsserver/projectReferences.ts#L1573
I can
// dprint-ignore
the entire function (thedescribe
), but that disables formatting for code I do want formatted. Or, I can wrap the code in a block like:But, it would be nice to instead do something like eslint where I can have:
I'm not sure how possible that is; it seems like the existing ignore feature puts comments on nodes for a reason, probably because the info is stored in the AST rather than using locations?
Prettier sort of has this for regions: https://prettier.io/docs/en/ignore.html#range-ignore (But, does the same as dprint in that its other ignore comment is AST based)
The text was updated successfully, but these errors were encountered: