MCPcopy Create free account
hub / github.com/Wscats/vscode-explore / isValidCommand

Function isValidCommand

contributes/src/schema.ts:34–60  ·  view source on GitHub ↗
(command: IUserFriendlyCommand, collector: ExtensionMessageCollector)

Source from the content-addressed store, hash-verified

32 }
33
34 export function isValidCommand(command: IUserFriendlyCommand, collector: ExtensionMessageCollector): boolean {
35 if (!command) {
36 collector.error(localize('nonempty', "expected non-empty value."));
37 return false;
38 }
39 if (typeof command.command !== 'string') {
40 collector.error(localize('requirestring', "property `{0}` is mandatory and must be of type `string`", 'command'));
41 return false;
42 }
43 if (command.alt && typeof command.alt !== 'string') {
44 collector.error(localize('optstring', "property `{0}` can be omitted or must be of type `string`", 'alt'));
45 return false;
46 }
47 if (command.when && typeof command.when !== 'string') {
48 collector.error(localize('optstring', "property `{0}` can be omitted or must be of type `string`", 'when'));
49 return false;
50 }
51 if (command.group && typeof command.group !== 'string') {
52 collector.error(localize('optstring', "property `{0}` can be omitted or must be of type `string`", 'group'));
53 return false;
54 }
55 if (command.component && typeof command.component !== 'string') {
56 collector.error(localize('optstring', "property `{0}` can be omitted or must be of type `string`", 'component'));
57 return false;
58 }
59 return true;
60 }
61
62 const toolbarsItem: IJSONSchema = {
63 type: 'object',

Callers

nothing calls this directly

Calls 2

localizeFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected