feat(playground): make raw tspconfig.yaml the source of truth with LSP#11016
Merged
timotheeguerin merged 2 commits intoJun 19, 2026
Merged
Conversation
commit: |
The YAML config tab was a lossy view regenerated from structured compiler options, so raw edits (comments, output-dir, warn-as-error, ordering, unknown fields) were reverted, and the editor had no language-server support. - Persist the raw tspconfig.yaml as the source of truth; derive emitter/options by parsing it and write back from the Visual form preserving comments/fields. - Compile by writing tspconfig.yaml and resolving it natively via resolveCompilerOptions so the full config is honored. - Register language-server completion for the tspconfig.yaml editor. - Persist tspconfig in shared links; keep reading legacy e=/options= links.
24b31f4 to
2abb87c
Compare
Contributor
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
catalinaperalta
approved these changes
Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The playground "Yaml" config tab (added in #9843) was a lossy view regenerated from the structured
compilerOptionson every mode/tab switch. As a result:output-dir,warn-as-error, key ordering, and any field the visual form doesn't model — were reverted when leaving the editor.yamlmodel with no LSP, even though the TypeSpec language server already supportstspconfig.yamlcompletion.Change
Make the raw
tspconfig.yamlthe source of truth.selectedEmitter/compilerOptionsare derived by parsing it; the Visual form and emitter dropdown write back viaupdateTspConfigYaml, which uses theyamlDocument API to preserve comments and unknown fields.tspconfig.yamlto the virtual FS and resolves it viaresolveCompilerOptions, so the playground honors the full config (emit,options,linter,imports,warn-as-error, …) like the real CLI.yamllanguage and a completion provider for models ending intspconfig.yaml, backed by the language server.tspconfigis persisted in shared links. Legacye=/options=links are still read for back-compat, but onlytspconfig=is written on save (stale legacy params are cleared).Notes
tspconfig.yaml(completion only), so config schema errors aren't shown inline — consistent with existing server behavior; possible follow-up.Tests
tspconfig-utils.test.tscovers comment/field preservation, emit removal, rebuild-from-empty, and parsing round-trips.