Thank you so much to @rioV8, who pointed me to the answer.
This seems to work for me when using extension Highlight:
"highlight.regexes": {
"(console\.(log|warn|error)\(.+\)[;]?)": {
"regexFlags": "g",
"decorations": [
{ "opacity": "0.1" }
]
}
}
To determine what regular expression I wanted to use, I wrote these test cases in https://www.regexpal.com:
console.log('asdfdsf')
console.log({some})
console.log({some});
console.error('error', msg);
console.warn('careful', thing)
And (console.(log|warn|error)(.+)[;]?)
worked. Then I needed to add an extra
before each
to satisfy the VSC settings JSON file.
Now my VSC looks like this:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…