In the highlighter, add include/extends navigation points#65
Merged
In the highlighter, add include/extends navigation points#65
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances template_compiler_highlight HTML output by adding navigation anchor spans for template directives (e.g. include, extends, overrules) and wiring those anchors through the existing event/render pipeline so UI code can jump to directive locations.
Changes:
- Extend the highlight rendering pipeline to compute and render navigation events alongside existing annotation and debug-point events.
- Add navigation event extraction (
build_nav_events/2) and offset-keyed lookup (build_nav_event_map/2) for efficient insertion during rendering. - Emit navigation anchor HTML spans (
nav_anchor/2) with type/line/column metadata.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 pull request enhances the template compiler's syntax highlighting by adding support for navigation anchors in the rendered HTML. These anchors enable more advanced navigation features in the UI, such as jumping to
include,extends, and related template directives. The changes primarily introduce a new navigation event system that tracks and renders navigation points alongside existing debug and annotation features.Navigation anchor support:
build_nav_events/2function to extract navigation-relevant tokens (likeinclude,extends, etc.) from the raw token stream and associate them with their source positions.build_nav_event_map/2to convert navigation events into a map keyed by file offsets, enabling efficient lookup and rendering.nav_anchor/2function to generate HTML<span>elements with data attributes for navigation anchors, including type, line, and column information.Integration into rendering pipeline:
highlight_binary/3andrender_document/5to compute and pass navigation events through the rendering process, ensuring anchors are included in the output. [1] [2]build_events/4,emit_at/2, andrelevant_positions/3to handle navigation anchors alongside existing annotation and debug events, ensuring correct placement in the rendered HTML. [1] [2]