White space problems are very common. Avoiding problems like this is one of the reasons to use a code formatter or beautifier, or pre-commit hooks that remove trailing whitespace.
this post was submitted on 01 Apr 2024
4 points (100.0% liked)
Visual Studio Code
92 readers
1 users here now
Everything VS Code
founded 1 year ago
Cool I’ll look into why my beautifier isn’t working
One thing you can do is look at your code in a hex editor to see what that data is. There are a lot of white space characters that are not 0x20
Does a global replace of \w+$
to nothing count as a beautifier?
There's a setting to trim all trailing whitespace on save so that's how I avoid committing trailing whitespace. It seems to be separate from any beautifier plugins I use, it's under text editor > files > trim trailing whitespace. I also enable trim final newlines and insert final newline which ensures there's only 1 new line at the end of files.
Will check that out, thanks