-
Notifications
You must be signed in to change notification settings - Fork 94
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
Should Insert Final Newline
be on by default?
#1551
Comments
While we may want this behavior for our team, it does seem like a decision customer teams will need to make themselves... and probably best left to the existing default from vscode. |
I am realizing that I actually asked for this already (ill close that one) Interesting that we use this in Positron and amalthea positron/.vscode/settings.json Line 95 in f28cfcd
I do wonder if this has the possibility to pop up for a lot of R developers, since GitHub will also tell you that a final newline is missing with a red symbol, so I think this is a common convention I also think git will complain Lots of good reasons for it here too https://stackoverflow.com/questions/5813311/whats-the-significance-of-the-no-newline-at-end-of-file-log It is also apparently a POSIX standard to end a file with a new line |
Personally I'm all for changing VS Code defaults for this sort of settings that help developer communities converge towards shared conventions, especially when the convention is so well established. It looks like pylint also warns about final newlines missing: http://pylint-messages.wikidot.com/messages:c0304 |
Maybe this isn't the right way to think about it, but I expect adding a trailing newline to be part of the "format on save" action, that is, not a separate VSCode setting but something controlled by a language module or formatter that is triggered by format-on-save. In VSCode, if you have format-on-save enabled, So if anything, I'd wonder if the right question is if format-on-save should be on by default (I'd advocate for it), and making sure we include the right formatters for Python and R and any other languages we want great out-of-the-box support for. |
The POSIX standard requires source files to end with a newline. We wouldn't want to encourage users to violate the POSIX standard, would we? 😉 Also, fun fact: if your |
Considerations:
|
RStudio has this on by default and I think it is very helpful. i.e. I was just editing a
_pkgdown.yml
file and forgot the final new line and saw this when runningpkgdown::build_site()
:There is also this secondary option, which I think I like and will opt into, but I don't think we need to turn it on by default
The text was updated successfully, but these errors were encountered: