AdguardTeam / VscodeAdblockSyntax

Comprehensive extension to manage Adblock Syntax in VSCode: syntax highlighter, linter and much more. Available on the VSCode Marketplace.
https://marketplace.visualstudio.com/items?itemName=adguard.adblock
MIT License
70 stars 8 forks source link

The syntax complains about RegEx entries with multiple $'s, despite them being valid. #71

Closed DandelionSprout closed 8 months ago

DandelionSprout commented 1 year ago

According to GitHub's implementation of the syntax at the time of writing, it struggles with (some/all?) RegEx entries that contain both a $ in the RegEx and a $ modifier. For instance /^(https?://)?[a-z]{10,12}\.easy\.co($|/.*$)/$document from Nordic Filters.

image

I'm unsure how to correct the syntax to make it consider such an entry to be valid, but I figured I'd bring it up regardless.

DandelionSprout commented 1 year ago

Okay, so it turns out the problem affects pretty much any entry with multiple $'s, for instance /^(https?://)?[a-z]{10,12}\.easy\.co($|/.*$)/ from https://github.com/DandelionSprout/adfilt/blob/master/NorwegianExperimentalList%20alternate%20versions/NordicFiltersABP-Inclusion.txt.

image

scripthunter7 commented 1 year ago

This was originally introduced to detect unnecessary network rule modifiers (dollar signs). This is the reason why it marks them in red, but incorrectly, so it's a bug. However, this check will be taken over by the linter in the future, so the syntax highlighter also gets a refactor soon I think.

scripthunter7 commented 8 months ago

Currently there are several related issues, I have merged them here: https://github.com/AdguardTeam/VscodeAdblockSyntax/issues/120