Skip to content

Commit e1ac5c4

Browse files
authored
Fix issue with indented closing block comment marker (#79)
This fixes the issue that was noted at #75 (comment).
1 parent 5b36228 commit e1ac5c4

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
## 1.4.0 (2024-11-14)
1+
## 1.4.1 (2024-11-18)
2+
3+
- Fixed a bug where a closing block comment marker indented by more than 4 spaces would not end the comment.
4+
5+
## 1.4.0 (2024-11-18)
26

37
- Removed use of 'while' in the grammar to avoid some differences in implementations between GitHub and VS Code
48
- Improved handling of unclosed code blocks in dartdoc comments

grammars/dart.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Dart",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"fileTypes": [
55
"dart"
66
],
@@ -112,7 +112,7 @@
112112
"name": "variable.other.source.dart"
113113
},
114114
{
115-
"match": "\\s{4,}(.*)$",
115+
"match": "(?:\\*|\\/\\/)\\s{4,}(.*?)(?=($|\\*\\/))",
116116
"captures": {
117117
"1": {
118118
"name": "variable.other.source.dart"

test/goldens/comments.dart.golden

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,21 @@
203203
>
204204
>/**
205205
#^^^ comment.block.documentation.dart
206+
> * /**
207+
#^^^^^^^^ comment.block.documentation.dart
208+
> * * bbb
209+
#^^^^^^ comment.block.documentation.dart
210+
# ^^^^^ comment.block.documentation.dart variable.other.source.dart
211+
> * */
212+
#^^^^^^^^ comment.block.documentation.dart
213+
> */
214+
#^^^ comment.block.documentation.dart
215+
>var d2;
216+
#^^^ storage.type.primitive.dart
217+
# ^ punctuation.terminator.dart
218+
>
219+
>/**
220+
#^^^ comment.block.documentation.dart
206221
> * Nested
207222
#^^^^^^^^^ comment.block.documentation.dart
208223
> *

test/test_files/comments.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ var c;
9494
*/
9595
var d;
9696

97+
/**
98+
* /**
99+
* * bbb
100+
* */
101+
*/
102+
var d2;
103+
97104
/**
98105
* Nested
99106
*

0 commit comments

Comments
 (0)