Skip to content

feat(extension): reveal the selected component in Elements and open its source - #223

Draft
erkamyaman wants to merge 1 commit into
pangular-inspector:mainfrom
erkamyaman:feat/extension-reveal-open-source
Draft

erkamyaman wants to merge 1 commit into
pangular-inspector:mainfrom
erkamyaman:feat/extension-reveal-open-source

Conversation

@erkamyaman

Copy link
Copy Markdown
Member

What and why

Selection only went one way, from the Elements panel to Components. This adds the other direction for #164.

  • Page side: component-source.ts reads ɵcmp.debugInfo (filePath, 1-based lineNumber, dev builds only) into detail.source, and installs __pangularHostOf / __pangularClassOf helpers scoped to the page id, only when the components inspector is on. No DOM writes.
  • Extension: panel-actions.js handles pangular:reveal-element (inspect(host)) and pangular:open-source (matches the file against getResources() and calls openResource, falling back to inspect(class)). Ids and page ids are validated, and only the UI frame on our origin can send.
  • Panel: the Components detail header shows file:line (debugInfo first, then the source scan), plus Reveal in Elements and Open source buttons, only inside the extension with a connected page (not Angular Native or a static report). Failures show in a status line.
  • Docs: components inspector, Chrome extension guide and the contributing extension page.

Refs #164

How it was verified

  • pnpm commit:check, pnpm format:check, pnpm typecheck, pnpm skills:check
  • pnpm test:devtools (1182) and pnpm test:panel (114)
  • pnpm docs:build, pnpm test:axe
  • pnpm extension:build and extension/ui committed
  • Manual test in real Chrome (below), not done yet, which is why this is a draft

Manual test

  1. pnpm build --configuration development && node dist/pangular-inspector/server/server.mjs, reload the unpacked extension/, open http://localhost:4000, then DevTools > Pangular Inspector > Components.
  2. Select a component: the header shows src/app/...ts:N and the two buttons. Reveal in Elements should select its host in Elements.
  3. Open source should open the .ts file at the export class line in Sources. If it's one line off, adjust line - 1 in extension/panel-actions.js; if compiled JS opens, getResources() doesn't list source-mapped files and the class fallback ran.
  4. The buttons don't show at http://localhost:4000/__devframes/pangular/ in a normal tab.

Decisions to confirm

  • Open source shows even without debugInfo, because the class fallback still works (the issue said to hide it).
  • The buttons aren't gated by actions: they don't change app state, add no RPC or agent tool. They need the components inspector on.

…ts source

Selection only went from the Elements panel to Components. The Components detail now shows the component's file and line from Angular's dev debugInfo, and, inside the Chrome extension, Reveal in Elements selects its host element and Open source opens the file in Sources, falling back to the class definition.

Refs pangular-inspector#164
@erkamyaman erkamyaman self-assigned this Oct 6, 2026
@coderabbitai

coderabbitai Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added area: panel The devtools panel app (app/) area: package The ng-devtools package (packages/ng-devtools) area: extension The Chrome extension area: agents MCP server, agent tools and resources area: docs The documentation site labels Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: agents MCP server, agent tools and resources area: docs The documentation site area: extension The Chrome extension area: package The ng-devtools package (packages/ng-devtools) area: panel The devtools panel app (app/)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant