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 insert-final-newline config option #8157

Merged
merged 6 commits into from
Sep 12, 2023

Conversation

zqianem
Copy link
Contributor

@zqianem zqianem commented Sep 3, 2023

This resolves #4274 with the implementation largely based off of #5435
and also addresses the review from @the-mikedavis on that PR.

The option name is from EditorConfig's insert_final_newline, which is
also used by VS Code as files.insertFinalNewline.

We match Vim's behavior in that :w will add the newline to unmodified
files but :wa will not; see #1760. Tests are included for this.

Co-authored-by: Xalfer [email protected]

zqianem and others added 2 commits September 3, 2023 11:21
This resolves helix-editor#4274 with the implementation largely based off of helix-editor#5435
and also addresses the review from @the-mikedavis on that PR.

The option name is from EditorConfig's `insert_final_newline`, which is
also used by VS Code as `files.insertFinalNewline`.

We match Vim's behavior in that :w will add the newline to unmodified
files but :wa will not; see helix-editor#1760. Tests are included for this.

Co-authored-by: Xalfer <[email protected]>
Makes the failure message easier to read
More discoverable and consistent with rest of docs and codebase

Co-authored-by: Michael Davis <[email protected]>
@zqianem zqianem force-pushed the insert_final_newline branch from 2d4c59a to 4e7a86c Compare September 3, 2023 17:09
@pascalkuthe pascalkuthe added E-easy Call for participation: Experience needed to fix: Easy / not much S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. A-command Area: Commands C-enhancement Category: Improvements and removed A-command Area: Commands labels Sep 10, 2023
@zqianem zqianem force-pushed the insert_final_newline branch from add769f to 81c69f9 Compare September 10, 2023 23:36
pascalkuthe
pascalkuthe previously approved these changes Sep 10, 2023
@pascalkuthe pascalkuthe added S-waiting-on-review Status: Awaiting review from a maintainer. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 10, 2023
@pascalkuthe pascalkuthe added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from a maintainer. labels Sep 11, 2023
pascalkuthe
pascalkuthe previously approved these changes Sep 11, 2023
@pascalkuthe pascalkuthe added S-waiting-on-review Status: Awaiting review from a maintainer. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 11, 2023
@zqianem
Copy link
Contributor Author

zqianem commented Sep 11, 2023

Oh I forgot to call platform_line for the test fixes which is causing the Windows tests to fail — will remedy that now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Improvements E-easy Call for participation: Experience needed to fix: Easy / not much S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Toggle to enforce a newline at the end of a document
4 participants