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]>
@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
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.

@the-mikedavis the-mikedavis merged commit 7090555 into helix-editor:master Sep 12, 2023
6 checks passed
dgkf pushed a commit to dgkf/helix that referenced this pull request Jan 30, 2024
mtoohey31 pushed a commit to mtoohey31/helix that referenced this pull request Jun 2, 2024
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
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