Skip to content

set trim_trailing_whitespace to false for inline snapshots#24339

Closed
Glyphack wants to merge 1 commit intoastral-sh:mainfrom
Glyphack:shaygan-editor-config-trailing-whitespace
Closed

set trim_trailing_whitespace to false for inline snapshots#24339
Glyphack wants to merge 1 commit intoastral-sh:mainfrom
Glyphack:shaygan-editor-config-trailing-whitespace

Conversation

@Glyphack
Copy link
Copy Markdown
Contributor

@Glyphack Glyphack commented Mar 31, 2026

Summary

Some files have trailing whitespaces in the source code. I thought this was accidental but then realized it's on purpose because markdown is sensitive to whitespace.

Another solution I found to stop neovim from formatting these files on save is to set trim_trailing_whitespace to false for them. Without this change whenever you save that file any editor that supports EditorConfig it's gonna remove whitespaces and tests would fail.

Test Plan

@Glyphack Glyphack changed the title Exclude files with trailing whitespace in snapshots from trim_trailin… set trim_trailing_whitespace to false for inline snapshots Mar 31, 2026
@MichaReiser MichaReiser added the testing Related to testing Ruff itself label Apr 1, 2026
@MichaReiser
Copy link
Copy Markdown
Member

I think most trailing whitespace comes from the diagnostic rendering. I wonder if we should fix that instead. Let me put codex on this and see if it can come up with a fix. Otherwise, I think this is the right solution because it's super annoying otherwise.

@MichaReiser
Copy link
Copy Markdown
Member

#24343 fixes most trailing whitespaces in code_actions. There's one remaining test that still uses trailing whitespaces after. I think the fix there is to not use inline snapshots for this specific test.

The other trailing whitespaces come from somewhere within our markdown rendering. I think we should take a look at whether those trailing whitespaces are necessary or can be replaced with another character.

@MichaReiser
Copy link
Copy Markdown
Member

I merged a few PRs that:

It should now (once all PRs are merged) no longer be necessary to disable trailing whitespace trimming for those files.

@MichaReiser MichaReiser closed this Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Related to testing Ruff itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants