Support git commit message syntax highlighting (fixes #3876)

This commit is contained in:
Benjamin Pasero 2016-03-11 16:29:33 +01:00
parent 1a8546774e
commit cc226c0581
6 changed files with 363 additions and 0 deletions

View file

@ -0,0 +1,29 @@
// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
[{
"name": "textmate/git.tmbundle",
"version": "0.0.0",
"license": "MIT",
"repositoryURL": "https://github.com/textmate/git.tmbundle",
"licenseDetail": [
"Copyright (c) 2008 Tim Harper",
"",
"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."
]
}]

View file

@ -0,0 +1,11 @@
{
"comments": {
"lineComment": "//",
"blockComment": [ "/*", "*/" ]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
]
}

View file

@ -0,0 +1,11 @@
{
"comments": {
"lineComment": "//",
"blockComment": [ "/*", "*/" ]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
]
}

View file

@ -0,0 +1,34 @@
{
"name": "gitmode",
"version": "0.1.0",
"publisher": "vscode",
"engines": { "vscode": "*" },
"contributes": {
"languages": [
{
"id": "git-commit",
"aliases": ["Git Commit Message", "git-commit"],
"filenames": ["COMMIT_EDITMSG", "MERGE_MSG"],
"configuration": "./git-commit.configuration.json"
},
{
"id": "git-rebase",
"aliases": ["Git Rebase Message", "git-rebase"],
"filenames": ["git-rebase-todo"],
"configuration": "./git-rebase.configuration.json"
}
],
"grammars": [
{
"language": "git-commit",
"scopeName": "text.git-commit",
"path": "./syntaxes/git-commit.tmLanguage"
},
{
"language": "git-rebase",
"scopeName": "text.git-rebase",
"path": "./syntaxes/git-rebase.tmLanguage"
}
]
}
}

View file

@ -0,0 +1,221 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>COMMIT_EDITMSG</string>
<string>MERGE_MSG</string>
</array>
<key>foldingStartMarker</key>
<string>^\+\+\+</string>
<key>foldingStopMarker</key>
<string>^---</string>
<key>name</key>
<string>Git Commit Message</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>\A(?!# Please enter the commit message)</string>
<key>end</key>
<string>^(?=# Please enter the commit message)</string>
<key>name</key>
<string>meta.scope.message.git-commit</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>\A(?=#)</string>
<key>end</key>
<string>^(?!#)</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#comment</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(?!# Please enter the commit message)</string>
<key>end</key>
<string>^(?=# Please enter the commit message)</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>\G</string>
<key>end</key>
<string>^(?!\G)</string>
<key>name</key>
<string>meta.scope.subject.git-commit</string>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.$2.git-commit</string>
</dict>
</dict>
<key>match</key>
<string>\G((fixup|squash)!)\s*</string>
</dict>
<dict>
<key>match</key>
<string>.{66,}$</string>
<key>name</key>
<string>invalid.illegal.line-too-long.git-commit</string>
</dict>
<dict>
<key>match</key>
<string>.{51,}$</string>
<key>name</key>
<string>invalid.deprecated.line-too-long.git-commit</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(?!# Please enter the commit message)</string>
<key>end</key>
<string>^(?=# Please enter the commit message)</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#comment</string>
</dict>
</array>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(?=# Please enter the commit message)</string>
<key>end</key>
<string>\z</string>
<key>name</key>
<string>meta.scope.metadata.git-commit</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#metadata</string>
</dict>
</array>
</dict>
</array>
<key>repository</key>
<dict>
<key>comment</key>
<dict>
<key>begin</key>
<string>^(#)</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.git-commit</string>
</dict>
</dict>
<key>end</key>
<string>\n</string>
<key>name</key>
<string>comment.line.number-sign.git-commit</string>
</dict>
<key>metadata</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>(?=^# Changes to be committed:)</string>
<key>end</key>
<string>(?!\G)((?=^# \w)|(?!^#))</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>(^[ \t]+)?(?=#)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.whitespace.comment.leading.git-commit</string>
</dict>
</dict>
<key>contentName</key>
<string>comment.line.number-sign.git-commit</string>
<key>end</key>
<string>(?!\G)^</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\G#</string>
<key>name</key>
<string>punctuation.definition.comment.git-commit</string>
</dict>
<dict>
<key>match</key>
<string>((modified|renamed):.*)$\n?</string>
<key>name</key>
<string>markup.changed.git-commit</string>
</dict>
<dict>
<key>match</key>
<string>(new file:.*)$\n?</string>
<key>name</key>
<string>markup.inserted.git-commit</string>
</dict>
<dict>
<key>match</key>
<string>(deleted:.*)$\n?</string>
<key>name</key>
<string>markup.deleted.git-commit</string>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>include</key>
<string>#comment</string>
</dict>
<dict>
<key>begin</key>
<string>(?=diff\ \-\-git)</string>
<key>comment</key>
<string>diff presented at the end of the commit message when using commit -v.</string>
<key>contentName</key>
<string>source.diff</string>
<key>end</key>
<string>\z</string>
<key>name</key>
<string>meta.embedded.diff.git-commit</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.diff</string>
</dict>
</array>
</dict>
</array>
</dict>
</dict>
<key>scopeName</key>
<string>text.git-commit</string>
<key>uuid</key>
<string>BFE83C06-8508-44BE-A975-95A57BF619A7</string>
</dict>
</plist>

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>git-rebase-todo</string>
</array>
<key>name</key>
<string>Git Rebase Message</string>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.git-rebase</string>
</dict>
</dict>
<key>match</key>
<string>^\s*(#).*$\n?</string>
<key>name</key>
<string>comment.line.number-sign.git-rebase</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>support.function.git-rebase</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>constant.sha.git-rebase</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>meta.commit-message.git-rebase</string>
</dict>
</dict>
<key>match</key>
<string>^\s*(pick|p|reword|r|edit|e|squash|s|fixup|f)\s+([0-9a-f]+)\s+(.*)$</string>
<key>name</key>
<string>meta.commit-command.git-rebase</string>
</dict>
</array>
<key>scopeName</key>
<string>text.git-rebase</string>
<key>uuid</key>
<string>7F1CC209-5F6D-486A-8180-09FA282381A1</string>
</dict>
</plist>