Skip to content

Commit c016d4f

Browse files
committed
Fix highlighting of YASnippets without prologues
1 parent 108abd2 commit c016d4f

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](http://semver.org).
1010
------------------------------------------------------------------------
1111
* __Added:__ Highlighting for another 30 keywords used by [`mocha.el`][]
1212
* __Added:__ Highlighting for the [`use-package`][] macro
13+
* __Fixed:__ Highlighting of YASnippets without prologues
1314

1415

1516

grammars/yasnippet.cson

+10-17
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,14 @@ firstLineMatch: """(?xi)
1111
(?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
1212
"""
1313

14-
patterns: [include: "#main"]
14+
patterns: [{
15+
name: "meta.prologue.yasnippet"
16+
begin: "\\A(?=\\s*(?:$|#))"
17+
end: "(?:^|\\G)(?=\\s*(?:[^\\s#]|#+\\s*--\\s*$))"
18+
patterns: [include: "#prologue-lines"]
19+
}, include: "#body"]
1520

1621
repository:
17-
main:
18-
patterns: [
19-
{include: "#prologue"}
20-
{include: "#body"}
21-
]
22-
23-
prologue:
24-
name: "meta.prologue.yasnippet"
25-
begin: "\\A"
26-
end: "^(?=\\s*#+\\s*--\\s*$)"
27-
patterns: [include: "#prologue-lines"]
28-
2922
"prologue-lines":
3023
begin: "^\\s*(#+)(?!\\s*--\\s*$)"
3124
end: "$"
@@ -110,12 +103,12 @@ repository:
110103

111104
body:
112105
name: "meta.snippet-body.yasnippet"
113-
begin: "^\\s*(#+)\\s*(--)\\s*$\\n?"
106+
begin: "^\\s*((#+)\\s*(--)\\s*$\\n?|(?=[^\\s#]))"
114107
end: "(?=A)B"
115108
beginCaptures:
116-
0: name: "comment.line.number-sign.yasnippet"
117-
1: name: "punctuation.definition.comment.number-sign.yasnippet"
118-
2: name: "punctuation.terminator.double-dash.yasnippet"
109+
1: name: "comment.line.number-sign.yasnippet"
110+
2: name: "punctuation.definition.comment.number-sign.yasnippet"
111+
3: name: "punctuation.terminator.double-dash.yasnippet"
119112
patterns: [
120113
{include: "#tab-stops"}
121114
{include: "#indentation-marker"}

0 commit comments

Comments
 (0)