diff --git a/extensions/git-base/build/update-grammars.js b/extensions/git-base/build/update-grammars.js index ad326bff374..429456cf4ea 100644 --- a/extensions/git-base/build/update-grammars.js +++ b/extensions/git-base/build/update-grammars.js @@ -6,5 +6,5 @@ var updateGrammar = require('vscode-grammar-updater'); -updateGrammar.update('textmate/git.tmbundle', 'Syntaxes/Git%20Commit%20Message.tmLanguage', './syntaxes/git-commit.tmLanguage.json'); +updateGrammar.update('walles/git-commit-message-plus', 'syntaxes/git-commit.tmLanguage.json', './syntaxes/git-commit.tmLanguage.json', undefined, 'main'); updateGrammar.update('textmate/git.tmbundle', 'Syntaxes/Git%20Rebase%20Message.tmLanguage', './syntaxes/git-rebase.tmLanguage.json'); diff --git a/extensions/git-base/cgmanifest.json b/extensions/git-base/cgmanifest.json index a3786f7edce..e33513606ce 100644 --- a/extensions/git-base/cgmanifest.json +++ b/extensions/git-base/cgmanifest.json @@ -33,7 +33,42 @@ ], "license": "MIT", "version": "0.0.0" + }, + { + "component": { + "type": "git", + "git": { + "name": "walles/git-commit-message-plus", + "repositoryUrl": "https://github.com/walles/git-commit-message-plus", + "commitHash": "35a079dea5a91b087021b40c01a6bb4eb0337a87" + } + }, + "licenseDetail": [ + "Copyright (c) 2023 Johan Walles ", + "", + "Permission is hereby granted, free of charge, to any person obtaining", + "a copy of this software and associated documentation files (the\"", + "Software\"), to deal in the Software without restriction, including", + "without limitation the rights to use, copy, modify, merge, publish,", + "distribute, sublicense, and/or sell copies of the Software, and to", + "permit persons to whom the Software is furnished to do so, subject to", + "the following conditions:", + "", + "The above copyright notice and this permission notice shall be", + "included in all copies or substantial portions of the Software.", + "", + "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,", + "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF", + "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND", + "NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE", + "LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION", + "OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION", + "WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." + ], + "license": "MIT", + "version": "1.0.0", + "description": "The original JSON grammars were derived from https://github.com/microsoft/vscode/blob/e95c74c4c7af876e79ec58df262464467c06df28/extensions/git-base/syntaxes/git-commit.tmLanguage.json. That file was originally copied from https://github.com/textmate/git.tmbundle." } ], "version": 1 -} \ No newline at end of file +} diff --git a/extensions/git-base/syntaxes/git-commit.tmLanguage.json b/extensions/git-base/syntaxes/git-commit.tmLanguage.json index c2b8d628ab0..e9252a51410 100644 --- a/extensions/git-base/syntaxes/git-commit.tmLanguage.json +++ b/extensions/git-base/syntaxes/git-commit.tmLanguage.json @@ -1,141 +1,90 @@ { "information_for_contributors": [ - "This file has been converted from https://github.com/textmate/git.tmbundle/blob/master/Syntaxes/Git%20Commit%20Message.tmLanguage", + "This file has been converted from https://github.com/walles/git-commit-message-plus/blob/master/syntaxes/git-commit.tmLanguage.json", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/textmate/git.tmbundle/commit/93897a78c6e52bef13dadc0d4091d203c5facb40", + "version": "https://github.com/walles/git-commit-message-plus/commit/35a079dea5a91b087021b40c01a6bb4eb0337a87", "name": "Git Commit Message", "scopeName": "text.git-commit", "patterns": [ { - "begin": "\\A(?!# Please enter the commit message)", - "end": "^(?=# Please enter the commit message)", - "name": "meta.scope.message.git-commit", + "comment": "diff presented at the end of the commit message when using commit -v.", + "name": "meta.embedded.diff.git-commit", + "contentName": "source.diff", + "begin": "(?=^diff\\ \\-\\-git)", + "end": "\\z", "patterns": [ { - "begin": "\\A(?=#)", - "end": "^(?!#)", - "patterns": [ - { - "include": "#comment" - } - ] - }, - { - "begin": "^(?!# Please enter the commit message)", - "end": "^(?=# Please enter the commit message)", - "patterns": [ - { - "begin": "\\G", - "end": "^(?!\\G)", - "name": "meta.scope.subject.git-commit", - "patterns": [ - { - "captures": { - "1": { - "name": "keyword.other.$2.git-commit" - } - }, - "match": "\\G((fixup|squash)!)\\s*" - }, - { - "match": ".{73,}$", - "name": "invalid.illegal.line-too-long.git-commit" - }, - { - "match": ".{51,}$", - "name": "invalid.deprecated.line-too-long.git-commit" - } - ] - }, - { - "begin": "^(?!# Please enter the commit message)", - "end": "^(?=# Please enter the commit message)", - "patterns": [ - { - "include": "#comment" - } - ] - } - ] + "include": "source.diff" } ] }, { - "begin": "^(?=# Please enter the commit message)", - "end": "\\z", - "name": "meta.scope.metadata.git-commit", + "comment": "User supplied message", + "name": "meta.scope.message.git-commit", + "begin": "^(?!#)", + "end": "^(?=#)", "patterns": [ { - "include": "#metadata" + "comment": "Mark > 50 lines as deprecated, > 72 as illegal", + "name": "meta.scope.subject.git-commit", + "match": "\\G.{0,50}(.{0,22}(.*))$", + "captures": { + "1": { + "name": "invalid.deprecated.line-too-long.git-commit" + }, + "2": { + "name": "invalid.illegal.line-too-long.git-commit" + } + } } ] - } - ], - "repository": { - "comment": { - "begin": "^(#)", - "captures": { - "1": { - "name": "punctuation.definition.comment.git-commit" - } - }, - "end": "\\n", - "name": "comment.line.number-sign.git-commit" }, - "metadata": { + { + "comment": "Git supplied metadata in a number of lines starting with #", + "name": "meta.scope.metadata.git-commit", + "begin": "^(?=#)", + "contentName": "comment.line.number-sign.git-commit", + "end": "^(?!#)", "patterns": [ { - "begin": "(?=^# Changes to be committed:)", - "end": "(?!\\G)((?=^# \\w)|(?!^#))", - "patterns": [ - { - "begin": "(^[ \\t]+)?(?=#)", - "beginCaptures": { - "1": { - "name": "punctuation.whitespace.comment.leading.git-commit" - } - }, - "contentName": "comment.line.number-sign.git-commit", - "end": "(?!\\G)^", - "patterns": [ - { - "match": "\\G#", - "name": "punctuation.definition.comment.git-commit" - }, - { - "match": "((modified|renamed):.*)$\\n?", - "name": "markup.changed.git-commit" - }, - { - "match": "(new file:.*)$\\n?", - "name": "markup.inserted.git-commit" - }, - { - "match": "(deleted:.*)$\\n?", - "name": "markup.deleted.git-commit" - } - ] + "match": "^#\\t((modified|renamed):.*)$", + "captures": { + "1": { + "name": "markup.changed.git-commit" } - ] + } }, { - "include": "#comment" + "match": "^#\\t(new file:.*)$", + "captures": { + "1": { + "name": "markup.inserted.git-commit" + } + } }, { - "begin": "(?=diff\\ \\-\\-git)", - "comment": "diff presented at the end of the commit message when using commit -v.", - "contentName": "source.diff", - "end": "\\z", - "name": "meta.embedded.diff.git-commit", - "patterns": [ - { - "include": "source.diff" + "match": "^#\\t(deleted.*)$", + "captures": { + "1": { + "name": "markup.deleted.git-commit" } - ] + } + }, + { + "comment": "Fallback for non-English git commit template", + "match": "^#\\t([^:]+): *(.*)$", + "captures": { + "1": { + "name": "keyword.other.file-type.git-commit" + }, + "2": { + "name": "string.unquoted.filename.git-commit" + } + } } ] } - } + ] } \ No newline at end of file diff --git a/extensions/vscode-colorize-tests/test/colorize-results/COMMIT_EDITMSG.json b/extensions/vscode-colorize-tests/test/colorize-results/COMMIT_EDITMSG.json index d730dac8fd5..8a2cd8ab893 100644 --- a/extensions/vscode-colorize-tests/test/colorize-results/COMMIT_EDITMSG.json +++ b/extensions/vscode-colorize-tests/test/colorize-results/COMMIT_EDITMSG.json @@ -28,8 +28,8 @@ } }, { - "c": "#", - "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", + "c": "# Please enter the commit message for your changes. Lines starting", + "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", @@ -42,7 +42,35 @@ } }, { - "c": " Please enter the commit message for your changes. Lines starting", + "c": "# with '#' will be ignored, and an empty message aborts the commit.", + "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", + "r": { + "dark_plus": "comment: #6A9955", + "light_plus": "comment: #008000", + "dark_vs": "comment: #6A9955", + "light_vs": "comment: #008000", + "hc_black": "comment: #7CA668", + "dark_plus_experimental": "comment: #6A9955", + "hc_light": "comment: #515151", + "light_plus_experimental": "comment: #008000" + } + }, + { + "c": "# On branch master", + "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", + "r": { + "dark_plus": "comment: #6A9955", + "light_plus": "comment: #008000", + "dark_vs": "comment: #6A9955", + "light_vs": "comment: #008000", + "hc_black": "comment: #7CA668", + "dark_plus_experimental": "comment: #6A9955", + "hc_light": "comment: #515151", + "light_plus_experimental": "comment: #008000" + } + }, + { + "c": "# Your branch is up-to-date with 'origin/master'.", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", @@ -57,20 +85,6 @@ }, { "c": "#", - "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", - "r": { - "dark_plus": "comment: #6A9955", - "light_plus": "comment: #008000", - "dark_vs": "comment: #6A9955", - "light_vs": "comment: #008000", - "hc_black": "comment: #7CA668", - "dark_plus_experimental": "comment: #6A9955", - "hc_light": "comment: #515151", - "light_plus_experimental": "comment: #008000" - } - }, - { - "c": " with '#' will be ignored, and an empty message aborts the commit.", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", @@ -84,21 +98,7 @@ } }, { - "c": "#", - "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", - "r": { - "dark_plus": "comment: #6A9955", - "light_plus": "comment: #008000", - "dark_vs": "comment: #6A9955", - "light_vs": "comment: #008000", - "hc_black": "comment: #7CA668", - "dark_plus_experimental": "comment: #6A9955", - "hc_light": "comment: #515151", - "light_plus_experimental": "comment: #008000" - } - }, - { - "c": " On branch master", + "c": "# Changes to be committed:", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", @@ -112,91 +112,7 @@ } }, { - "c": "#", - "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", - "r": { - "dark_plus": "comment: #6A9955", - "light_plus": "comment: #008000", - "dark_vs": "comment: #6A9955", - "light_vs": "comment: #008000", - "hc_black": "comment: #7CA668", - "dark_plus_experimental": "comment: #6A9955", - "hc_light": "comment: #515151", - "light_plus_experimental": "comment: #008000" - } - }, - { - "c": " Your branch is up-to-date with 'origin/master'.", - "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", - "r": { - "dark_plus": "comment: #6A9955", - "light_plus": "comment: #008000", - "dark_vs": "comment: #6A9955", - "light_vs": "comment: #008000", - "hc_black": "comment: #7CA668", - "dark_plus_experimental": "comment: #6A9955", - "hc_light": "comment: #515151", - "light_plus_experimental": "comment: #008000" - } - }, - { - "c": "#", - "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", - "r": { - "dark_plus": "comment: #6A9955", - "light_plus": "comment: #008000", - "dark_vs": "comment: #6A9955", - "light_vs": "comment: #008000", - "hc_black": "comment: #7CA668", - "dark_plus_experimental": "comment: #6A9955", - "hc_light": "comment: #515151", - "light_plus_experimental": "comment: #008000" - } - }, - { - "c": "#", - "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", - "r": { - "dark_plus": "comment: #6A9955", - "light_plus": "comment: #008000", - "dark_vs": "comment: #6A9955", - "light_vs": "comment: #008000", - "hc_black": "comment: #7CA668", - "dark_plus_experimental": "comment: #6A9955", - "hc_light": "comment: #515151", - "light_plus_experimental": "comment: #008000" - } - }, - { - "c": " Changes to be committed:", - "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", - "r": { - "dark_plus": "comment: #6A9955", - "light_plus": "comment: #008000", - "dark_vs": "comment: #6A9955", - "light_vs": "comment: #008000", - "hc_black": "comment: #7CA668", - "dark_plus_experimental": "comment: #6A9955", - "hc_light": "comment: #515151", - "light_plus_experimental": "comment: #008000" - } - }, - { - "c": "#", - "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", - "r": { - "dark_plus": "comment: #6A9955", - "light_plus": "comment: #008000", - "dark_vs": "comment: #6A9955", - "light_vs": "comment: #008000", - "hc_black": "comment: #7CA668", - "dark_plus_experimental": "comment: #6A9955", - "hc_light": "comment: #515151", - "light_plus_experimental": "comment: #008000" - } - }, - { - "c": "\t", + "c": "#\t", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", @@ -224,21 +140,7 @@ } }, { - "c": "#", - "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", - "r": { - "dark_plus": "comment: #6A9955", - "light_plus": "comment: #008000", - "dark_vs": "comment: #6A9955", - "light_vs": "comment: #008000", - "hc_black": "comment: #7CA668", - "dark_plus_experimental": "comment: #6A9955", - "hc_light": "comment: #515151", - "light_plus_experimental": "comment: #008000" - } - }, - { - "c": "\t", + "c": "#\t", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", @@ -266,21 +168,7 @@ } }, { - "c": "#", - "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", - "r": { - "dark_plus": "comment: #6A9955", - "light_plus": "comment: #008000", - "dark_vs": "comment: #6A9955", - "light_vs": "comment: #008000", - "hc_black": "comment: #7CA668", - "dark_plus_experimental": "comment: #6A9955", - "hc_light": "comment: #515151", - "light_plus_experimental": "comment: #008000" - } - }, - { - "c": "\t", + "c": "#\t", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", @@ -309,7 +197,7 @@ }, { "c": "#", - "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", + "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000",