Skip to content

Support dprint-ignore for a region #411

Open
@jakebailey

Description

@jakebailey

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 (the describe), but that disables formatting for code I do want formatted. Or, I can wrap the code in a block like:

// dprint-ignore
{
    // Some comemnt
    baselineDisableReferencedProjectLoad(...)
    baselineDisableReferencedProjectLoad(...)
    baselineDisableReferencedProjectLoad(...)
}

But, it would be nice to instead do something like eslint where I can have:

/* dprint-ignore-start */
// my special code
/* dprint-ignore-end */

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions