From 6327a5d665e960f30cdde1c50f3f8b5c554836da Mon Sep 17 00:00:00 2001 From: Devzeth <47153906+devzeth@users.noreply.github.com> Date: Thu, 6 Mar 2025 05:14:20 +0100 Subject: [PATCH] docs: Improve documentation of ensure final new line on save (#25960) The function ensure_final_newline in buffer.rs has this explanation: Ensures that the buffer ends with a single newline character, no other whitespace. The documentation wasn't explaining well that we actually remove any lines containing only whitespace and keep only 1 line at the end of a buffer. Release Notes: - N/A --------- Co-authored-by: Peter Tripp Co-authored-by: Danilo Leal --- assets/settings/default.json | 4 ++-- docs/src/configuring-zed.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/settings/default.json b/assets/settings/default.json index f3f3b9abcfcea7c27ebd812e41c622a169e01996..c501aa6d8ea4e7be1cdb193615161780d76a678d 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -720,8 +720,8 @@ "remove_trailing_whitespace_on_save": true, // Whether to start a new line with a comment when a previous line is a comment as well. "extend_comment_on_newline": true, - // Whether or not to ensure there's a single newline at the end of a buffer - // when saving it. + // Removes any lines containing only whitespace at the end of the file and + // ensures just one newline at the end. "ensure_final_newline_on_save": true, // Whether or not to perform a buffer format before saving // diff --git a/docs/src/configuring-zed.md b/docs/src/configuring-zed.md index e1b9d7dc458aebf6843e5757d3a8dd95a79407bb..c3363093d863f39a6ea73425468a3e4f3a5606bc 100644 --- a/docs/src/configuring-zed.md +++ b/docs/src/configuring-zed.md @@ -917,7 +917,7 @@ Each option controls displaying of a particular toolbar element. If all elements ## Ensure Final Newline On Save -- Description: Whether or not to ensure there's a single newline at the end of a buffer when saving it. +- Description: Removes any lines containing only whitespace at the end of the file and ensures just one newline at the end. - Setting: `ensure_final_newline_on_save` - Default: `true`