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
Unfreeze Git Commit Message grammar II #173195
Unfreeze Git Commit Message grammar II #173195
Conversation
Before this change, the upstream for the VSCode Git grammar was dead. Also, the test setup for that project has been EOL since 2014, so even just running the tests was difficult. The replacement grammar, unlike the current grammar: * Has a vscode-tmgrammar-test test suite that is runnable and passing and that will run in CI for any PRs (in the upstream project) * Has diff highlighting for Swedish as well as English (microsoft#133888) * Highlights touched files both in Swedish and in English Fixes microsoft#133888 Fixes microsoft#168847 Ref: <https://github.com/walles/git-commit-message-plus> And for the record, I was the one setting up the new Git Commit Message project. And it was fun!
2d4317c
to
761a485
Compare
@walles thank you for the PR! Normally I prefer to see that the grammar has some wide use as an extension before adopting it, but given that this grammar is very small I'm fine with merging it anyway once it's ready. I'm seeing a pretty big difference in how the "Changes to be committed" lines are colored (current on the left, yours on the right): Are you able to restore the current behavior? |
}, | ||
{ | ||
"match": ".{73,}$", | ||
"name": "invalid.illegal.line-too-long.git-commit" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you no longer have a line-too-long
scope. Did you intentionally remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that was intentional.
I replaced those scopes with diagnostics and Quick Fixes.
This is what it looks like in the upstream project:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most users won't have your whole extension installed, so having the line-too-long
scope in the syntax highlighting would still be beneficial to them. Would you be willing to bring it back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, just pushed a new change for that: 15defef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
No, I don't think that's possible. The current behavior depends on setting the color based on keywords in English. Since I want this grammar to work for other languages as well (Swedish in particular), I think If you try the current highlighting with a Swedish Git commit template, you can see that the current highlighting just doesn't work, but my new one does:
|
I see your point, thanks for the context. It seems like it should be possible to keep the extra highlighting for English and still provide the good highlighting you've added for all other languages. Would that be possible? |
Retain the line-too-long subject line highlighting. Improved to highlight only the too-long part, but same idea still. Special case English language file operations keywords and retain the previous classification of those. But fallback to op-and-filename classification when that fails (like it will for Swedish git for example).
Yes, just pushed a new change for that: 15defef |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the changes @walles! We usually update grammars via a script, so I've made the updates required to keep that working (and ran the script so that git-commit.tmLanguage.json would be consistent with our other grammar files). I've also updated our test results and the cgmanifest file (which tracks where code came from).
Looks great!
Thank you @alexr00 for the constructive review process, this was a pleasure! |
* Unfreeze Git Commit Message grammar II Before this change, the upstream for the VSCode Git grammar was dead. Also, the test setup for that project has been EOL since 2014, so even just running the tests was difficult. The replacement grammar, unlike the current grammar: * Has a vscode-tmgrammar-test test suite that is runnable and passing and that will run in CI for any PRs (in the upstream project) * Has diff highlighting for Swedish as well as English (microsoft#133888) * Highlights touched files both in Swedish and in English Fixes microsoft#133888 Fixes microsoft#168847 Ref: <https://github.com/walles/git-commit-message-plus> And for the record, I was the one setting up the new Git Commit Message project. And it was fun! * Remedy review feedback Retain the line-too-long subject line highlighting. Improved to highlight only the too-long part, but same idea still. Special case English language file operations keywords and retain the previous classification of those. But fallback to op-and-filename classification when that fails (like it will for Swedish git for example). * Update colorize test result * Update script and cgmanifest --------- Co-authored-by: Alex Ross <alros@microsoft.com>
Before this change, the upstream for the VSCode Git grammar was dead.
Also, the test setup for that project has been EOL since 2014, so even
just running their tests was difficult.
The replacement grammar, unlike the current grammar:
and that will run in CI for any PRs (in the upstream project)
Fixes #133888
Fixes #168847
Ref: https://github.com/walles/git-commit-message-plus
For the record, I was the one setting up the new Git Commit Message project. And it was fun!
After
Sample message to test this yourselves:
Before
Note lack of file names highlighting and diff highlighting.