Skip to content

Misc Issues With Strangely Placed Comments #487

Closed
@amadeus

Description

@amadeus

I have found a few cases where placing comments in specific contexts can cause major problems when relying on nextgroup.

Some examples:

if (someBool) // This is a comment
{
   // This region is now matched as a `jsObject`, which is incorrect.
}

switch(someStr) /* Another comment */ {
    // This region is now matched as a `jsObject`, which is incorrect.
}

I wish there was a way to classify a certain group of regexes as skippable, and then opt in to skipping over them for determining nextgroup, however unfortunately this isn't possible.

The only real fix is to create case specific comments that can act as go-betweens for these regions. Since they would be contained I don't think it would create much overhead, but it would fix.

I am creating this issue as a reminder to fix these cases.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions