diff --git a/src/vs/workbench/parts/snippets/electron-browser/snippets.contribution.ts b/src/vs/workbench/parts/snippets/electron-browser/snippets.contribution.ts index 097cc085a9f1b9a953ee17e92de0aea4a125ec64..db63d04deee772a8018b6dee5c61958af7e97d90 100644 --- a/src/vs/workbench/parts/snippets/electron-browser/snippets.contribution.ts +++ b/src/vs/workbench/parts/snippets/electron-browser/snippets.contribution.ts @@ -41,7 +41,7 @@ const languageScopeSchema: IJSONSchema = { properties: { prefix: { description: nls.localize('snippetSchema.json.prefix', 'The prefix to used when selecting the snippet in intellisense'), - type: 'string' + type: ['string', 'array'] }, body: { description: nls.localize('snippetSchema.json.body', 'The snippet content. Use \'$1\', \'${1:defaultText}\' to define cursor positions, use \'$0\' for the final cursor position. Insert variable values with \'${varName}\' and \'${varName:defaultText}\', e.g \'This is file: $TM_FILENAME\'.'), @@ -76,7 +76,7 @@ const globalSchema: IJSONSchema = { properties: { prefix: { description: nls.localize('snippetSchema.json.prefix', 'The prefix to used when selecting the snippet in intellisense'), - type: 'string' + type: ['string', 'array'] }, scope: { description: nls.localize('snippetSchema.json.scope', "A list of language names to which this snippet applies, e.g 'typescript,javascript'."), diff --git a/src/vs/workbench/parts/snippets/electron-browser/snippetsFile.ts b/src/vs/workbench/parts/snippets/electron-browser/snippetsFile.ts index 61937bd275a175c856dfecd4f6d760f819382dba..5a99087e670cc36c2130917c94f10cb22353b11e 100644 --- a/src/vs/workbench/parts/snippets/electron-browser/snippetsFile.ts +++ b/src/vs/workbench/parts/snippets/electron-browser/snippetsFile.ts @@ -234,7 +234,7 @@ export class SnippetFile { body = body.join('\n'); } - if (typeof prefix !== 'string' || typeof body !== 'string') { + if ((typeof prefix !== 'string' && !Array.isArray(prefix)) || typeof body !== 'string') { return; } @@ -264,14 +264,17 @@ export class SnippetFile { } } - bucket.push(new Snippet( - scopes, - name, - prefix, - description, - body, - source, - this.source - )); + let prefixes = Array.isArray(prefix) ? prefix : [prefix]; + prefixes.forEach(p => { + bucket.push(new Snippet( + scopes, + name, + p, + description, + body, + source, + this.source + )); + }); } }