Skip to content

Fix issue with indented closing block comment marker #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## 1.4.0 (2024-11-14)
## 1.4.1 (2024-11-18)

- Fixed a bug where a closing block comment marker indented by more than 4 spaces would not end the comment.

## 1.4.0 (2024-11-18)

- Removed use of 'while' in the grammar to avoid some differences in implementations between GitHub and VS Code
- Improved handling of unclosed code blocks in dartdoc comments
Expand Down
4 changes: 2 additions & 2 deletions grammars/dart.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dart",
"version": "1.4.0",
"version": "1.4.1",
"fileTypes": [
"dart"
],
Expand Down Expand Up @@ -112,7 +112,7 @@
"name": "variable.other.source.dart"
},
{
"match": "\\s{4,}(.*)$",
"match": "(?:\\*|\\/\\/)\\s{4,}(.*?)(?=($|\\*\\/))",
"captures": {
"1": {
"name": "variable.other.source.dart"
Expand Down
15 changes: 15 additions & 0 deletions test/goldens/comments.dart.golden
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,21 @@
>
>/**
#^^^ comment.block.documentation.dart
> * /**
#^^^^^^^^ comment.block.documentation.dart
> * * bbb
#^^^^^^ comment.block.documentation.dart
# ^^^^^ comment.block.documentation.dart variable.other.source.dart
> * */
#^^^^^^^^ comment.block.documentation.dart
> */
#^^^ comment.block.documentation.dart
>var d2;
#^^^ storage.type.primitive.dart
# ^ punctuation.terminator.dart
Comment on lines +215 to +217
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the important part - without the fix this code is considered a comment, but with this fix we're back to code.

>
>/**
#^^^ comment.block.documentation.dart
> * Nested
#^^^^^^^^^ comment.block.documentation.dart
> *
Expand Down
7 changes: 7 additions & 0 deletions test/test_files/comments.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ var c;
*/
var d;

/**
* /**
* * bbb
* */
*/
var d2;

/**
* Nested
*
Expand Down