dart-atom / dart

A Dart plugin for Atom.
http://dart-atom.github.io/dart/
BSD 3-Clause "New" or "Revised" License
154 stars 44 forks source link

Syntax highlighting doesn't handle fenced code blocks correctly #1176

Open DanTup opened 5 years ago

DanTup commented 5 years ago

This screenshot is from VS Code, but since I took the TextMate grammar from here, I guess it has the same issue:

Code

My fix for VS Code is at https://github.com/Dart-Code/Dart-Code/pull/1326 and changes from the left to the right (note: I'm no expert in TM grammar so it may not be the best way, but it seems to work):

screen shot 2018-12-03 at 12 09 59 pm screen shot 2018-12-03 at 12 10 40 pm

DanTup commented 5 years ago

FYI - there was a bug in Dart Code's implementation of this:

"patterns": [
    {
        "begin": "///",
        "while": "///",
        "patterns": [
            {
                "include": "#dartdoc"
            }
        ],
        "name": "comment.block.documentation.dart"
    }
]

The while pattern should be ^/// so that it doesn't include the whole of the next line if it contains /// when it's not at the start (see https://github.com/Dart-Code/Dart-Code/issues/1554). It's fixed now in Dart Code's master.