Skip to content

chat: replace structured customization preview with markdown renderer, remove feature flag#314851

Draft
joshspicer wants to merge 4 commits into
mainfrom
agents/smart-markdown-rendering-update
Draft

chat: replace structured customization preview with markdown renderer, remove feature flag#314851
joshspicer wants to merge 4 commits into
mainfrom
agents/smart-markdown-rendering-update

Conversation

@joshspicer
Copy link
Copy Markdown
Member

Summary

Removes the chat.customizations.structuredPreview.enabled setting and replaces the custom front-matter/issues preview UI with a simple markdown render using IMarkdownRendererService — the same renderer used throughout VS Code.

Previously, when the setting was enabled, clicking a markdown customization file (agent, skill, instructions, prompt) in the AI Customizations editor would show:

  • A bespoke front-matter rows section (key/value pairs with hover help buttons)
  • A header issues box (for YAML parse errors)
  • A rendered markdown body

Now the preview renders the full markdown body directly, without the front-matter or issues sections. The preview/raw toggle button is preserved and still defaults to preview for the supported file types.

Changes

  • src/vs/workbench/contrib/chat/common/constants.ts — Remove ChatCustomizationsStructuredPreviewEnabled enum entry
  • src/vs/workbench/contrib/chat/browser/chat.contribution.ts — Remove config registration for the setting
  • src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.ts:
    • Remove renderPreviewIssues, renderPreviewFrontMatter, renderPreviewAttribute, stringifyPreviewValue, toPreviewObject, onStructuredPreviewSettingChanged
    • Remove editorPreviewIssuesContainer and editorPreviewFrontMatterContainer DOM fields
    • Remove unused imports (IHeaderAttribute, IValue, getAttributeDefinition, getTarget, Target)
    • isStructuredPreviewSupported no longer checks the removed setting — preview is always on for supported file types
  • src/vs/workbench/contrib/chat/test/browser/aiCustomization/aiCustomizationManagementEditor.test.ts — Remove tests that were specific to the old structured preview (front-matter help button, setting-off guards); keep editor-mode-button label/tooltip tests
  • src/vs/workbench/test/browser/componentFixtures/sessions/aiCustomizationManagementEditor.fixture.ts — Remove the setting override; fixtures use default config
  • src/vs/sessions/AI_CUSTOMIZATIONS.md — Update documentation section

Testing

  • npm run compile-check-ts-native passes
  • Hygiene check passes

Remove the 'chat.customizations.structuredPreview.enabled' setting and the
custom front-matter/issues UI it gated. The customization editor preview now
renders the markdown body directly via  the sameIMarkdownRendererService
renderer used everywhere else in VS  instead of a bespoke structuredCode
view with front-matter rows and error boxes.

The preview/raw toggle button is preserved and still defaults to preview for
agent, skill, instructions, and prompt files.

- Remove ChatCustomizationsStructuredPreviewEnabled enum entry and config reg
- Drop renderPreviewIssues, renderPreviewFrontMatter, renderPreviewAttribute,
  stringifyPreviewValue, toPreviewObject, and onStructuredPreviewSettingChanged
- Remove editorPreviewIssuesContainer and editorPreviewFrontMatterContainer
- Remove unused imports (IHeaderAttribute, IValue, getAttributeDefinition, getTarget)
- Update tests and fixture; update AI_CUSTOMIZATIONS.md doc

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 6, 2026 21:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR simplifies the Chat Customizations management editor’s markdown customization preview by removing the chat.customizations.structuredPreview.enabled feature flag and replacing the bespoke structured front-matter/issues UI with VS Code’s standard IMarkdownRendererService rendering of the markdown body.

Changes:

  • Removed the chat.customizations.structuredPreview.enabled configuration key (enum entry + configuration registration).
  • Simplified AICustomizationManagementEditor preview rendering to only render the parsed markdown body via IMarkdownRendererService (no front-matter rows or header issue box).
  • Updated tests/fixtures/docs to reflect the always-on rendered preview behavior for supported markdown customization file types.
