-
Notifications
You must be signed in to change notification settings - Fork 8
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
Detect Git commit summaries not following the 50/72 rule #46
Comments
That's wonderful! 🎉 I currently use tamelion/neovim-molokai as my primary color scheme. |
Could there be some way to opt out of this? I always soft line wrap my Git commits, and never hard wrap. Having some arbitrary line length for the subject and summary, that can't be changed, feels overly restrictive. [EDIT] I managed to remove the warning colors with the following command, but I think some official option would be better.
|
Hey @stevenxxiu , thanks for your feedback, I wasn't aware of this change in treesitter 😅 |
Thanks, but do you think you could add an option to actually configure this, instead of hard coding it? My way to opt-out seems more like a hack more than anything. |
I'm also looking for a way to disable this. I'm not knowledgeable about treesitter, but the
|
Hello,
I hope that I answer all your questions 😅 |
What about a configurable length? Line lengths, wrap lengths, ruler positions, etc. are always configurable. This is the first time I've seen something that's not. |
Feel free to open a pull request if you find a way to do it 😉 |
After I fiddled with this, I found that just adding a highlight link to EDIT: Another way to try and make sure the highlight sticks is to put it in My problem with overriding Judging by what I've seen so far in other cases, treesitter is pretty much impossible to configure on the user side (the answer in each case seems to be "write your own queries file from scratch"), so I doubt it's possible to add configurable length in this case. I'm disappointed in general in Neovim's seeming insistence to force the 50/72 rule on everyone without any configuration options, both in the default syntax plugin and now in treesitter plugin. Imagine if Nvim decided that |
I understand your point. I don't know if we should highlight overflow in commit body by default but maybe you can open a issue (or a pull request) on nvim-treesitter project to start a discussion about that. |
IMO the overflow detection shouldn't be in this repo at all, if its length cannot be configured, or if it cannot be turned off. This belongs in another plugin, not in a syntax parser. |
I've asked the reddit community about that : https://www.reddit.com/r/neovim/comments/1cm5zir/question_should_i_commit_summaries_not_following/ |
I don't have a Reddit account, and I don't think it's worth creating one just for that discussion. But I can roll out my arguments here, for your consideration. 😃 I don't want to come off as someone who just hates the 50/72 convention for no reason. I'm indifferent to it. But I also work with projects where no one heard of that rule, and the commits are expected to be formatted in a certain way that's incompatible with it. Nobody is going to overhaul a projects conventions because someone on the other side of the net decided that 50/72 is just the best. Saying that all tools adhere to 50/72 because Github does is very myopic. Perhaps the strongest argument I've seen is that the pre-treesitter syntax script also has this overflow highlight behaviour, so doing it in treesitter is just keeping backwards compatibility. I think it's the only reason why anyone proposed that a syntax highlighter should be concerned with style errors, because as you and others have noted, that's not what's normally expected at all. My counter arguments would be:
|
One aspect of the standard
gitcommit
syntax highlighting present in Vim and Neovim that I particularly love is that it includes built-in rules that follow the 50/72 rule of writing Git commit messages. That is:...
, and overflow the rest into the commit message body, and you should definitely shorten it if you'd like your summary to remain intact.This is helpful for folks writing commit messages who are looking to keep them nice. For reference, an example of such assistive highlighting in Neovim (using the standard
gitcommit.vim
syntax) is shown below:On the other hand, this is how
tree-sitter-gitcommit
(installed vianvim-treesittter
on my machine) highlights the same commit message:It'd be great if this TS parser could apply similar syntax rules as those used in Vim/Neovim to detect poorly formed commit messages as they're being written, enabling editor color schemes to highlight these malformed sections accordingly. Thanks for maintaining this great open source parser!
The text was updated successfully, but these errors were encountered: