Skip to content

Incorrect comment highlighting with recent update #1573

@kankaristo

Description

@kankaristo

I use the following method to quickly and easily comment out code blocks:

/*/
code();
// */

Adding a single * on the first line uncomments the code block, so you can toggle the code block with a single character:

/**/
code();
// */

You can also toggle between 2 different code blocks with a single character, if you add * to the first line here:

/*/
code("A");
/*/
code("B");
// */

The same works in all languages that use /* */ for multiline comments (the C "family", JavaScript, JSON with comments, and a similar thing even works in Lua). Dart is a bit weird in that it requires the space in // */ or the code will fail to compile, but that's a "bug" in Dart, not in this package.


However, a recent change in this package (maybe related to #1498) breaks syntax highlighting.

The last line (// */) seems to be treated as a one line comment, and the end of the multiline comment is ignored, so the rest of the file is highlighted as a comment:
Screenshot from 2019-04-02 10-54-19

If there's a later */ (not part of another comment), the comment highlighting stops there, but it's (correctly) marked as a syntax error:
Screenshot from 2019-04-02 10-55-04

The same bug also occurs with a simple /* // */ (the rest of the file is highlighted as a comment):
Screenshot from 2019-04-02 11-00-19

This is a relatively recent change, I remember the highlighting working correctly about a week ago (but of course, that may depend on when I updated this package).

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresis bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions