Skip to content

feat(format): leave a statement alone with -- maxdop-ignore - #38

Merged
pagebrooks merged 1 commit into
mainfrom
feature/pb/ignore-directive
Nov 10, 2026
Merged

pagebrooks merged 1 commit into
mainfrom
feature/pb/ignore-directive

Conversation

@pagebrooks

Copy link
Copy Markdown
Owner

exclude costs a whole file its formatting and the baseline stops forgiving on the first edit, so there was no way to protect one hand-aligned INSERT ... VALUES grid or CASE ladder. An own-line -- maxdop-ignore (or /* maxdop-ignore */, optionally followed by a reason) now passes the next statement through verbatim, and the rest of the file formats as usual.

The directive is found in the trivia directly above the statement rather than in its attached comments, because a comment above a batch's first statement can be attached to the batch. Ignored statements keep their layout relative to their own first line, so inside a re-indented block they move as a unit; the existing passthrough re-indent would have pulled an aligned grid back to the margin. Next-statement scope only, as Prettier does.

exclude costs a whole file its formatting and the baseline stops
forgiving on the first edit, so there was no way to protect one
hand-aligned INSERT ... VALUES grid or CASE ladder. An own-line
`-- maxdop-ignore` (or `/* maxdop-ignore */`, optionally followed by
a reason) now passes the next statement through verbatim, and the
rest of the file formats as usual.

The directive is found in the trivia directly above the statement
rather than in its attached comments, because a comment above a
batch's first statement can be attached to the batch. Ignored
statements keep their layout relative to their own first line, so
inside a re-indented block they move as a unit; the existing
passthrough re-indent would have pulled an aligned grid back to the
margin. Next-statement scope only, as Prettier does.
@pagebrooks
pagebrooks merged commit 15f3b5c into main Nov 10, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant