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

Git Commit Message Wraps lines at 50 characters instead of 72 #395

Open
theory opened this issue Mar 5, 2024 · 4 comments
Open

Git Commit Message Wraps lines at 50 characters instead of 72 #395

theory opened this issue Mar 5, 2024 · 4 comments

Comments

@theory
Copy link

theory commented Mar 5, 2024

[Moving from microsoft/vscode#206480]

Since at least VScode v1.86.1, Git Commit Message mode has two wrap columns: 50 characters for the subject line (the first lone line of the buffer), and 72 characters for the body (all other lines). When using rewrap, it wraps body lines at 50 characters instead of 72. This GIF illustrates the issue:

309910186-f1226575-335f-4b55-8681-6955655820ca

I presume this is because the 50 character wrap column comes first, so is the default choice for rewrap. But the 72 wrap column is the more important one for Git commit messages, since the subject line is only a single line, but the body can be quite long.

VS Code version: Code 1.87.0 (Universal) (019f4d1419fbc8219a181fab7892ebccf7ee29a2, 2024-02-27T23:42:56.944Z)
OS version: Darwin arm64 23.3.0

@theory
Copy link
Author

theory commented Mar 26, 2024

I was able to work around this issue by making the 50 character ruler secondary with this config:

  "[git-commit]": {
    "editor.rulers": [72, 50],
    "editor.wordWrap": "on"
  },

The default is "editor.rulers": [50, 72],; I guess rewrap relies on the first ruler setting, which makes sense.

@jmhodges
Copy link

Would love for rewrap to handle this itself! Def hit me for a while before I realized this was the problem and even then spent a lot of time googling to realize it was the commit title vs summary.

Or maybe we (I?) should make a ticket against vscode for the ruler length swap?

@jmhodges
Copy link

jmhodges commented May 28, 2024

Oh, you know, that workaround isn't consistent. If you tell Rewrap to run when the line is between 50 and 72 characters, it wraps at the 50 character limit. It only wraps at the 72 character limit when the line is longer then 72 characters.

I suspect Rewrap will have to learn a bit more about what mode its in? I know that's a gross hack, but I'm not sure what else to do

Or just always pick the longest?

@theory
Copy link
Author

theory commented May 30, 2024

Would be nice if the VSCode rulers had an API to tell you which context you were in…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants