-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Rewrap not working on git commits #24987
Comments
I want to fix this if possible! But I can't find what part of the code controls or influences whether a give language will rewrap properly or not. I can find this directory that defines the Git Commit language, that was merged just 2 weeks ago in #24274 (ping @SomeoneToIgnore maybe? Sorry if that's not appropriate), and I see it uses a tree sitter grammar from here. And I think that rewrap is implemented here. But, I'm not sure how to investigate this issue further. |
Sorry, I have no clue on how rewrap in Zed works and why language selection might influence that.
That place is quite deep into the impl and might not be the culprit. zed/crates/editor/src/editor.rs Line 7605 in b5d85b6
and debug that further and see why things are not working for this case. |
I found this language-specific setting: zed/crates/language/src/language_settings.rs Lines 79 to 81 in 08e9080
The docs say it's wired to soft wrap but it ideally would be wired to the rewrap too, I guess. |
#25173 seems very related. |
@maxdeviant shouldn't that be the default? |
Indeed
It seems that Git Commit should also enable "anywhere" by default, using the same rationale as "Plain Text" and "Markdown" |
Summary
Rewrap doesn't work if the language is set to Git Commit.
Steps to trigger the problem:
Open a git commit (typically by running something like
GIT_EDITOR='zeditor -w' git commit --amend
)Run the command
editor::Rewrap
(typically by Pressingctrl+k q
orctrl+k ctrl+q
)See that lines don't rewrap. (Some styles enforce a maximum line width on git commits, a common value is 72 chars)
In despair, change the language with
Ctrl+K M
(language_selector::Toggle
) and select "Plain Text". Now the text rewraps fine (albeit at 80 lines - I can't find a way to configure line widths per-language, which is a separate issue but relatively minor)Actual Behavior:
Lines don't rewrap with the language is "Git Commit"
Expected Behavior:
Lines should rewrap for git commits. A bonus feature is to make 72 chars the default for git commits specifically (but let the user configure)
Zed Version and System Specs
Zed: v0.173.9 (Zed)
OS: Linux X11 arch unknown
Memory: 18.9 GiB
Architecture: x86_64
GPU: AMD Radeon Graphics (RADV RENOIR) || radv || Mesa 24.3.4-arch1.1
The text was updated successfully, but these errors were encountered: