Add structured preview for markdown customizations#312545
Add structured preview for markdown customizations#312545joshspicer merged 6 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a structured “Preview” mode to the AI Customizations management editor for markdown-backed customization files, showing parsed front matter + rendered markdown body, with a toggle to switch to the raw editor/viewer.
Changes:
- Implement structured preview UI in
AICustomizationManagementEditor(front matter rows, help hovers, issues rendering, markdown body rendering, preview/raw toggle, focus + save announcements). - Add editor/preview styling to
aiCustomizationManagement.css. - Add unit tests + fixture updates to exercise preview/help behavior and generate realistic screenshot fixtures; document behavior in
AI_CUSTOMIZATIONS.md.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/test/browser/componentFixtures/sessions/aiCustomizationManagementEditor.fixture.ts | Updates fixtures/mocks to supply parsed prompt content + markdown rendering for preview/raw screenshot states. |
| src/vs/workbench/contrib/chat/test/browser/aiCustomization/aiCustomizationManagementEditor.test.ts | Adds unit coverage for mode button copy rules and preview help hover behavior. |
| src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationManagement.css | Adds styles for preview layout and the preview/raw toggle button. |
| src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.ts | Core implementation of structured preview, toggle state, debounced re-rendering, focus handling, and save status announcements. |
| src/vs/sessions/AI_CUSTOMIZATIONS.md | Documents the structured detail preview behavior and components used. |
|
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation. Happy Coding! |
joshspicer
left a comment
There was a problem hiding this comment.
Thank you, this looks awesome! Looks like I introduced some merge conflicts earlier today (which I have Opus on). Other than that I am ready to merge it 🚀
b297ead to
a043a88
Compare
Introduce a structured detail preview for markdown-backed customization files in the AI customization management editor. Changes include: - Docs: document the structured preview behavior in AI_CUSTOMIZATIONS.md. - Editor: add preview containers, front-matter/body rendering, issue rendering, a preview/raw toggle button and state, scheduling for re-render, accessibility labels, focus handling, and save status announcements. Integrate PromptFileParser, attribute definitions, and markdown renderer to build the preview. Support readonly/builtin edit rules and fall back to raw editor when unsupported. - CSS: add styles for the editor mode button, preview layout, front-matter rows, issue box and rendered body, and various accessibility/UX tweaks. - Tests & fixtures: add unit tests for editor preview/help behavior and update component fixtures to produce realistic prompt file contents, mock markdown rendering, model creation, and new screenshot fixtures for preview/raw scenarios. Overall this enables a user-friendly, structured view of front-matter and rendered markdown while preserving the ability to view/edit the raw source when needed.
Prevent preview rendering unless editor is in 'preview' mode and the prompt type supports structured previews, returning early and clearing the preview if not. Also set the MarkdownString.baseUri to the parsed prompt file URI before rendering so relative links/resources resolve correctly. Small refactor to create a markdown variable prior to rendering.
Use specific CSS class selectors (.ai-customization-list-item, .mcp-server-item) as the default fallback when openItemLabel is not provided, matching main's selector. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
a043a88 to
84b5e1c
Compare
… off) (#314416) * chat: gate structured customization preview behind a setting (default off) Adds chat.customizations.structuredPreview.enabled (boolean, default false, tag 'preview') to gate the structured markdown preview introduced in #312545. When disabled (the default), the AI Customizations editor falls back to the previous raw-only embedded code editor and hides the Preview/Raw toggle button. When enabled, the editor defaults to the structured preview view. Runtime toggling is handled via an onDidChangeConfiguration listener that snaps the display mode back to raw and clears the preview when the setting is turned off, or triggers a preview re-render when it is turned on with an item already open. Existing component fixtures and unit tests are updated to opt-in to the setting so the preview-first screenshot fixtures remain stable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add runtime test for structured preview setting toggle Adds a unit test that verifies disabling chat.customizations.structuredPreview.enabled at runtime forces the editor back to raw mode and hides the toggle button, addressing review feedback from the Copilot reviewer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix test assertion: use 'Edit' label for editable file in preview mode The initial sanity assertion in the runtime-toggle test was checking for 'View Raw' but the test editor has currentEditingReadOnly=false, so getEditorModeButtonLabel() returns 'Edit' when in preview mode. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix test stub: add clear() to editorPreviewDisposables clearEditorPreview() calls this.editorPreviewDisposables.clear() but the test stub only provided add() and dispose(). Add clear() to the stub so the runtime-toggle test does not throw. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Introduce a structured detail preview for markdown-backed customization files in the AI customization management editor. Changes include:
Overall this enables a user-friendly, structured view of front-matter and rendered markdown while preserving the ability to view/edit the raw source when needed.
ai_customizations_markdown_preview.mp4
Solves #312544
Original prompt
The plan request:The Plan.md