Skip to content

Commit aa5c279

Browse files
authored
feat: remove overflow warning (#68)
1 parent 821994a commit aa5c279

File tree

9 files changed

+35421
-36370
lines changed

9 files changed

+35421
-36370
lines changed

grammar.js

+7-22
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
const NEWLINE = /\r?\n/;
2+
const ANYTHING_OR_NONE = /[^\n\r]*/;
23
const ANYTHING = /[^\n\r]+/;
3-
const SUBJECT = /[^\n\r]{0,49}/;
44
const NOT_A_COMMENT = /[^#]/;
5-
const SUMMARY = /[^\n\r]{0,72}/;
65
const SCISSORS = /# -+ >8 -+\r?\n/;
76
const BRANCH_NAME = /[^\s'»"]+/;
87
const COMMIT = /[0-9a-f]{7,40}/;
@@ -20,11 +19,7 @@ module.exports = grammar({
2019
name: 'gitcommit',
2120
extras: () => [],
2221

23-
externals: ($) => [
24-
$._conventional_type,
25-
$._conventional_subject,
26-
$._trailer_value,
27-
],
22+
externals: ($) => [$._conventional_type, $._trailer_value],
2823

2924
rules: {
3025
source: ($) =>
@@ -41,11 +36,7 @@ module.exports = grammar({
4136
optional(
4237
seq(alias(choice('fixup!', 'amend!'), $.subject_prefix), WHITESPACE)
4338
),
44-
choice(
45-
seq(NOT_A_COMMENT, SUBJECT),
46-
seq($.prefix, $._conventional_subject)
47-
),
48-
optional(alias(ANYTHING, $.overflow))
39+
choice(seq(NOT_A_COMMENT, ANYTHING_OR_NONE), seq($.prefix, ANYTHING))
4940
),
5041

5142
prefix: ($) =>
@@ -57,25 +48,19 @@ module.exports = grammar({
5748
),
5849

5950
_body_line: ($) =>
60-
choice($._message, $.breaking_change, $.trailer, $.comment, NEWLINE),
51+
choice($.message_line, $.breaking_change, $.trailer, $.comment, NEWLINE),
6152

62-
_message: ($) =>
63-
seq(seq(NOT_A_COMMENT, SUMMARY), optional(alias(ANYTHING, $.overflow))),
53+
message_line: ($) => seq(seq(NOT_A_COMMENT, ANYTHING_OR_NONE)),
6454

6555
trailer: ($) =>
66-
seq(
67-
alias(TRAILER_TOKEN, $.token),
68-
alias($._trailer_value, $.value),
69-
optional(alias(ANYTHING, $.overflow))
70-
),
56+
seq(alias(TRAILER_TOKEN, $.token), optional(alias(ANYTHING, $.value))),
7157

7258
breaking_change: ($) =>
7359
seq(
7460
// BREAKING_CHANGE conflicts with TRAILER_TOKEN, an so requires higher
7561
// lexical precedence
7662
alias(token(prec(1, BREAKING_CHANGE)), $.token),
77-
alias($._trailer_value, $.value),
78-
optional(alias(ANYTHING, $.overflow))
63+
optional(alias(ANYTHING, $.value))
7964
),
8065

8166
comment: ($) =>

queries/highlights.scm

-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515

1616
(subject) @markup.heading @spell
1717

18-
(subject
19-
(overflow) @none @spell)
20-
2118
(subject
2219
(subject_prefix) @function @nospell)
2320

src/grammar.json

+8-64
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/node-types.json

+6-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)