@W-22653715 adding docs browser in vs extension#487
Open
charithaT07 wants to merge 8 commits into
Open
Conversation
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.
Summary
Brief description of what this PR does.
What this PR does
Adds a new Docs Browser to the B2C DX VS Code extension. It's an
offline-first, in-editor reference for the SFCC Script API (
dw.*) — everyclass, interface, enum, method, property, and constant on the Script API
surface, available without leaving your editor.
Right-click any
dw.*symbol in a JavaScript or TypeScript cartridge file→ View B2C Docs → reader panel opens beside your code with the
signature, parameters, return type, throws, examples, and full description.
Class pages list all members inline so you can navigate without going back
to the sidebar.
Why
B2C developers lose 15–30 minutes a day context-switching between VS Code
and the official documentation site to look up Script API methods. The Docs
Browser eliminates that switch and removes the network dependency: 7,366
entries ship inside the VSIX and work fully offline.
This is also a Prophet-parity feature — Prophet's Script API browser is one
of the most-used parts of that extension, and we needed a first-party
equivalent.
Where the data comes from
JSDoc comments inside
@salesforce/b2c-script-types.d.tsfiles vendoredinto this repo at version 26.7.0. The same data already powers the
extension's IntelliSense — the Docs Browser is its rich reader complement.
Features
B2C-DX → Docs. Browse alldw.*packages and classes.with full signatures. Every row is clickable.
as equivalent (
dw.order.BasketMgranddw/order/BasketMgrmatch the same entry)..js/.tscartridge files. Resolvesvia Go-to-Definition for accuracy (no scraping).
Alt+D→ search docsAlt+Shift+D→ view docs at cursor (cartridge files only)b2c-dx.features.docsBrowserto disable everything.Architecture
scripts/build-docs-index/) parses.d.tsfiles withts-morphinto a normalizedDocEntry[]schema. Output is byte-deterministicand gated by CI to prevent stale committed JSON.
src/docs-browser/) lazy-loads three tiers:Class member tables read straight from the search dictionary, so opening a
class page never blocks the UI thread on the multi-megabyte full source.
unsafe-eval, andHTML built entirely host-side from a tiny allowlist Markdown renderer.
Test plan
pnpm --filter b2c-vs-extension run typecheck:agent— cleanpnpm --filter b2c-vs-extension run lint:agent— cleanpnpm --filter b2c-vs-extension run test— 264 unit + 4 integrationtests passing, 0 failing
pnpm --filter b2c-vs-extension run build:docs-indexdeterministicacross rebuilds (CI gate fails on drift)
What changed
src/docs-browser/(loader, search, tree, webview, recents,symbol resolver, entry renderer, Markdown renderer).
scripts/build-docs-index/plus generated index inresources/docs/.Alt+D,Alt+Shift+D) and four new commands.docs/vscode-extension/docs-browser.md.ts-morph(build-time only, not bundled).Testing
How was this tested?
Dependencies
3pl-approvedis set by a maintainerpnpm test)pnpm run format)