Skip to content

Commit

Permalink
Incremental improvement to granular disabling directive.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 666695192
  • Loading branch information
txtpbfmt-copybara-robot committed Aug 23, 2024
1 parent e3b1504 commit 8e6b51f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,8 @@ func (p *parser) readFormatterDisabledBlock() (string, error) {
if !p.consume('\n') {
return "", fmt.Errorf("txtpbfmt on should be followed by newline at %s", p.errorContext())
}
// Retain up to one blank line.
p.consume('\n')
return string(p.in[start:p.index]), nil
}
}
Expand Down
3 changes: 3 additions & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,8 @@ bar {
}
enabled: {TEMPLATE_plx}
# txtpbfmt: on
}
should_format {
foo: "bar"
Expand All @@ -1502,6 +1504,7 @@ bar {
}
enabled: {TEMPLATE_plx}
# txtpbfmt: on
}
should_format {
foo: "bar"
Expand Down

0 comments on commit 8e6b51f

Please sign in to comment.