vscode-logfile-highlighter icon indicating copy to clipboard operation
vscode-logfile-highlighter copied to clipboard

Highlighting when not matching a regular expression

Open tkimovski opened this issue 4 years ago • 3 comments

Is it possible to highlight the whole line when the line doesn't match a regular expression?

tkimovski avatar Feb 16 '21 04:02 tkimovski

Not sure I understand what you want to indicate. I have no setting for this but VS Code highlights the entire line by default. Do you want to disable this?

emilast avatar Mar 03 '21 09:03 emilast

Sorry, what I meant was to highlight all lines that do not match a regular expression. Thank you.

tkimovski avatar Mar 03 '21 09:03 tkimovski

Well, a custom pattern like this should work:

    "logFileHighlighter.customPatterns": [
        // Color line that does not contain "foo" using negative lookahead
        {
            "pattern": "^.*(?!bar).*$",
            "foreground": "#ff0000"
        },
    ],

But unfortunately, it doesn't. It seems we get an infinite recursion or something like that, because the vs code extension hosts crashes. I'll treat this as a bug.

emilast avatar Mar 06 '21 10:03 emilast

I will close this issue now as I don't see a way to solve it. Also, it is a bit an edge case.

emilast avatar Jun 19 '24 19:06 emilast