Skip to content

Fix syntax highlighting in the trace explorer - #36

Closed
VojtechStep wants to merge 3 commits into
LPCIC:masterfrom
VojtechStep:fix-trace-highlight
Closed

Fix syntax highlighting in the trace explorer#36
VojtechStep wants to merge 3 commits into
LPCIC:masterfrom
VojtechStep:fix-trace-highlight

Conversation

@VojtechStep

@VojtechStep VojtechStep commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

This PR fixes two issues: the syntax highlighting did not work at all (the code fragments would always render as undefined), and when I fixed it the performance was terrible.

Shiki support was removed literally an hour ago, but maybe we can bring it back, since this just works? The upstream commit removes shiki and adds support for new trace versions in the same commit, I can split it (and implement backwards compatibility differently, as I mentioned in LPCIC/elpi#424 (comment))

Fixes #7

Removing shiki's built-in language grammars lead to it failing to
initialize, so syntax highlighting in the trace explorer never worked.

This is fixed by passing it the elpi grammar during initialization
The terrible performance was caused by not batching the redrawing of
cards when the syntax information was updated. This is because each
card's highlighting info was passed in a separate message, which are
processed in different ticks, so every card caused a redraw.

Here we add manual batching, so that the cards are all updated in the
same tick.
@gares

gares commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Damn, I'm sorry, syntax highlight has been broken for so long that I junked it this morning.

I will look into this pr, but frankly I never found it very useful, even when it did work.

@VojtechStep

Copy link
Copy Markdown
Contributor Author

I agree with you that it doesn't do much, so I opened #39 to clean up the removal instead

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.

goals not displayed

2 participants