Skip to content

fix: don't emit empty tail tokens#1121

Merged
alecthomas merged 2 commits intoalecthomas:masterfrom
Gusted:empty-tail-token
Aug 27, 2025
Merged

fix: don't emit empty tail tokens#1121
alecthomas merged 2 commits intoalecthomas:masterfrom
Gusted:empty-tail-token

Conversation

@Gusted
Copy link
Copy Markdown
Contributor

@Gusted Gusted commented Aug 5, 2025

When tokens are split into lines, tokens that end with a newline are emitted again as an empty token, which is confusing and doesn't have any benefit. This conversion shouldn't emit a empty tail token.

Adds a test.

I noticed this issue by a CI failure for the output of a Go program that was changed because of
d0ad679 and the new output contained a empty whitespace token at the beginning of most lines.

When tokens are split into lines, tokens that end with a newline are
emitted again as an empty token, which is confusing and doesn't have any
benefit. This conversion shouldn't emit a empty tail token.

Adds a test.

I noticed this issue by a CI failure for the output of a Go
program that was changed because of
d0ad679 and the new output contained a
empty whitespace token at the beginning of most lines.
@alecthomas
Copy link
Copy Markdown
Owner

Seems reasonable.

@alecthomas
Copy link
Copy Markdown
Owner

The linter is failing FYI.

@Gusted
Copy link
Copy Markdown
Contributor Author

Gusted commented Aug 27, 2025

The linter seems to be failing on code I didn't touch? I can fix it either way.

@alecthomas alecthomas merged commit e9ffd5a into alecthomas:master Aug 27, 2025
2 checks passed
@alecthomas
Copy link
Copy Markdown
Owner

Thanks!

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.

2 participants