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

No diff colors in non-English Git commit message #133888

Closed
walles opened this issue Sep 27, 2021 · 7 comments · Fixed by #173195
Closed

No diff colors in non-English Git commit message #133888

walles opened this issue Sep 27, 2021 · 7 comments · Fixed by #173195
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues upstream-issue-pending Issues that are caused by chromium but have not been reported due to pending minimal repro

Comments

@walles
Copy link
Contributor

walles commented Sep 27, 2021

Issue Type: Bug

Here's how VSCode highlights an English commit message template (from git commit -v). Notice how the diff parts are highlighted.
git-commit-english

Here's how VSCode highlights a Swedish commit message template (from git commit -v). Notice how the diff parts are not highlighted.
git-commit-swedish-2

Notes

The instructions in the grammar file says that PRs should be made to upstream here:
https://github.com/textmate/git.tmbundle/blob/master/Syntaxes/Git%20Commit%20Message.tmLanguage

However, that repo has a test suite requiring a Ruby version EOL since 2014 (textmate/git.tmbundle#59), and I failed to run that, so I can't do this.

I also filed this ticket with upstream (textmate/git.tmbundle#59), but the commit message grammar there hasn't been updated since 2016.


VS Code version: Code 1.60.2 (7f6ab54, 2021-09-22T11:59:27.195Z)
OS version: Darwin x64 20.6.0
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz (8 x 2300)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 2
Memory (System) 16.00GB (3.88GB free)
Process Argv --crash-reporter-id 28bd2ba6-eae4-49b2-a5aa-36ae15a789a1
Screen Reader no
VM 0%
Extensions (38)
Extension Author (truncated) Version
troff ban 1.0.22
markdown-preview-github-styles bie 0.2.0
insert-unicode bru 0.13.0
better-toml bun 0.3.2
vscode-eslint dba 2.1.25
bazel-code Dev 0.1.9
shell-format fox 7.1.0
go gol 0.28.1
zentabs hit 0.0.7
blender-development Jac 0.0.16
syntax-project-pbxproj mar 0.1.3
rust-analyzer mat 0.2.760
rainbow-csv mec 1.9.1
HTMLHint mka 0.10.0
language-gettext mro 0.2.0
vscode-docker ms- 1.17.0
python ms- 2021.9.1246542782
vscode-pylance ms- 2021.9.3
jupyter ms- 2021.8.2041215044
jupyter-keymap ms- 1.0.0
cmake-tools ms- 1.8.1
cpptools ms- 1.6.0
gremlins nho 0.26.0
back-n-forth nic 3.1.1
prettier-standard-vscode num 0.8.1
ruby reb 0.28.1
vscode-commons red 0.0.6
vscode-xml red 0.18.0
LiveServer rit 5.6.1
annotator ryu 1.0.0
fish-vscode sky 0.2.1
rewrap stk 1.14.0
rst-vscode tht 3.0.1
shellcheck tim 0.16.2
cmake twx 0.0.17
vscode-lldb vad 1.6.7
vscode-ruby win 0.28.0
clang-format xav 1.9.0
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt639:30300192
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
pythonvsuse255:30340121
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
vsccppwt:30364497
pythonvssor306:30344512
bridge0708:30335490
pygetstartedt2:30371810
dockerwalkthrucf:30370837
bridge0723:30353136
pythonrunftest32:30365366
pythonf5test824cf:30361778
javagetstartedc:30364665
pythonvspyt187cf:30365362
pydsgst2:30361792

@IllusionMH
Copy link
Contributor

I think it's not because of non-English text, bit because it's treated as Go language
image
instead of Git Commit Message
image

Do you see same problem if you change language mode to Git Commit Message manually?

May be related to automatic language detection.
Which was reported as #132696 and should be fixed in 1.60.2 already.

Is this issue reproducible in Insiders version? https://code.visualstudio.com/insiders/
Is it reproducible if you turn off automatic language detection?

/assign TylerLeonhardt

@walles
Copy link
Contributor Author

walles commented Sep 27, 2021

Oops, sorry. Screenshot updated, problem persists.

The grammar has the string Please enter the commit message in 7 different places, as well as one Changes to be committed, so it's not unlikely that this only works for English:
https://github.com/microsoft/vscode/blob/main/extensions/git/syntaxes/git-commit.tmLanguage.json

Try this in Git Commit Message mode and you should see it as well.

What I wish for is for the lines -foo and +bar to be highlighted.


# Ange incheckningsmeddelandet för dina ändringar. Rader som inleds
# med "#" kommer ignoreras, och ett tomt meddelande avbryter incheckningen.
#
# På grenen main
# Ändringar att checka in:
#	ändrad:        hej
#
# ------------------------ >8 ------------------------
# Raden ovan får inte ändras eller tas bort.
# Allt under den kommer tas bort.
diff --git hej hej
index 257cc56..5716ca5 100644
--- hej
+++ hej
@@ -1 +1 @@
-foo
+bar

@TylerLeonhardt
Copy link
Member

@IllusionMH thanks for jumping in!

Based on the previous screenshot it sounded like it was autodetection but with the updated screenshot it appears to be an issue with the textmate grammar. Adding @eamodio and @lszomoru

@lszomoru lszomoru added the scm General SCM compound issues label Sep 28, 2021
@lszomoru lszomoru added bug Issue identified by VS Code Team member as probable bug git GIT issues labels Oct 25, 2021
@lszomoru lszomoru added terminal-external upstream-issue-pending Issues that are caused by chromium but have not been reported due to pending minimal repro and removed scm General SCM compound issues terminal-external labels Dec 9, 2022
@lszomoru
Copy link
Member

lszomoru commented Dec 9, 2022

Closing this as external until textmate/git.tmbundle#60 is addressed.
As soon as this issue is addressed we will pick the latest version of the grammar and resolve the issue.

@lszomoru lszomoru closed this as completed Dec 9, 2022
@walles
Copy link
Contributor Author

walles commented Dec 9, 2022

https://github.com/textmate/git.tmbundle is dead, it was last updated in 2019.

I think it would be better to break the dependency on that dead repo and accept changes directly into the (not dead) vscode repo.

@lszomoru could we:

  • Change the terms here since that other repo is dead?
  • Accept changes directly in here
  • Re-open this ticket?

@lszomoru
Copy link
Member

Adding @alexr00 as she manages the grammar files included in vscode.

@alexr00
Copy link
Member

alexr00 commented Dec 12, 2022

Opened #168847.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 26, 2023
walles added a commit to walles/vscode that referenced this issue Feb 2, 2023
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!
walles added a commit to walles/vscode that referenced this issue Feb 2, 2023
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!
alexr00 added a commit that referenced this issue Feb 7, 2023
* 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 (#133888)
* Highlights touched files both in Swedish and in English

Fixes #133888
Fixes #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 <[email protected]>
c-claeys pushed a commit to c-claeys/vscode that referenced this issue Feb 16, 2023
* 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 <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues upstream-issue-pending Issues that are caused by chromium but have not been reported due to pending minimal repro
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants