From 7132b67962e2827f73f8486793ab5d5dcee53862 Mon Sep 17 00:00:00 2001 From: Justin Su Date: Tue, 10 Mar 2026 15:41:24 -0400 Subject: [PATCH] Normalize `line_comments` strings to have a trailing space (#51033) I did a search for `/^line_comments = .*[^\s\[]"/` to identify these 3 languages: - Git Commit - Go Mod - Go Work that don't add/remove a trailing space for inline comments. I couldn't find any indication that the absence of the trailing space is due to any peculiarity of these languages. --- For Git Commit, I should note that (strictly speaking) the comment character is a single `#` without a trailing space, as Git removes any line starting with the default comment character (`#`) (see https://git-scm.com/docs/git-config#Documentation/git-config.txt-corecommentChar). But I believe this change only affects whether `editor::ToggleComments` adds/removes the space, and not how the file is syntax highlighted. So for aesthetics and consistency, it should be better to add/remove the trailing space. --- Before you mark this PR as ready for review, make sure that you have: - [ ] Added a solid test coverage and/or screenshots from doing manual testing - [ ] Done a self-review taking into account security and performance aspects - [ ] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Release Notes: - Add/remove a space when toggling inline comments in Git Commit and Go Mod/Work languages --- crates/languages/src/gitcommit/config.toml | 2 +- crates/languages/src/gomod/config.toml | 2 +- crates/languages/src/gowork/config.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/languages/src/gitcommit/config.toml b/crates/languages/src/gitcommit/config.toml index c2421ce00613e5848aacab5d1230ab839c8b1388..83cd6f550e3f18c5d8cb61efa4d632ece6c1ad4d 100644 --- a/crates/languages/src/gitcommit/config.toml +++ b/crates/languages/src/gitcommit/config.toml @@ -7,7 +7,7 @@ path_suffixes = [ "NOTES_EDITMSG", "EDIT_DESCRIPTION", ] -line_comments = ["#"] +line_comments = ["# "] brackets = [ { start = "(", end = ")", close = true, newline = false }, { start = "`", end = "`", close = true, newline = false }, diff --git a/crates/languages/src/gomod/config.toml b/crates/languages/src/gomod/config.toml index e70c9358bfc6f467b69897fa6d20dd9ae0082f9a..d151db961106591c07850034f669304db7edb650 100644 --- a/crates/languages/src/gomod/config.toml +++ b/crates/languages/src/gomod/config.toml @@ -2,7 +2,7 @@ name = "Go Mod" code_fence_block_name = "go.mod" grammar = "gomod" path_suffixes = ["mod"] -line_comments = ["//"] +line_comments = ["// "] autoclose_before = ")" brackets = [ { start = "(", end = ")", close = true, newline = true} diff --git a/crates/languages/src/gowork/config.toml b/crates/languages/src/gowork/config.toml index 68beb073ab64df4761bf3f87a88f28a0608656f7..90e62f0cf102306b258e9efd56bb9ae9838f0f27 100644 --- a/crates/languages/src/gowork/config.toml +++ b/crates/languages/src/gowork/config.toml @@ -2,7 +2,7 @@ name = "Go Work" code_fence_block_name = "gowork" grammar = "gowork" path_suffixes = ["work"] -line_comments = ["//"] +line_comments = ["// "] autoclose_before = ")" brackets = [ { start = "(", end = ")", close = true, newline = true}