Skip to content

Commit

Permalink
Fix granular formatting disable to allow for preceding blank lines.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 665341867
  • Loading branch information
txtpbfmt-copybara-robot committed Aug 20, 2024
1 parent 0a5c94e commit 2549276
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 7 deletions.
5 changes: 0 additions & 5 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -844,12 +844,7 @@ func (p *parser) readContinuousBlocksOfComments() []string {
// within this block, and as parsing errors will be ignored, please exercise caution.
func (p *parser) readFormatterDisabledBlock() (string, error) {
start := p.index
for p.consume('\n') {
// Consume blank lines.
}
if !p.consumeString("# txtpbfmt: off") {
// Directive not found. Rollback to start.
p.index = start
return "", nil
}
if !p.consume('\n') {
Expand Down
2 changes: 0 additions & 2 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,6 @@ bar {
should_format {
foo: "bar"
}
# txtpbfmt: off
no_format { foo: "bar" } # txtpbfmt: on
should_format {
Expand All @@ -1500,7 +1499,6 @@ bar {
should_format {
foo: "bar"
}
# txtpbfmt: off
no_format { foo: "bar" } # txtpbfmt: on
should_format {
Expand Down

0 comments on commit 2549276

Please sign in to comment.