Skip to content

fix: don't show file tree view in playground output for single file#10212

Open
Copilot wants to merge 3 commits intomainfrom
copilot/update-playground-logic
Open

fix: don't show file tree view in playground output for single file#10212
Copilot wants to merge 3 commits intomainfrom
copilot/update-playground-logic

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 31, 2026

When an emitter produces a single output file nested in a folder (e.g. src/openapi.yaml), the playground unnecessarily renders the full tree view with folder navigation panel. This adds clutter for emitters whose output is always nested.

  • Updated showFileTree condition in file-viewer.tsx to require outputFiles.length > 1 before considering folder nesting:
// Before
outputFiles.some((f) => f.includes("/")) || outputFiles.length >= 3

// After
outputFiles.length > 1 && (outputFiles.some((f) => f.includes("/")) || outputFiles.length >= 3)

Single nested file now renders with the simple tab view; tree view still activates for 2+ nested files or 3+ flat files.

…y a single file

Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/4c9e82f8-89d1-4169-a1dd-aa09c14ed865

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
@timotheeguerin timotheeguerin marked this pull request as ready for review March 31, 2026 14:06
Copilot AI changed the title [WIP] Update playground logic to handle single file output fix: don't show file tree view in playground output for single file Mar 31, 2026
Copilot AI requested a review from timotheeguerin March 31, 2026 14:06
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 31, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/playground@10212

commit: 74e3e22

@timotheeguerin
Copy link
Copy Markdown
Member

@copilot run formatter

Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/e8083b9a-6f02-42fa-adfe-73ae10f81a15

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 31, 2026

@copilot run formatter

Done in 74e3e22.

@azure-sdk
Copy link
Copy Markdown
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Playground don't render the tree view for the output if there is only a single file (even if its in a folder)

3 participants