Scaladoc: interactive toggle for capture checking content - #26877
Draft
bracevac wants to merge 1 commit into
Draft
Scaladoc: interactive toggle for capture checking content#26877bracevac wants to merge 1 commit into
bracevac wants to merge 1 commit into
Conversation
Implements the interactive feature toggle part of scala#23743. Extend the signature IR with a Toggleable part that tags fragments belonging to a toggleable language feature (currently capture checking) with an 'on' rendering and an optional plain 'off' fallback (e.g. cc arrows -> / ?-> fall back to => / ?=>). All cc generation sites now emit tagged fragments: capture sets, carets on capture variables, cc arrows, update/consume modifiers, consume parameter prefixes, and uses clauses. The HTML renderer emits both variants wrapped in feature-cc/feature-on/ feature-off spans; CSS displays exactly one of them based on a cc-hidden class on the root element, maintained by a new early-loaded script that persists the choice in localStorage (mirroring the theme switcher). A cc button in the header (and mobile menu) flips the state; it is only rendered when at least one documented package opts into capture checking. Toggling also re-renders an open inheritance diagram, whose node sizes are measured at first render. The signature test harness strips the hidden feature-off variants before text comparison, so existing expectations are unchanged. New tests check the toggle markup invariants, the presence/absence of the toggle button, and that -suppressCC still suppresses all toggle machinery. Known limitation: the search index and inkuire database are flattened from the cc-on variants only, so searchbar results do not follow the toggle state.
| cls := "text-button", | ||
| titleAttr := "Show or hide capture checking annotations", | ||
| Attr("aria-label") := "Show or hide capture checking annotations", | ||
| )("cc") |
Contributor
There was a problem hiding this comment.
Can this be a tad more descriptive for the average beginner? 😇
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.
Implements the interactive feature toggle part of #23743.
Known limitation: the search index and inkuire database are flattened from the cc-on variants only, so searchbar results do not follow the toggle state.
Have you relied on LLM-based tools in this contribution?
Yes, pair programming.
How was the solution tested?
New automated tests (including the issue's reproducer, if applicable)
Manual testing in the browser of
scaladoc/generateScalaDocumentation.