feat(Schema) Add JSON schema for the extensions config files - #21
Merged
Conversation
Contributes a JSON schema via "contributes.jsonValidation" so the ".vscode/extensions*.json(c)" files get validation, autocompletion and hover documentation in the editor, similar to the original "extensions.json". The built-in ".vscode/extensions.json" is excluded from the file match, since VSCode already provides its own schema for that file. Closes #5 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FJF6ffB8m6M5TKuBTwCKfT
Registers the schema via "contributes.jsonValidation", documents the editor support in the README and covers the contribution with unit tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FJF6ffB8m6M5TKuBTwCKfT
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FJF6ffB8m6M5TKuBTwCKfT
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.
Closes #5
What
Ships a JSON schema for the config files this extension reads, so
.vscode/extensionsVersionCheck.json(c)gets validation, autocompletion and hover documentation in the editor — the "built in help" the issue asked for, comparable to what VS Code offers for the originalextensions.json.It is contributed via
contributes.jsonValidation, so it is pure metadata: no activation event, no runtime code, nothing to load.The
fileMatchmirrors the discovery glob insrc/utils.ts(**/.vscode/extensions*.{json,jsonc}), so every file the extension actually reads is covered.Why
.vscode/extensions.jsonis excludedVS Code registers its own schema for that file and combines contributed schemas with the built-in one rather than replacing it. Its schema declares
additionalProperties: falseand restricts entries to plainpublisher.name, so:publisher.name@1.0.0entries as invalid, and we cannot suppress thatExcluding it keeps the diagnostics clean and matches what the README already recommends: version ranges belong in
extensionsVersionCheck.json(c). Note that exclusion patterns must stay last infileMatch— the last matching pattern wins.What the schema gives you
${publisher}.${name}[@versionRange], with a custompatternErrorMessageThe version part is matched permissively on purpose. A strict SemVer regex would reject documented forms such as
0.1 - 0.9,0.*or prerelease versions; real range validation issemver's job at runtime.Verification
vscode-json-languageservice(the very library VS Code uses): the schema resolves forextensionsVersionCheck.json(c)and otherextensions*variants including subfolders, does not claim.vscode/extensions.json, and reports zero diagnostics on theexampleProject/fixtures.vsce lsconfirmsschemas/extensionsVersionCheck.schema.jsonis included in the packaged VSIX.npm run compile,npm run lintandnpm run test:unitall pass (32 tests, 6 new).New unit tests in
src/test/unit/schema.test.tskeep the contribution honest: the schema file exists and is referenced, the built-inextensions.jsonstays excluded, thefileMatchstays in sync with the discovery glob, and every entry used in theexampleProject/fixtures is accepted by the pattern and is a valid SemVer range according toparseUnwantedEntry+semver.Notes
develop, per the branching convention in CLAUDE.md.[Unreleased]— no version bump, sosrc/config/releaseMessages.conf.tsis untouched. Happy to fold both into a release commit if you prefer.DiagnosticCollectionthat validates SemVer ranges (and would also reachextensions.json), completion of installed extension IDs, and publishing the schema to SchemaStore.Generated by Claude Code