Merge from vscode 2e5312cd61ff99c570299ecc122c52584265eda2

This commit is contained in:
ADS Merger
2020-04-23 02:50:35 +00:00
committed by Anthony Dresser
parent 3603f55d97
commit 7f1d8fc32f
659 changed files with 22709 additions and 12497 deletions

View File

@@ -23,8 +23,8 @@ import { joinPath, basename } from 'vs/base/common/resources';
const id = 'workbench.action.openSnippets';
namespace ISnippetPick {
export function is(thing: object): thing is ISnippetPick {
return thing && URI.isUri((<ISnippetPick>thing).filepath);
export function is(thing: object | undefined): thing is ISnippetPick {
return !!thing && URI.isUri((<ISnippetPick>thing).filepath);
}
}

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { IJSONSchema, IJSONSchemaMap } from 'vs/base/common/jsonSchema';
import { Registry } from 'vs/platform/registry/common/platform';
import * as JSONContributionRegistry from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
import * as nls from 'vs/nls';
@@ -25,6 +25,25 @@ export interface ISnippetsService {
}
const languageScopeSchemaId = 'vscode://schemas/snippets';
const snippetSchemaProperties: IJSONSchemaMap = {
prefix: {
description: nls.localize('snippetSchema.json.prefix', 'The prefix to used when selecting the snippet in intellisense'),
type: ['string', 'array']
},
body: {
markdownDescription: 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`.'),
type: ['string', 'array'],
items: {
type: 'string'
}
},
description: {
description: nls.localize('snippetSchema.json.description', 'The snippet description.'),
type: ['string', 'array']
}
};
const languageScopeSchema: IJSONSchema = {
id: languageScopeSchemaId,
allowComments: true,
@@ -38,23 +57,7 @@ const languageScopeSchema: IJSONSchema = {
additionalProperties: {
type: 'object',
required: ['prefix', 'body'],
properties: {
prefix: {
description: nls.localize('snippetSchema.json.prefix', 'The prefix to used when selecting the snippet in intellisense'),
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\'.'),
type: ['string', 'array'],
items: {
type: 'string'
}
},
description: {
description: nls.localize('snippetSchema.json.description', 'The snippet description.'),
type: ['string', 'array']
}
},
properties: snippetSchemaProperties,
additionalProperties: false
}
};
@@ -75,24 +78,10 @@ const globalSchema: IJSONSchema = {
type: 'object',
required: ['prefix', 'body'],
properties: {
prefix: {
description: nls.localize('snippetSchema.json.prefix', 'The prefix to used when selecting the snippet in intellisense'),
type: ['string', 'array']
},
...snippetSchemaProperties,
scope: {
description: nls.localize('snippetSchema.json.scope', "A list of language names to which this snippet applies, e.g. 'typescript,javascript'."),
type: 'string'
},
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\'.'),
type: ['string', 'array'],
items: {
type: 'string'
}
},
description: {
description: nls.localize('snippetSchema.json.description', 'The snippet description.'),
type: 'string'
}
},
additionalProperties: false