Skip to content

feat(playground): add multi-file editor with file explorer#10353

Open
JoshLove-msft wants to merge 3 commits intomicrosoft:mainfrom
JoshLove-msft:feat/playground-file-explorer
Open

feat(playground): add multi-file editor with file explorer#10353
JoshLove-msft wants to merge 3 commits intomicrosoft:mainfrom
JoshLove-msft:feat/playground-file-explorer

Conversation

@JoshLove-msft
Copy link
Copy Markdown
Contributor

Multi-file editor support for the TypeSpec playground

Adds the ability to work with multiple input files in the playground editor.

Changes

  • Multi-file state: Added files, selectedFile, and normalized accessors to PlaygroundState
  • useMonacoModels hook: Manages Monaco editor model lifecycle per file (create/update/dispose)
  • File tree explorer: Shows in the editor panel when multiple input files exist, using the existing FileTreeExplorer component
  • Multi-file compile: Writes all files to BrowserHost virtual FS and clears stale .tsp files before each compilation
  • EditorPanel wiring: Passes inputFiles, selectedInputFile, onSelectedInputFileChange from playground state
  • Tests: 13 tests for usePlaygroundState multi-file support

Follow-up work

  • Per-file diagnostics mapping (map diagnostics to correct Monaco model based on source file)
  • GitHub spec loader (load TypeSpec files from the specs repo)

JoshLove-msft and others added 3 commits April 12, 2026 19:48
Add files, selectedFile to PlaygroundState. Normalize single-file
content into files Record. Update compile function to write all
files to virtual FS.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add useMonacoModels hook for managing multiple Monaco editor models
- Add file tree explorer panel that shows when multiple input files exist
- Update EditorPanel to accept inputFiles, selectedInputFile props
- Wire multi-file compile: write all files to BrowserHost, clear stale ones
- Add normalized multi-file accessors to playground state

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- 13 tests for usePlaygroundState multi-file support
- Tests cover: files normalization, isMultiFile, selectedFile defaults,
  onSelectedFileChange, onFilesChange, onFileContentChange
- Add changeset for @typespec/playground

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant