From 654634c303ecedc75d61377cac60374b5bc9aa85 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Sat, 23 Sep 2017 21:13:53 +0200 Subject: [PATCH 1/2] Don't optionally match trailing newlines in comments --- grammars/c#.cson | 4 ++-- spec/grammar-spec.coffee | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/grammars/c#.cson b/grammars/c#.cson index b44057c..766c36b 100644 --- a/grammars/c#.cson +++ b/grammars/c#.cson @@ -539,7 +539,7 @@ repository: captures: "0": name: "punctuation.definition.comment.cs" - end: "$\\n?" + end: "$" name: "comment.block.documentation.cs" patterns: [ { @@ -560,7 +560,7 @@ repository: captures: "1": name: "punctuation.definition.comment.cs" - end: "$\\n?" + end: "$" name: "comment.line.double-slash.cs" } ] diff --git a/spec/grammar-spec.coffee b/spec/grammar-spec.coffee index 74da474..74c55d4 100644 --- a/spec/grammar-spec.coffee +++ b/spec/grammar-spec.coffee @@ -166,10 +166,10 @@ describe "Language C# package", -> else expect(token[0].value).toBe(directive) - expect(token[token.length - 3].value).toBe('//') - expect(token[token.length - 3].scopes).toContain('comment.line.double-slash.cs') - expect(token[token.length - 2].value).toBe(' A line comment') + expect(token[token.length - 2].value).toBe('//') expect(token[token.length - 2].scopes).toContain('comment.line.double-slash.cs') + expect(token[token.length - 1].value).toBe(' A line comment') + expect(token[token.length - 1].scopes).toContain('comment.line.double-slash.cs') describe "C# Script grammar", -> it "parses the grammar", -> From c4c76f52aa7f40a2045171d963076521fd385f29 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Sat, 23 Sep 2017 22:30:54 +0200 Subject: [PATCH 2/2] Use beginCaptures instead of captures --- grammars/c#.cson | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/grammars/c#.cson b/grammars/c#.cson index 766c36b..5ae7861 100644 --- a/grammars/c#.cson +++ b/grammars/c#.cson @@ -536,7 +536,7 @@ repository: patterns: [ { begin: "///" - captures: + beginCaptures: "0": name: "punctuation.definition.comment.cs" end: "$" @@ -549,15 +549,18 @@ repository: } { begin: "/\\*" - captures: + beginCaptures: "0": name: "punctuation.definition.comment.cs" end: "\\*/" + endCaptures: + "0": + name: "punctuation.definition.comment.cs" name: "comment.block.cs" } { begin: "//" - captures: + beginCaptures: "1": name: "punctuation.definition.comment.cs" end: "$"