Show a summary per file
File Description
src/vs/workbench/test/browser/componentFixtures/sessions/aiCustomizationManagementEditor.fixture.ts Drops the structured-preview config override from fixtures now that preview behavior is no longer flag-gated.
src/vs/workbench/contrib/chat/test/browser/aiCustomization/aiCustomizationManagementEditor.test.ts Removes tests tied to the old structured preview UI/setting; keeps mode button label/tooltip coverage.
src/vs/workbench/contrib/chat/common/constants.ts Removes the ChatCustomizationsStructuredPreviewEnabled enum entry.
src/vs/workbench/contrib/chat/browser/chat.contribution.ts Removes configuration registration for the deleted setting.
src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.ts Removes structured preview UI pieces and renders only the markdown body via IMarkdownRendererService; updates tooltip copy.
src/vs/sessions/AI_CUSTOMIZATIONS.md Updates Sessions documentation to describe the rendered markdown preview behavior.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 1

Comment on lines 1963 to 1968
private isStructuredPreviewSupported(promptType: PromptsType | undefined): boolean {
if (this.configurationService.getValue<boolean>(ChatConfiguration.ChatCustomizationsStructuredPreviewEnabled) !== true) {
return false;
}
return promptType === PromptsType.agent
|| promptType === PromptsType.skill
|| promptType === PromptsType.instructions
|| promptType === PromptsType.prompt;
}
@OrenMe
Copy link
Copy Markdown
Contributor

OrenMe commented May 7, 2026

Removing the dedicated frontmatter section 😥?

joshspicer and others added 3 commits May 7, 2026 15:22
Add 'chat.customizations.markdownPreview.enabled' (default: true) to let
users disable the rendered markdown preview in the AI Customizations editor.
When disabled the editor falls back to the raw code editor view, matching the
previous behaviour before the preview was introduced.

- Add ChatCustomizationsMarkdownPreviewEnabled enum entry and config registration
- Check setting in isStructuredPreviewSupported
- Add onMarkdownPreviewSettingChanged handler and wire up config listener
- Add test coverage for the setting toggle

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use parseFrontMatter from vs/base/common/yaml to split the file content,
then prepend a fenced ```yaml block to the body and pipe everything through
IMarkdownRendererService in a single render call. This fixes the gap where
the previous markdown-only preview hid all front-matter metadata
(description, mode, tools, etc.) from the user.

Renders through the standard markdown renderer (no bespoke DOM, no parallel
attribute schema, no JSON-stringified YAML, no duplicated diagnostics).

- Drop dependency on PromptFileParser's ParsedPromptFile in the preview path
- Drop renderPreviewBody helper; collapse into renderEditorPreview
- Add buildPreviewMarkdown helper that fences front matter as YAML
- Update empty-state copy: 'No content found in this file'

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Council review surfaced two correctness issues with the markdown preview
helper:

1. Front-matter values containing triple backticks (e.g. a description
   that mentions a fenced code block) closed our hardcoded fence early
   and corrupted the rendered preview. Compute the fence length
   dynamically as one longer than the longest backtick run inside the
   YAML payload.

2. Empty front matter (`---\n---`) and comment-only front matter
   (`---\n# note\n---\n...`) were rendered as <hr> separators because
   parseFrontMatter returns header: undefined for those inputs but
   still strips the delimiters from body. Detect this via 'body !==
   rawContent' and render the stripped header (which may be empty) as
   the fenced YAML payload, matching the with-header path.

Extract the helper as exported buildCustomizationPreviewMarkdown so it
can be unit-tested in isolation without instantiating the editor pane.
Add direct unit tests covering: no front matter, with front matter,
CRLF, triple backticks (4-tick fence), 4-tick run (5-tick fence), open
front matter, empty front matter, comment-only, and front matter only.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants