this post was submitted on 01 Apr 2024
3 points (80.0% liked)

Visual Studio Code

93 readers
3 users here now

Everything VS Code

founded 2 years ago
MODERATORS
 

I’ve been using vscode for years now and recently I’ve been having this issue where there’s random extra spaces in lines even after html tags are closed. Anyone ever seen this problem before?

Please excuse the code I had to use. I’m building an email.

top 6 comments
sorted by: hot top controversial new old
[–] friend_of_satan 2 points 8 months ago (2 children)

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.

[–] iamericandre 1 points 8 months ago (1 children)

Cool I’ll look into why my beautifier isn’t working

[–] friend_of_satan 2 points 8 months ago

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

[–] owenfromcanada 1 points 8 months ago

Does a global replace of \w+$ to nothing count as a beautifier?

[–] [email protected] 2 points 8 months ago (1 children)

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.

[–] iamericandre 1 points 8 months ago

Will check that out, thanks