Adopt new snippet syntax in JSON schema defaultSnippets (for #15573)

This commit is contained in:
Martin Aeschlimann
2016-11-25 17:04:18 +01:00
parent 93c1334282
commit ea26b957f6
12 changed files with 17 additions and 17 deletions

View File

@@ -117,7 +117,7 @@ export class BowerJSONContribution implements IJSONContribution {
if ((location.matches(['dependencies', '*']) || location.matches(['devDependencies', '*']))) {
// not implemented. Could be do done calling the bower command. Waiting for web API: https://github.com/bower/registry/issues/26
let proposal = new CompletionItem(localize('json.bower.latest.version', 'latest'));
proposal.insertText = '"{{latest}}"';
proposal.insertText = new SnippetString('"${1:latest}"');
proposal.filterText = '""';
proposal.kind = CompletionItemKind.Value;
proposal.documentation = 'The latest version of the package';

View File

@@ -14,7 +14,7 @@ const localize = nls.loadMessageBundle();
let globProperties: CompletionItem[] = [
{ kind: CompletionItemKind.Value, label: localize('fileLabel', "Files by Extension"), insertText: SnippetString.create('"**/*.${1:extension}": true'), documentation: localize('fileDescription', "Match all files of a specific file extension.") },
{ kind: CompletionItemKind.Value, label: localize('filesLabel', "Files with Multiple Extensions"), insertText: '"**/*.{ext1,ext2,ext3}": true', documentation: localize('filesDescription', "Match all files with any of the file extensions.") },
{ kind: CompletionItemKind.Value, label: localize('derivedLabel', "Files with Siblings by Name"), insertText: SnippetString.create('"**/*.${1:source-extension}": { "when": "$(basename).{{target-extension}}" }'), documentation: localize('derivedDescription', "Match files that have siblings with the same name but a different extension.") },
{ kind: CompletionItemKind.Value, label: localize('derivedLabel', "Files with Siblings by Name"), insertText: SnippetString.create('"**/*.${1:source-extension}": { "when": "$(basename).${2:target-extension}" }'), documentation: localize('derivedDescription', "Match files that have siblings with the same name but a different extension.") },
{ kind: CompletionItemKind.Value, label: localize('topFolderLabel', "Folder by Name (Top Level)"), insertText: SnippetString.create('"${1:name}": true'), documentation: localize('topFolderDescription', "Match a top level folder with a specific name.") },
{ kind: CompletionItemKind.Value, label: localize('topFoldersLabel', "Folders with Multiple Names (Top Level)"), insertText: '"{folder1,folder2,folder3}": true', documentation: localize('topFoldersDescription', "Match multiple top level folders.") },
{ kind: CompletionItemKind.Value, label: localize('folderLabel', "Folder by Name (Any Location)"), insertText: SnippetString.create('"**/${1:name}": true'), documentation: localize('folderDescription', "Match a folder with a specific name in any location.") },

View File

@@ -29,7 +29,7 @@ export const languagesExtPoint: IExtensionPoint<ILanguageExtensionPoint[]> = Ext
type: 'array',
items: {
type: 'object',
defaultSnippets: [{ body: { id: '{{languageId}}', aliases: ['{{label}}'], extensions: ['{{extension}}'], configuration: './language-configuration.json' } }],
defaultSnippets: [{ body: { id: '${1:languageId}', aliases: ['${2:label}'], extensions: ['${3:extension}'], configuration: './language-configuration.json' } }],
properties: {
id: {
description: nls.localize('vscode.extension.contributes.languages.id', 'ID of the language.'),

View File

@@ -26,7 +26,7 @@ let snippetsExtensionPoint = ExtensionsRegistry.registerExtensionPoint<ISnippets
defaultSnippets: [{ body: [{ language: '', path: '' }] }],
items: {
type: 'object',
defaultSnippets: [{ body: { language: '{{id}}', path: './snippets/{{id}}.json.' } }],
defaultSnippets: [{ body: { language: '${1:id}', path: './snippets/${2:id}.json.' } }],
properties: {
language: {
description: nls.localize('vscode.extension.contributes.snippets-language', 'Language identifier for which this snippet is contributed to.'),

View File

@@ -36,10 +36,10 @@ export interface ITMSyntaxExtensionPoint {
export const grammarsExtPoint: IExtensionPoint<ITMSyntaxExtensionPoint[]> = ExtensionsRegistry.registerExtensionPoint<ITMSyntaxExtensionPoint[]>('grammars', [languagesExtPoint], <any>{
description: nls.localize('vscode.extension.contributes.grammars', 'Contributes textmate tokenizers.'),
type: 'array',
defaultSnippets: [{ body: [{ language: '{{id}}', scopeName: 'source.{{id}}', path: './syntaxes/{{id}}.tmLanguage.' }] }],
defaultSnippets: [{ body: [{ language: '${1:id}', scopeName: 'source.${2:id}', path: './syntaxes/${3:id}.tmLanguage.' }] }],
items: {
type: 'object',
defaultSnippets: [{ body: { language: '{{id}}', scopeName: 'source.{{id}}', path: './syntaxes/{{id}}.tmLanguage.' } }],
defaultSnippets: [{ body: { language: '${1:id}', scopeName: 'source.${2:id}', path: './syntaxes/${3:id}.tmLanguage.' } }],
properties: {
language: {
description: nls.localize('vscode.extension.contributes.grammars.language', 'Language identifier for which this syntax is contributed to.'),

View File

@@ -175,7 +175,7 @@ const schema: IJSONSchema = {
type: 'array',
items: {
type: 'string',
defaultSnippets: [{ label: 'onLanguage', body: 'onLanguage:{{languageId}}' }, { label: 'onCommand', body: 'onCommand:{{commandId}}' }, { label: 'onDebug', body: 'onDebug:{{type}}' }, { label: 'workspaceContains', body: 'workspaceContains:{{fileName}}' }],
defaultSnippets: [{ label: 'onLanguage', body: 'onLanguage:${1:languageId}' }, { label: 'onCommand', body: 'onCommand:${2:commandId}' }, { label: 'onDebug', body: 'onDebug:${3:type}' }, { label: 'workspaceContains', body: 'workspaceContains:${4:fileName}' }],
}
},
badges: {

View File

@@ -18,10 +18,10 @@ interface IJSONValidationExtensionPoint {
let configurationExtPoint = ExtensionsRegistry.registerExtensionPoint<IJSONValidationExtensionPoint[]>('jsonValidation', [], {
description: nls.localize('contributes.jsonValidation', 'Contributes json schema configuration.'),
type: 'array',
defaultSnippets: [{ body: [{ fileMatch: '{{file.json}}', url: '{{url}}' }] }],
defaultSnippets: [{ body: [{ fileMatch: '${1:file.json}', url: '${2:url}' }] }],
items: {
type: 'object',
defaultSnippets: [{ body: { fileMatch: '{{file.json}}', url: '{{url}}' } }],
defaultSnippets: [{ body: { fileMatch: '${1:file.json}', url: '${2:url}' } }],
properties: {
fileMatch: {
type: 'string',

View File

@@ -124,7 +124,7 @@ let schema: IJSONSchema = {
'id': schemaId,
'defaultSnippets': [{
'label': nls.localize('snippetSchema.json.default', "Empty snippet"),
'body': { '{{snippetName}}': { 'prefix': '{{prefix}}', 'body': '{{snippet}}', 'description': '{{description}}' } }
'body': { '${1:snippetName}': { 'prefix': '${2:prefix}', 'body': '${3:snippet}', 'description': '${4:description}' } }
}],
'type': 'object',
'description': nls.localize('snippetSchema.json', 'User snippet configuration'),

View File

@@ -1361,7 +1361,7 @@ let schema: IJSONSchema =
{
'label': 'Empty task',
'body': {
'taskName': '{{taskName}}'
'taskName': '${1:taskName}'
}
}
]

View File

@@ -200,10 +200,10 @@ suite('Configuration Resolver Service', () => {
schemas: [
{
fileMatch: [
'{{/myfile}}',
'{{/myOtherfile}}'
'/myfile',
'/myOtherfile'
],
url: '{{schemaURL}}'
url: 'schemaURL'
}
]
}

View File

@@ -277,7 +277,7 @@ let schema: IJSONSchema = {
'items': {
'required': ['key'],
'type': 'object',
'defaultSnippets': [{ 'body': { 'key': '{{_}}', 'command': '{{_}}', 'when': '{{_}}' } }],
'defaultSnippets': [{ 'body': { 'key': '$1', 'command': '$2', 'when': '$3' } }],
'properties': {
'key': {
'type': 'string',

View File

@@ -58,7 +58,7 @@ let themesExtPoint = ExtensionsRegistry.registerExtensionPoint<IThemeExtensionPo
type: 'array',
items: {
type: 'object',
defaultSnippets: [{ body: { label: '{{label}}', uiTheme: VS_DARK_THEME, path: './themes/{{id}}.tmTheme.' } }],
defaultSnippets: [{ body: { label: '${1:label}', uiTheme: VS_DARK_THEME, path: './themes/${2:id}.tmTheme.' } }],
properties: {
label: {
description: nls.localize('vscode.extension.contributes.themes.label', 'Label of the color theme as shown in the UI.'),
@@ -82,7 +82,7 @@ let iconThemeExtPoint = ExtensionsRegistry.registerExtensionPoint<IThemeExtensio
type: 'array',
items: {
type: 'object',
defaultSnippets: [{ body: { id: '{{id}}', label: '{{label}}', path: './fileicons/{{id}}-icon-theme.json' } }],
defaultSnippets: [{ body: { id: '${1:id}', label: '${2:label}', path: './fileicons/${3:id}-icon-theme.json' } }],
properties: {
id: {
description: nls.localize('vscode.extension.contributes.iconThemes.id', 'Id of the icon theme as used in the user settings.'),