Skip to content
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

fix(highlight): increase syntax highlighter config priority #424

Merged
merged 2 commits into from
Mar 2, 2025

Conversation

glevco
Copy link
Contributor

@glevco glevco commented Feb 19, 2025

This PR increases the highlighter config priority over the rgb_colors config. It resolves #337.

Currently, enabling the syntect-highlighter feature is not enough to actually enable syntax highlighting, because the default rgb_colors config disallows it (more info and current workarounds in #337). It would be desirable if users could use syntax highlighting simply by adding the syntect-highlighter feature.

Also, the current behavior is not consistent. For instance, when a custom highlighter is set (instead of syntect's), rgb_colors is already disregarded. When a custom highlighter is set and syntect-highlighter is disabled, even the color config is disregarded (it shouldn't be).

I kept 2 commits that may or may not be reviewed separately:

  1. The first commit just adds new tests to assert the current (unexpected) behavior. It makes no changes in behavior.
  2. The second commit performs the actual fix/refactor.

I did this so the change in behavior is explicit in the diff between the commits, by observing how the tests were changed. By the way, this is a breaking change since default behavior is changed.

@zkat zkat merged commit 58d9f12 into zkat:main Mar 2, 2025
6 of 15 checks passed
@glevco glevco deleted the fix/highlighter-config-priority branch March 5, 2025 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't get syntect-highlighter to work
2 participants