Improve Component.Fmt#1448
Open
jonludlam wants to merge 11 commits into
Open
Conversation
Embed an example of the Fmt module. We'll use this example over the next few commits to demonstrate how they change the formatting. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Render the canonical `Canonical`/`CanonicalType`/`CanonicalModuleType` constructors with wrap2r (which picks the shorter canonical path when short_paths is set) instead of wrap2. No change to the demonstration, which has no canonical paths. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a config flag that prints Identifiers using only the leaf name, as the HTML renderer does. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Render module expansions as `=> sig ... end` / `=> functor ...` rather than the slightly odd `(sig : ... end)` / `(functor: ...)`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Only print the canonical annotation when a module actually has one, instead of emitting `(canonical=None)` on every module declaration. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Print arrow types without wrapping every left operand in parens (only when the operand is itself an arrow), and render type-constructor applications as `a t` / `(a, b) t` instead of `[a] t` / `[a, b] t`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Render `with type` constraints as `t = ...` / `t := ...` instead of the noisy `t(params ) = ...` Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…sigs Render empty signatures as `sig end` (not `sig end` with a stray gap), print functor-parameter idents short when short_paths is set, and drop the trailing `of ` on argument-less variant constructors (`A` not `A of `). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wrap the name of a hidden module declaration in [brackets] so hidden modules are distinguishable in the rendered signature. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e_expr Lay out unexpanded signatures as `sig <items> end` with hv boxing, matching the other signature printers, instead of cramming the keyword against the first item. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rework the Fmt docstring from a single signature dump into worked documentation. The prelude now exposes [sig_of] (source string -> Component.Signature.t) and a [readable] config alias ([default] with short_paths on) instead of the previous all-in-one [show]. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 is in advance of some more docs of the internals of odoc.