Closed GDYendell closed 6 months ago
The blank lines were removed because of the default VSCode formatting setting, I wonder if this still happens in a fresh profile?
I've just opened this branch in a "vanilla" vscode (with no extensions).
The only files it formats by default are json and html. Both of these did remove the new line at end of file.
This is a bit of a pain as the unix (and git) convention is to have a new line at the end of file so I'm not really sure what it best to do.
I guess if every formatter could be configured differently it might be an issue
This issue https://github.com/microsoft/vscode/issues/176246 suggests that the json formatter will respect files.insertFinalNewline
- I wonder if all formatters do. If so that could be added to the workspace settings.
There is also end-of-file-fixer
in pre-commit that could be added.
Just to note that after running end-of-file-fixer
on the HEAD of this PR there are actually quite a few other files in the project with no new line at EOF.
@joeshannon if you put files.insertFinalNewline
in .vscode/setting.json
does it respect it?
@joeshannon if you put
files.insertFinalNewline
in.vscode/setting.json
does it respect it?
Yes it does
Ok, so happy to accept this PR if we add that line in. Could also add the end-of-file-fixer
while we're at it to make sure all files abide by this
@joeshannon if you put
files.insertFinalNewline
in.vscode/setting.json
does it respect it?Yes it does
Just to follow up: for "Format Document" it did take affect for the html formatting but didn't seem to for json, however it did change the behaviour to add the new line when saving the json file.
Thanks @joeshannon that looks good!
I'm happy with it.
Hmm, we now get a failure: https://github.com/DiamondLightSource/python-copier-template-example/actions/runs/9099023019/job/25010615685
Please can someone put in a PR to delete the extra lines at the end of README.jinja and Dockerfile.jinja?
Actually, I'll do this