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

JS embedding, CSS highlight #50

Closed scripthunter7 closed 1 year ago

scripthunter7 commented 1 year ago

JS embedding

This approach is based on HTML's logic (where JS is also embedded).

Show screenshot ![image](https://user-images.githubusercontent.com/57285466/184623572-979e8d9e-972e-4426-8da4-ab35e3b952a0.png)

JS embedding is also possible in Linguist: https://github.com/github/linguist/discussions/6020#discussioncomment-3397226

CSS highlight (in progress)

My own CSS highlight that also supports AdGuard's ExtendedCss. It would be complicated to embed CSS here, so it was written completely from scratch.

Show screenshot ![image](https://user-images.githubusercontent.com/57285466/184656755-8389f57c-3a2a-44a4-a97d-f10be4139c76.png)

Live CSS highlight demo

TODO:

scripthunter7 commented 1 year ago

@ameshkov

I think the first version is ready. During my tests, it highlighted 99%+ of the rules properly, but it may not work properly in some exotic cases.

I took some ideas from: https://github.com/Microsoft/vscode/blob/main/extensions/css/syntaxes/css.tmLanguage.json (eg keyword list, units, numeric literals)

Preview:

:warning: This preview tool is resource hungry, this is not a tmlanguage optimization problem.

scripthunter7 commented 1 year ago

I think this will come up in smaller pieces in the future.