emilast / vscode-logfile-highlighter

A Visual Studio Code extension for color highlighting log files
MIT License
192 stars 38 forks source link

Regex processing order, base style #641

Open perholmes opened 1 month ago

perholmes commented 1 month ago

FEATURE REQUEST: Some kind of way to control the priority of highlighting rules, so that when a rule has been applied, no further rules are applied. Then the rules should be processed in the order they appear in the settings JSON. Rule collisions are common, and the order rules are applied in shouldn't be random. This feature would also allow users to create a base style.

BACKGROUND: I was trying to make a base style color, but it doesn't seem possible. I wanted the base text to be gray instead of white, but creating a regex that catches everything bypasses most of my other coloring rules, but not all.

It appears that RegExes are processed in some kind of deterministic, but not sequential order, either alphabetical order or current runtime memory order of a set or a map. If I make a rule catching [\s\S]* and place it at the top, certain rules are suppressed. If I place it at the end of the list, certain other rules are suppressed. I thus had to give up on making a base style, and tolerate the (very) white color of the default style.

emilast commented 1 month ago

Thank you for your suggestion. I will consider possible improvements in this area.