Skip to content

Commit fb84773

Browse files
committed
[git] add grammar update script
1 parent f1abf5a commit fb84773

5 files changed

Lines changed: 183 additions & 280 deletions

File tree

extensions/gitsyntax/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
"categories": [
1111
"Other"
1212
],
13+
"scripts": {
14+
"update-grammar": "node ../../build/npm/update-grammar.js textmate/git.tmbundle Syntaxes/Git%20Commit%20Message.tmLanguage ./syntaxes/git-commit.tmLanguage.json Syntaxes/Git%20Rebase%20Message.tmLanguage ./syntaxes/git-rebase.tmLanguage.json"
15+
},
1316
"contributes": {
1417
"languages": [
1518
{
@@ -40,12 +43,12 @@
4043
{
4144
"language": "git-commit",
4245
"scopeName": "text.git-commit",
43-
"path": "./syntaxes/git-commit.tmLanguage"
46+
"path": "./syntaxes/git-commit.tmLanguage.json"
4447
},
4548
{
4649
"language": "git-rebase",
4750
"scopeName": "text.git-rebase",
48-
"path": "./syntaxes/git-rebase.tmLanguage"
51+
"path": "./syntaxes/git-rebase.tmLanguage.json"
4952
}
5053
]
5154
}

extensions/gitsyntax/syntaxes/git-commit.tmLanguage

Lines changed: 0 additions & 221 deletions
This file was deleted.
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
{
2+
"fileTypes": [
3+
"COMMIT_EDITMSG",
4+
"MERGE_MSG"
5+
],
6+
"foldingStartMarker": "^\\+\\+\\+",
7+
"foldingStopMarker": "^---",
8+
"name": "Git Commit Message",
9+
"patterns": [
10+
{
11+
"begin": "\\A(?!# Please enter the commit message)",
12+
"end": "^(?=# Please enter the commit message)",
13+
"name": "meta.scope.message.git-commit",
14+
"patterns": [
15+
{
16+
"begin": "\\A(?=#)",
17+
"end": "^(?!#)",
18+
"patterns": [
19+
{
20+
"include": "#comment"
21+
}
22+
]
23+
},
24+
{
25+
"begin": "^(?!# Please enter the commit message)",
26+
"end": "^(?=# Please enter the commit message)",
27+
"patterns": [
28+
{
29+
"begin": "\\G",
30+
"end": "^(?!\\G)",
31+
"name": "meta.scope.subject.git-commit",
32+
"patterns": [
33+
{
34+
"captures": {
35+
"1": {
36+
"name": "keyword.other.$2.git-commit"
37+
}
38+
},
39+
"match": "\\G((fixup|squash)!)\\s*"
40+
},
41+
{
42+
"match": ".{73,}$",
43+
"name": "invalid.illegal.line-too-long.git-commit"
44+
},
45+
{
46+
"match": ".{51,}$",
47+
"name": "invalid.deprecated.line-too-long.git-commit"
48+
}
49+
]
50+
},
51+
{
52+
"begin": "^(?!# Please enter the commit message)",
53+
"end": "^(?=# Please enter the commit message)",
54+
"patterns": [
55+
{
56+
"include": "#comment"
57+
}
58+
]
59+
}
60+
]
61+
}
62+
]
63+
},
64+
{
65+
"begin": "^(?=# Please enter the commit message)",
66+
"end": "\\z",
67+
"name": "meta.scope.metadata.git-commit",
68+
"patterns": [
69+
{
70+
"include": "#metadata"
71+
}
72+
]
73+
}
74+
],
75+
"repository": {
76+
"comment": {
77+
"begin": "^(#)",
78+
"captures": {
79+
"1": {
80+
"name": "punctuation.definition.comment.git-commit"
81+
}
82+
},
83+
"end": "\\n",
84+
"name": "comment.line.number-sign.git-commit"
85+
},
86+
"metadata": {
87+
"patterns": [
88+
{
89+
"begin": "(?=^# Changes to be committed:)",
90+
"end": "(?!\\G)((?=^# \\w)|(?!^#))",
91+
"patterns": [
92+
{
93+
"begin": "(^[ \\t]+)?(?=#)",
94+
"beginCaptures": {
95+
"1": {
96+
"name": "punctuation.whitespace.comment.leading.git-commit"
97+
}
98+
},
99+
"contentName": "comment.line.number-sign.git-commit",
100+
"end": "(?!\\G)^",
101+
"patterns": [
102+
{
103+
"match": "\\G#",
104+
"name": "punctuation.definition.comment.git-commit"
105+
},
106+
{
107+
"match": "((modified|renamed):.*)$\\n?",
108+
"name": "markup.changed.git-commit"
109+
},
110+
{
111+
"match": "(new file:.*)$\\n?",
112+
"name": "markup.inserted.git-commit"
113+
},
114+
{
115+
"match": "(deleted:.*)$\\n?",
116+
"name": "markup.deleted.git-commit"
117+
}
118+
]
119+
}
120+
]
121+
},
122+
{
123+
"include": "#comment"
124+
},
125+
{
126+
"begin": "(?=diff\\ \\-\\-git)",
127+
"comment": "diff presented at the end of the commit message when using commit -v.",
128+
"contentName": "source.diff",
129+
"end": "\\z",
130+
"name": "meta.embedded.diff.git-commit",
131+
"patterns": [
132+
{
133+
"include": "source.diff"
134+
}
135+
]
136+
}
137+
]
138+
}
139+
},
140+
"scopeName": "text.git-commit",
141+
"uuid": "BFE83C06-8508-44BE-A975-95A57BF619A7",
142+
"version": "https://github.com/textmate/git.tmbundle/commit/93897a78c6e52bef13dadc0d4091d203c5facb40"
143+
}

0 commit comments

Comments
 (0)