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

General highlighting of network rules #120

Open scripthunter7 opened 8 months ago

scripthunter7 commented 8 months ago

Currently, the supported modifier names are in a predefined list, so for each new modifier, the syntax highlighter should be modified to support it properly. This is often a time-consuming process (GitHub Linguist is also updated quarterly). Furthermore, the current method tends to produce problematic cases, just consider the example below:

pattern$modifier=other|a-third-party-b,aa3p_1p_
Show screenshot ![image](https://github.com/AdguardTeam/VscodeAdblockSyntax/assets/57285466/47e56136-eb47-4eb8-8fc3-2303d1a2e279)

Taking the above points into account, it would make sense to introduce a solution that generally supports the following syntaxes, thus solving the above problems.

pattern-without-modifiers
pattern-with-modifiers$modifier=value,another-modifier=another-value
/regex-pattern/
! $ in the pattern
/^regex-pattern$/$modifier=value
! $ in the pattern
@@||example.com/$rpc/google.*/Create$domain=example.org,stealth
! from https://github.com/AdguardTeam/VscodeAdblockSyntax/issues/71
/^(https?://)?[a-z]{10,12}\.easy\.co($|/.*$)/$document

Requirements: