The parsed package.json
What src declares
it('the manifest agrees with what src declares', () => {
assertManifestMatches(JSON.parse(readFileSync('package.json', 'utf8')), {
settings: [Settings, EditorSettings],
commands: Object.values(Contracts),
views: Object.values(VIEWS),
keybindings: { allow: ['workbench.action.files.save'] },
engines: true,
});
});
Fails when
package.jsonand the declarations insrcdisagree.VS Code reads the manifest before an extension's code runs, so the two can never collapse into one file — the Command Palette and the Settings UI need titles and descriptions that only the manifest can carry, and a handler's argument types are something only
srccan express. What overlaps is small and mechanical: ids, types, defaults, enum values, scopes.This treats
srcas the authority for that overlap. A failure names what the manifest is missing and prints the JSON to paste, so the fix is always "update the manifest", never "go and change the code to match".It reports every mismatch in one throw and has no test-runner dependency. It does not validate unrelated contribution points, activation events, localization files or whether VS Code accepts the complete manifest; retain a packaging/Extension Host lane for those concerns.
Of a keybinding it reads the command id and nothing else. The key,
whenandargsstay the manifest's, as does the order of the entries — which is what decides the winner when several share a key, so an extension that depends on that order needs its own assertion for it.Of
enginesit readsvscode, and asks only that the range admit no VS Code older than this package runs on. How far above that the range starts is the extension's to decide.