-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve/refine syntax highlighter #1134
Comments
|
Related issue: - uBlockOrigin/uBlock-issues#1134 Specifically; - `beacon`, `ping`, and `websocket` cannot be redirected; - it's ok to not specify a type when redirecting to `empty` resource; - `csp=` option can't be mixed with other types, redirec directives, and more `csp=` options.
Related issue: - uBlockOrigin/uBlock-issues#1134 Invalid values for `!#if ...` will be highlighted as errors. Auto completion is now supported for both the directives themselves and the valid values for `!#if ...`. For examples, when pressing ctrl-space: - `!#e` will auto-complete to `!#endif` - `!#i` will offer to choose between `!#if ` or `!#include ` - `!#if fir` will auto-complete to `!#if env_firefox` Additionally, support for some of AdGuard preparsing directives, i.e. `!#if adguard` is now a valid and will be honoured -- it always evaluate to `false` in uBO.
Related issue: - uBlockOrigin/uBlock-issues#1134 CodeMirror's code folding reference: - https://codemirror.net/doc/manual.html#addon_foldcode This commit adds support for code-folding to the filter list editor/viewer. The following blocks of code are foldable by clicking the corresponding marker in the gutter: - !#if/#endif blocks - !#include blocks Addtionally, the following changes: - The `!#include` line is now preserved when importing a sublist - The `!#if` directives will be syntax-colored according to whether they evaluate to true or false on the current platform - Double-clicking on a foldable line in the gutter will select the content of the foldable block - Minor visual improvement to matching brackets
This is invalid now:
|
I will fix this asap. However I would like to understand the purpose of that |
Maybe some ad engine have name " |
Apparently came from the Fanboy's list so @ryanbr would know. Clearly it has nothing to do with AdGuard. |
This look like first occurrence: ryanbr/fanboy-adblock@d51ac92 |
If I am getting this right, that I am trying to assess whether I should publish an emergency fix for the |
This is puzzling: easylist/easylist#5286
|
Yeah, The other cases seem to be about not blocking 1st-party secondary resources without wholly disabling filtering -- so probably they are targeting ABP specifically. |
This was fixed after gorhill/uBlock@41636c5 v1.21 and I think it was fixed very recently in legacy builds. In 1.16.4.22 |
Are filters with errors actually dropped? Because:
And nothing is logged in the logger. v1.28.5b1 in Chome. |
That one is not dropped but on the other hand it will never match, since no hostname will ever match I don't think uBO should drop whole filter because one
Surely we still want to enforce the filter on This is why I chose to treat invalid |
Turns out some people imported uMatrix ruleset recipes as filter list in uBO https://www.reddit.com/r/uBlockOrigin/comments/hy3nsy/rulesets_for_english_websites_breaking_youtube/ Maybe ask for proper header in filter lists and treat host files more strict? Another
https://www.reddit.com/r/uBlockOrigin/comments/hxorev/ublock_origin_page_loading_issue/fzaguh5/ |
That will be taken care with #1118. |
Related commit: - gorhill@2eec285 Related feedback: - uBlockOrigin/uBlock-issues#1134 (comment) Source commit was imported manually because cherry-pick didn't work properly dur to earlier changes in target file.
Here's a suggestion for the filter viewer/editor, although not exactly related to syntax highlighting: When double-clicking on a domain name, the whole domain should be selected, instead of just the part that was clicked on. Use cases:
Also when double-clicking on the suffix of a cosmetic filter, the |
This comment has been minimized.
This comment has been minimized.
This allows to bring in all the benefits of syntax highlighting and enhanced editing features in the element picker, like auto- completion, etc. This is also a necessary step to possibly solve the following issue: - #2035 Additionally, incrementally improved the behavior of uBO's custom CodeMirror static filtering syntax mode when double-clicking somewhere in a static extended filter: - on a class/id string will cause the whole class/id string to be selected, including the prepending `.`/`#`. - somewhere in a hostname/entity will cause all the labels from the cursor position to the right-most label to be selected (subject to change/fine-tune as per feedback of filter list maintainers). Related feedback: - uBlockOrigin/uBlock-issues#1134 (comment)
Related issue: - uBlockOrigin/uBlock-issues#1134 Double-clicking on... ... a filter option will cause the option to be wholly selected, including `=[value]` if present; ... a value assigned to a filter option will cause the value to be wholly selected, except when the value is a hostname/entity, in which case all the labels from the cursor position to the right-most label will be selected.
Related issue: - uBlockOrigin/uBlock-issues#1134 Related commit: - daf464b
I'm entirely not sure if this is within the purview of this issue, but uBO's highlighter doesn't detect errors within the |
uBO uses the browser itself to validate CSS selector. If the browser reports as valid, uBO reports as valid. From console, Chromium says |
Both are fully supported by the browser vendors as part of the Selectors-4 spec. |
Before I forget: DandelionSprout/adfilt#163 (reply in thread) |
I suppose RaL try said about bad colorize elements inside
|
Anything you put in https://drafts.csswg.org/selectors-4/#typedef-forgiving-selector-list
|
Sort of related issue: - uBlockOrigin/uBlock-issues#1134
It's not a highlighting issue, since the scriptlet is interpreted as:
Which is valid.
|
There are still many tasks unfinished in #1134 (comment), are they abandoned since you closed this issue ? |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Improve extraction of tokens from regex-based filters - worth to mention also about this commit, as a part of it is related to untokenizable regex syntax highlighting (and it doesn't contain any reference to this thread, nor any key words in the title, like: syntax, highlight, linter). |
Line continuation support works fine, but highlighting is still not fixed, a filter is highlighted as invalid, despite it is valid and works fine when visiting site: onet.pl## \
body |
Instead of having countless issues opened for every single improvements/refining that could be brought to the syntax highlighter, here is one meta issue to handle them all. I will list all the actionable items in the top comment. Feel free to report un-handled cases or suggest more refinements.
To do:
https://raw.githubusercontent.com/gorhill/uBlock/master/docs/tests/static-filtering-parser-checklist.txt
*$xhr,empty
should be reported as valid*$beacon,redirect-rule=empty
*$ping,redirect-rule=empty
*$websocket,redirect-rule=empty
!#
directives!#if
-!#endif
directives/.*
: they are inefficient and the leading.*
accomplishes nothing.Nice to have:
!#if ...
/!#endif
blocks!#include
blocksThe text was updated successfully, but these errors were encountered: