Repository navigation
Support JSON flags for the theme language server - #9006
Open
gonzaloriestra wants to merge 6 commits into
Open
gonzaloriestra wants to merge 6 commits into
gonzaloriestra wants to merge 6 commits into
Conversation
Contributor
Author
|
/snapit |
Contributor
|
🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm. Built from Test the snapshot by installing your package globally: pnpm i -g --@shopify:registry=https://registry.npmjs.org @shopify/[email protected]Caution After installing, validate the version by running |
gonzaloriestra
marked this pull request as ready for review
October 27, 2026 12:12
This branch has not been deployed
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.
WHY are these changes introduced?
Fixes https://github.com/shop/issues-develop/issues/24319.
The theme language server already outputs JSON through LSP, but does not accept
--jsonor declare its output schema. CLI errors can also corrupt its stdout when JSON output is enabled globally.WHAT is this pull request doing?
Support
--json(-j) while preserving native LSP messages and Content-Length framing. Keep CLI diagnostics and argument/startup errors on stderr, and make the shared fatal-error handler respect the command's explicit output context.Register a schema for JSON-RPC requests, notifications, successful responses, and protocol errors.
--json-schemaprints the contract and exits without starting the server. Method-specific payloads follow LSP. Refresh generated help, remove the lint exception, and add schema and protocol regression coverage.How to manually test your changes?
pnpm shopify theme language-server --json-schema. Confirm that it prints a JSON Schema and exits without starting the server. Repeat with--json --json-schema, then withSHOPIFY_FLAG_JSON_SCHEMA=1 pnpm shopify theme language-server.pnpm shopify theme language-server. Initialize the session, make an editor request, then sendshutdownfollowed byexit.pnpm shopify theme language-server --json, then withSHOPIFY_FLAG_JSON=1. Confirm that the client receives the same framed JSON-RPC messages on stdout.pnpm shopify theme language-server --json --invalid > lsp.stdout 2> lsp.stderr. Confirm that the argument error appears on stderr and stdout stays empty.Checklist
minorfor CLI flag support andpatchfor CLI Kit error routing) and added a changeset.