Skip to content

Commit db6decb

Browse files
authored
[C#] Fix empty block comments (#4539)
This commit copies empty block comment pattern from Java to fix syntax highlighting breaking after /**/.
1 parent aef805a commit db6decb

2 files changed

Lines changed: 70 additions & 10 deletions

File tree

C#/C#.sublime-syntax

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ contexts:
3939
- match: //
4040
scope: punctuation.definition.comment.cs
4141
push: inside_line_comment
42+
- match: /\*\*+/
43+
scope: comment.block.empty.cs punctuation.definition.comment.cs
4244
- match: /\*+
4345
scope: punctuation.definition.comment.begin.cs
4446
push: inside_block_comment

C#/tests/syntax_test_Comments.cs

Lines changed: 68 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,25 +94,83 @@ namespace HelloWorld
9494
/// git+https://hoster.com/user/repo
9595
//* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.cs
9696

97+
/**/
98+
//* ^^^^ comment.block.empty.cs punctuation.definition.comment.cs
99+
//* ^ - comment
100+
101+
/***/
102+
//* ^^^^^ comment.block.empty.cs punctuation.definition.comment.cs
103+
//* ^ - comment
104+
105+
/*comment*/
106+
//* ^^^^^^^^^^^ comment.block.cs
107+
//* ^^ punctuation.definition.comment.begin.cs
108+
//* ^^ punctuation.definition.comment.end.cs
109+
110+
/**comment**/
111+
//* ^^^^^^^^^^^^^ comment.block.cs
112+
//* ^^^ punctuation.definition.comment.begin.cs
113+
//* ^^^ punctuation.definition.comment.end.cs
114+
115+
/***comment***/
116+
//* ^^^^^^^^^^^^^^^ comment.block.cs
117+
//* ^^^^ punctuation.definition.comment.begin.cs
118+
//* ^^^^ punctuation.definition.comment.end.cs
119+
120+
/*
121+
//* ^^^ comment.block.cs
122+
//* ^^ punctuation.definition.comment.begin.cs
123+
comment
124+
//*^^^^^^^^^ comment.block.cs
125+
*
126+
//*^^^^ comment.block.cs
127+
//* ^ punctuation.definition.comment.cs
128+
*/
129+
//*^^^ comment.block.cs
130+
//* ^^ punctuation.definition.comment.end.cs
131+
97132
/**
98-
*
99-
//* ^ meta.namespace meta.block comment.block punctuation.definition.comment
133+
//* ^^^^ comment.block.cs
134+
//* ^^^ punctuation.definition.comment.begin.cs
135+
*
136+
//* ^ comment.block.cs punctuation.definition.comment.cs
137+
*
138+
//* ^ comment.block.cs punctuation.definition.comment.cs
139+
*
140+
//* ^ comment.block.cs punctuation.definition.comment.cs
141+
*
142+
//* ^ comment.block.cs punctuation.definition.comment.cs
100143
**/
101144
//*^^^^ comment.block.cs
102145
//* ^^^ punctuation.definition.comment.end.cs
146+
//* ^ - comment
103147
class Hello
104148
{
105149
/// <summary>
106150
/// Computes matrix-matrix product of a sparse matrix stored in the CSC format.
107151
/// </summary>
108-
void dcscmm(Transpose TransA, int m, int n, int k,
109-
double alpha,
110-
double[] val, int offsetval,
111-
int[] idx, int offsetidx,
112-
int[] pntrb, int offsetpntrb,
152+
//*^^^^^^^^^^^^^^^^^^^^ comment.line.documentation.cs
153+
//* ^^^ punctuation.definition.comment.documentation.cs
154+
//* ^^^^^^^^^^ meta.tag.xml
155+
//* ^^ punctuation.definition.tag.begin.cs
156+
//* ^^^^^^^ entity.name.tag.end.cs
157+
//* ^ punctuation.definition.tag.end.cs
158+
void dcscmm(/**/Transpose/**/ TransA, /**/ int /**/m,/**/int /**/ n /**/,/**/ int /**/k/**/, /**/
159+
//* ^^^^ comment.block.empty.cs punctuation.definition.comment.cs
160+
//* ^^^^ comment.block.empty.cs punctuation.definition.comment.cs
161+
//* ^^^^ comment.block.empty.cs punctuation.definition.comment.cs
162+
//* ^^^^ comment.block.empty.cs punctuation.definition.comment.cs
163+
//* ^^^^ comment.block.empty.cs punctuation.definition.comment.cs
164+
//* ^^^^ comment.block.empty.cs punctuation.definition.comment.cs
165+
//* ^^^^ comment.block.empty.cs punctuation.definition.comment.cs
166+
//* ^^^^ comment.block.empty.cs punctuation.definition.comment.cs
167+
//* ^^^^ comment.block.empty.cs punctuation.definition.comment.cs
168+
//* ^^^^ comment.block.empty.cs punctuation.definition.comment.cs
169+
//* ^^^^ comment.block.empty.cs punctuation.definition.comment.cs
113170
//int[] pntre, int offsetpntre,
114-
double[] b, int offsetb, int ldb,
115-
double beta,
116-
double[] c, int offsetc, int ldc);
171+
//* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.cs
172+
//* ^^ punctuation.definition.comment.cs
173+
); /**/
174+
//* ^^^^ comment.block.empty.cs punctuation.definition.comment.cs
117175
}
118176
}

0 commit comments

Comments
 (0)