Open
Conversation
Add a generic items_in_scope API to HIR that collects all visible items in a given scope across the specified name domains. This follows the same pattern as available_traits_in_scope and properly handles: - Named imports - Glob imports - Unnamed/prelude imports - Direct child items - Parent scope items (recursively) Add ScopeId::items_in_scope() as a convenient traversal-like method. Rewrite completion handler to: - Find the most specific scope at cursor position - Use items_in_scope to get properly scoped completions - Convert NameRes items to appropriate CompletionItem kinds This fixes completion showing random unrelated symbols and provides context-aware suggestions that respect lexical scope.
- Set insert_text, insert_text_format, and insert_text_mode to prevent unwanted text replacement and indentation issues - Detect when completion is triggered by '.' for future member access implementation - Add TODO for member completion (needs proper public API for type members) This fixes the issue where completion would replace existing text and add extra indentation.
Use top_mod.target_at() instead of reference_at() + target_at() so that rename works when cursor is on a definition name, not just references.
- Add textDocument/implementation handler for traits and trait methods
- On traits: navigates to all impl Trait blocks
- On trait methods: navigates to all implementations of that method
- Fix trait method rename to also rename implementations
- When renaming a trait method, all corresponding method definitions
in impl blocks are also renamed
- Remove the heuristic text scanner that built name→symbol maps from existing occurrences and searched signature text for matches. This was compensating for missing HIR visitor coverage (now fixed). - Keep targeted extra_names injection for parent type params in child signatures (known parent-scoped symbols, not heuristic scanning). - Index generic params of child items (trait methods) in the child- indexing path since items_dfs no longer visits them. - Add regression tests for correct trait method SCIP symbols (Foo#bar. not Foo/bar.) and method-level type param indexing.
- Add generic_params() method to SymbolView in HIR semantic API so both LSIF and SCIP generators use the same traversal - Extract index_generic_params_for() helper in SCIP to eliminate duplicated generic param indexing code - Refactor index_unnamed_item_generic_params to use the shared helper - Update LSIF to use SymbolView::generic_params() instead of manual scope_graph.children() filtering
When ingot config metadata doesn't have a name field, fall back to
kind-based names ("core", "std") instead of "unknown". This fixes
symbol identity mismatches where definitions use "unknown 0.0.0" but
cross-ingot references use the proper "core 0.1.0" package name.
Impl/ImplTrait blocks have no resolvable pretty_path, so item_symbol()
returns None and the child-indexing block is never reached. Meanwhile,
methods inside these blocks are skipped by items_dfs because their
parent is a container. This left method-level type params (e.g. T, U, F
in `impl Applicative for Result<E> { fn ap<T, U, F>(...) }`) unindexed.
Fix: after indexing an unnamed item's own generic params, also iterate
its children and index their generic params with synthetic parent
symbols. Add regression tests for impl block method type params and
builtin core ingot symbol identity.
collect_ingot_urls was treating workspace roots as single ingots because containing_ingot found the workspace's fe.toml and created an Ingot with no ingot metadata (workspace configs have no name/version). This produced "unknown 0.0.0" symbols in all SCIP output for workspace doc generation. Root cause: the function checked containing_ingot before checking whether the fe.toml was a workspace config. Now it checks for [workspace] first and expands to member URLs, only falling through to single-ingot mode when no workspace config is found. Also introduces generate_scip_with_root to accept workspace root for relative path computation, ensuring SCIP document paths match the display_file paths used by the doc extractor's source views. Unifies enrichment so both file:// and builtin:// ingots go through enrich_signatures_with_base.
The § anchor link was only visible on hover for impl blocks, method items, and h2 headers. Now also visible for member-item (variants, fields, etc.) and implementor-item elements. Also fix double border on signature blocks containing fe-code-block by suppressing the inner wrapper's border/margin/background.
The source toggle was inside the flex item-header, causing code blocks to be constrained to the right side of the header row. Now the file:line stays in the header as a static label, and the expandable source view sits below as a full-width collapsible block capped at 70vh.
Signature blocks were wrapped in <pre class="signature"> around <fe-code-block>, causing double borders since the shadow DOM wrapper has its own border/background. Now fe-code-block gets the class directly (e.g. class="signature") with no outer wrapper. For inline contexts (member-header, code-header, implementor-sig), use CSS custom properties (--fe-code-bg, --fe-code-border) which inherit through shadow DOM boundaries, replacing the unreachable descendant selectors that couldn't pierce the shadow root.
The file:line label now serves as the toggle summary for the source view, instead of being in the header with a separate "Source" button below. Clicking the file path expands the source code.
Line numbers were 0.8rem while code text was 0.875rem, causing them to drift out of alignment over many lines. Both now use 0.875rem.
Both line numbers and code text now use 0.8rem (down from 0.875rem), keeping them aligned while making source views visually smaller than the surrounding documentation text. Tightened padding to match.
The item name (h1) and signature wrapper now show a subtle § link on hover for easy deep-linking. Also tighten member-header gap to reduce space between the § anchor and the member signature.
Reduce gap to 0.25rem and zero out anchor margin-right for member-header, method-header, and implementor-item elements.
Move signature-wrapper anchor to left margin, remove gap properties from member-header/method-header/implementor-item, and zero out anchor margin-right for inline contexts so padding alone controls spacing.
…e margin - Move all § anchors (member-header, method-header, implementor-item, impl-header, h2, item-header h1, signature-wrapper) to absolute positioning at left: -1.25rem in the page padding - Remove gap properties from inline flex containers; padding alone controls spacing - Remove duplicate shadow-DOM-unreachable styles from styles.css; fe-highlight.css is now the single source of truth for code block internals - Add --fe-code-size and --fe-code-line-height CSS custom properties for consistent theming - Add explicit line-height on line-number spans to prevent drift
- Remove all absolute-positioning hacks from anchors; use simple inline flex-item approach with fixed 1rem width across all contexts - Fix stray CSS brace that broke stylesheet parsing - Remove duplicate position:relative from containers - Fix line number / code drift: set font properties on <pre> directly and use inherit on <code> to prevent browser defaults from diverging - Remove dead shadow-DOM-unreachable wrapper/gutter/code rules from styles.css
- Unify border-radius to 4px across impl-block, implementor-item, member-item, method-item - Match padding across impl-block summary and inner items (0.375rem 0.625rem) - Add background/border-radius to method-item to match member-item - Remove redundant summary/no-toggle padding overrides - Remove signature-wrapper: main item signature is just a fe-code-block now (h1 anchor is sufficient) - Add align-self: center and line-height: 1 to .anchor for vertical centering
- Move all § anchors to appear after content (not before) in member headers, impl headers, method headers, and implementor items - Make .anchor a simple inline element with margin-left, no flex/width tricks - Restore signature-wrapper for main item signature with border suppression on inner fe-code-block to prevent double border - All anchors now use the same simple pattern: inline, after content, appear on hover
Anchors are now the last child in flex rows with margin-left: auto, pushing them flush to the right edge.
Replace div with <a> so clicking navigates to the impl block. Use baseline alignment for signature flex rows. Anchor sits far-right via margin-left: auto.
- Collapse nested if blocks in extract.rs and scip_index.rs - Use !is_empty() instead of len() >= 1 - Avoid owned string comparison in test - Switch implementor arrow to ↪, remove bold weight
Collaborator
Author
|
this should be ready as ever |
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.
Builds on #1175.
Summary
Interactive documentation engine for Fe, with SCIP-powered code intelligence that works both as static sites, embeddable web components, and live-updating pages during LSP development.
What this adds
fe docCLI — Subcommand-based interface for documentation generation:Shared flags:
path(positional),--output,--builtins(include core/std).fe-webcrate — Documentation model, rendering, and web componentsDocIndexmodel types with module tree, trait impls, rich signaturesfe-web.jsbundle for external site integrationdocs.jsonformat (DocIndex + SCIP in one file)Web components — Flat, provider-free elements for embedding Fe docs:
<fe-code-block>— Syntax highlighting + SCIP annotations. Attributes:symbol(fetch source from DocIndex),region(extract// #region nameblocks),data-file,line-numbers,collapsed<fe-doc-item symbol="...">— Full doc item rendering, delegates to the samerenderDocItem()as the static site. Attributes:compact,show-source<fe-symbol-link symbol="...">— Inline type link with SCIP hover + tooltip<fe-signature data="...">— Type-linked function signature<fe-search>— Fuzzy search over the doc indexIntegration API — One script tag, one data file:
data-srcpoints todocs.json(fetched at load time)data-docssets the base URL for type links to the full API docs--fe-hl-keyword,--fe-hl-type,--fe-code-bg,--fe-code-font, etc.SCIP code intelligence — Click-to-navigate, hover highlighting, symbol search
fe scipCLI for standalone SCIP index generationOptionfromcoreis clickable in user code)__sig__/paths)inject_doc_urlslinks SCIP symbols to documentation pagesenrich_signaturesoverlays compiler-resolved type links onto signaturesfeEnrichLink,feWhenReady,feFindItem,feEscapeHtml) eliminate duplication across componentsLive doc reload via LSP — Docs update as you edit code
fe/docReloadnotification pushes updated DocIndex + SCIP to browser<fe-code-block>preserves raw source while re-rendering highlighted contentHIR additions —
SymbolViewandReferenceIndexinhir::core::semanticSymbolView: unified API for item and sub-item metadata (name, kind, docs, signature, children)ReferenceIndex: inverted index of scope references, built once per ingotFiles changed
crates/fe-web/crates/fe/src/(doc infra)main.rs,scip_index.rs,lsif.rs,Cargo.tomlcrates/hir/symbol.rs(~600 LOC)scope_graph.rs,semantic/mod.rs(small)crates/language-server/combined_server.rs,ws_lsp.rsserver.rs,handlers.rs,lib.rs, + 8 othersTest plan
cargo clippy --workspace --all-targets --all-featurescleancargo fmt --all -- --checkcleancargo check -p fe-hir --target wasm32-unknown-unknownpassescargo test -p fe-web— 46 tests passcargo test -p fe-language-server— 83 tests passcargo test -p fe— 260 tests pass (36 unit + 15 CLI + 208 fixture + 1 integration)fe doc staticgenerates working site with SCIP navigationfe doc jsonproduces merged docs.jsonfe doc bundlewrites standalone fe-web.jsOption, etc.) resolve and link correctlyfe lspwith doc server: live reload updates docs on file editfe/navigate(hover in editor → browser follows) works