Make HighlightingRule extensible so rules aren't required to use Regex #401

Open
GSonofNun wants to merge 1 commit from GSonofNun/master into master
GSonofNun commented 2023-05-09 14:44:00 -05:00 (Migrated from github.com)

Added IHighlightingRule so developers can implement custom rules that don't use a simple regex pattern. As part of this, I had to make a simple RuleMatch type to replace the uses of System.Text.RegularExpressions.Match instances as I needed a way for a custom implmentation to still return match results.

Here's an example of a custom IHighlightingRule I needed: https://gist.github.com/GSonofNun/f5a97b24bb9d57c06c723a7bc02940a0
This rule allows me to highlight delimiter separated values, giving a color to each column of values, and even lets me change the font weight and underline of certain lines.
image

I think these changes greatly expands the scope of possibilities for HighlightingRules.

Added `IHighlightingRule` so developers can implement custom rules that don't use a simple regex pattern. As part of this, I had to make a simple `RuleMatch` type to replace the uses of `System.Text.RegularExpressions.Match` instances as I needed a way for a custom implmentation to still return match results. Here's an example of a custom `IHighlightingRule` I needed: https://gist.github.com/GSonofNun/f5a97b24bb9d57c06c723a7bc02940a0 This rule allows me to highlight delimiter separated values, giving a color to each column of values, and even lets me change the font weight and underline of certain lines. <img width="513" alt="image" src="https://github.com/icsharpcode/AvalonEdit/assets/3924712/a3336ec6-8f22-4596-bbec-854111afb0d8"> I think these changes greatly expands the scope of possibilities for HighlightingRules.
goswinr commented 2024-03-22 08:49:48 -05:00 (Migrated from github.com)

Nice! Can this be used along with xshd files ?

Nice! Can this be used along with xshd files ?
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'GSonofNun/master:GSonofNun/master'
git switch 'GSonofNun/master'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'master'
git merge --no-ff 'GSonofNun/master'
git switch 'GSonofNun/master'
git rebase 'master'
git switch 'master'
git merge --ff-only 'GSonofNun/master'
git switch 'GSonofNun/master'
git rebase 'master'
git switch 'master'
git merge --no-ff 'GSonofNun/master'
git switch 'master'
git merge --squash 'GSonofNun/master'
git switch 'master'
git merge --ff-only 'GSonofNun/master'
git switch 'master'
git merge 'GSonofNun/master'
git push origin 'master'
Sign in to join this conversation.
No description provided.