feat: Improve CodeSyntaxHighlight object #268
Open
+228
−42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves a number of things and fixes some slight issues with
CodeSyntaxHighlight
:KnownStyle
for IDE suggestions of valid pygments namesget_text_char_format
was always clobbering whatever I did. Furthermore, it wasn't successfully applying "Monospace", instead I get:WARNING: Populating font family aliases took 75 ms. Replace uses of missing font family "Monospace" with one that exists to avoid this cost.
. So this adds a full font family tree that should work on any system, and it only applies it if the style explicitly sets the "mono" flag. This means that most users will now need to set Monospace themselves (but since it already wasn't working on, macos for example, this is probably a good thing).document()
, simplifying the usage, and also allowing allowing us to automatically set the background color on objects that support setPalette.setTheme
andsetLanguage
methods that allow you to change the style on an existing formatter, including updating the background color on supported objects.