Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add final newlines #1327

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

remcohaszing
Copy link
Contributor

This enables the VSCode option files.insertFinalNewline and reformats all files. In most cases this means the final newline is added. In some cases trailing whitespace was stripped as well.

The main reason to prefer inserting a final newline, is because POSIX defines a text file as a file made of lines, where each line ends with a newline character. This includes the final line.

Most tools write final newlines, i.e. npm, tsc. Git and related tools tend to render a missing newline as a sort of warning. This often leads to annoying diffs if the newline is missing.

remcohaszing and others added 2 commits September 25, 2023 12:41
This enables the VSCode option `files.insertFinalNewline` and reformats
all files. In most cases this means the final newline is added. In some
cases trailing whitespace was stripped as well.

The main reason to prefer inserting a final newline, is because POSIX
defines a text file as a file made of lines, where each line ends with a
newline character. This includes the final line.

Most tools write final newlines, i.e. npm, tsc. Git and related tools
tend to render a missing newline as a sort of warning. This often leads
to annoying diffs if the newline is missing.
@dbaeumer
Copy link
Member

dbaeumer commented Oct 3, 2023

Since the VS Code repository uses the same style I am actually in favor doing the same here. However I usually try to avoid merging huge PRs like this since they are hard to review. @remcohaszing How did you do the file changes?

@remcohaszing
Copy link
Contributor Author

I manually added "files.insertFinalNewline": true to .vscode/settings.json. To format all files I used the jbockle.jbockle-format-files VSCode extension.

@dbaeumer
Copy link
Member

dbaeumer commented Oct 9, 2023

I tried it and this formats a lot of other things as well :-(. Need to think about a better solution.

@remcohaszing
Copy link
Contributor Author

Anything in particular you are concerned about?

For me it only generated the changes in this PR, which are just some whitespace changes. If you see any other changes, they must be due to your own personal VSCode settings. I recommend to make those explicit as well.

@dbaeumer
Copy link
Member

It started to format json files. Although these are indeed only white spaces I would like to avoid them.

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