diff --git a/src/vs/workbench/api/browser/viewsContainersExtensionPoint.ts b/src/vs/workbench/api/browser/viewsContainersExtensionPoint.ts index ab303823cb673560e9dca0ca7e504f1e7ee65f89..299da54da22290d32d6a4ebf7af2666622e98598 100644 --- a/src/vs/workbench/api/browser/viewsContainersExtensionPoint.ts +++ b/src/vs/workbench/api/browser/viewsContainersExtensionPoint.ts @@ -74,7 +74,10 @@ export const viewsContainersContribution: IJSONSchema = { } }; -export const viewsContainersExtensionPoint: IExtensionPoint<{ [loc: string]: IUserFriendlyViewsContainerDescriptor[] }> = ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: IUserFriendlyViewsContainerDescriptor[] }>('viewsContainers', [], viewsContainersContribution); +export const viewsContainersExtensionPoint: IExtensionPoint<{ [loc: string]: IUserFriendlyViewsContainerDescriptor[] }> = ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: IUserFriendlyViewsContainerDescriptor[] }>({ + extensionPoint: 'viewsContainers', + jsonSchema: viewsContainersContribution +}); const TEST_VIEW_CONTAINER_ORDER = 6; diff --git a/src/vs/workbench/api/browser/viewsExtensionPoint.ts b/src/vs/workbench/api/browser/viewsExtensionPoint.ts index 3f1efc2e324a05217c86dcb244063f67b0eed203..a8738c55bc6a5062bff53d62ff4a8e2eda69a90a 100644 --- a/src/vs/workbench/api/browser/viewsExtensionPoint.ts +++ b/src/vs/workbench/api/browser/viewsExtensionPoint.ts @@ -82,7 +82,11 @@ const viewsContribution: IJSONSchema = { }; -const viewsExtensionPoint: IExtensionPoint<{ [loc: string]: IUserFriendlyViewDescriptor[] }> = ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: IUserFriendlyViewDescriptor[] }>('views', [viewsContainersExtensionPoint], viewsContribution); +const viewsExtensionPoint: IExtensionPoint<{ [loc: string]: IUserFriendlyViewDescriptor[] }> = ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: IUserFriendlyViewDescriptor[] }>({ + extensionPoint: 'views', + deps: [viewsContainersExtensionPoint], + jsonSchema: viewsContribution +}); class ViewsContainersExtensionHandler implements IWorkbenchContribution { diff --git a/src/vs/workbench/parts/debug/common/debugSchemas.ts b/src/vs/workbench/parts/debug/common/debugSchemas.ts index f8b12d469ff56a2a3e5c772d4d7afe8f15c58422..422154c1cb8b0d1bb87bff5961a768e12bec0383 100644 --- a/src/vs/workbench/parts/debug/common/debugSchemas.ts +++ b/src/vs/workbench/parts/debug/common/debugSchemas.ts @@ -11,89 +11,92 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema'; import { inputsSchema } from 'vs/workbench/services/configurationResolver/common/configurationResolverSchema'; // debuggers extension point -export const debuggersExtPoint = extensionsRegistry.ExtensionsRegistry.registerExtensionPoint('debuggers', [], { - description: nls.localize('vscode.extension.contributes.debuggers', 'Contributes debug adapters.'), - type: 'array', - defaultSnippets: [{ body: [{ type: '', extensions: [] }] }], - items: { - type: 'object', - defaultSnippets: [{ body: { type: '', program: '', runtime: '', enableBreakpointsFor: { languageIds: [''] } } }], - properties: { - type: { - description: nls.localize('vscode.extension.contributes.debuggers.type', "Unique identifier for this debug adapter."), - type: 'string' - }, - label: { - description: nls.localize('vscode.extension.contributes.debuggers.label', "Display name for this debug adapter."), - type: 'string' - }, - program: { - description: nls.localize('vscode.extension.contributes.debuggers.program', "Path to the debug adapter program. Path is either absolute or relative to the extension folder."), - type: 'string' - }, - args: { - description: nls.localize('vscode.extension.contributes.debuggers.args', "Optional arguments to pass to the adapter."), - type: 'array' - }, - runtime: { - description: nls.localize('vscode.extension.contributes.debuggers.runtime', "Optional runtime in case the program attribute is not an executable but requires a runtime."), - type: 'string' - }, - runtimeArgs: { - description: nls.localize('vscode.extension.contributes.debuggers.runtimeArgs', "Optional runtime arguments."), - type: 'array' - }, - variables: { - description: nls.localize('vscode.extension.contributes.debuggers.variables', "Mapping from interactive variables (e.g ${action.pickProcess}) in `launch.json` to a command."), - type: 'object' - }, - initialConfigurations: { - description: nls.localize('vscode.extension.contributes.debuggers.initialConfigurations', "Configurations for generating the initial \'launch.json\'."), - type: ['array', 'string'], - }, - languages: { - description: nls.localize('vscode.extension.contributes.debuggers.languages', "List of languages for which the debug extension could be considered the \"default debugger\"."), - type: 'array' - }, - adapterExecutableCommand: { - description: nls.localize('vscode.extension.contributes.debuggers.adapterExecutableCommand', "If specified VS Code will call this command to determine the executable path of the debug adapter and the arguments to pass."), - type: 'string' - }, - configurationSnippets: { - description: nls.localize('vscode.extension.contributes.debuggers.configurationSnippets', "Snippets for adding new configurations in \'launch.json\'."), - type: 'array' - }, - configurationAttributes: { - description: nls.localize('vscode.extension.contributes.debuggers.configurationAttributes', "JSON schema configurations for validating \'launch.json\'."), - type: 'object' - }, - windows: { - description: nls.localize('vscode.extension.contributes.debuggers.windows', "Windows specific settings."), - type: 'object', - properties: { - runtime: { - description: nls.localize('vscode.extension.contributes.debuggers.windows.runtime', "Runtime used for Windows."), - type: 'string' +export const debuggersExtPoint = extensionsRegistry.ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'debuggers', + jsonSchema: { + description: nls.localize('vscode.extension.contributes.debuggers', 'Contributes debug adapters.'), + type: 'array', + defaultSnippets: [{ body: [{ type: '', extensions: [] }] }], + items: { + type: 'object', + defaultSnippets: [{ body: { type: '', program: '', runtime: '', enableBreakpointsFor: { languageIds: [''] } } }], + properties: { + type: { + description: nls.localize('vscode.extension.contributes.debuggers.type', "Unique identifier for this debug adapter."), + type: 'string' + }, + label: { + description: nls.localize('vscode.extension.contributes.debuggers.label', "Display name for this debug adapter."), + type: 'string' + }, + program: { + description: nls.localize('vscode.extension.contributes.debuggers.program', "Path to the debug adapter program. Path is either absolute or relative to the extension folder."), + type: 'string' + }, + args: { + description: nls.localize('vscode.extension.contributes.debuggers.args', "Optional arguments to pass to the adapter."), + type: 'array' + }, + runtime: { + description: nls.localize('vscode.extension.contributes.debuggers.runtime', "Optional runtime in case the program attribute is not an executable but requires a runtime."), + type: 'string' + }, + runtimeArgs: { + description: nls.localize('vscode.extension.contributes.debuggers.runtimeArgs', "Optional runtime arguments."), + type: 'array' + }, + variables: { + description: nls.localize('vscode.extension.contributes.debuggers.variables', "Mapping from interactive variables (e.g ${action.pickProcess}) in `launch.json` to a command."), + type: 'object' + }, + initialConfigurations: { + description: nls.localize('vscode.extension.contributes.debuggers.initialConfigurations', "Configurations for generating the initial \'launch.json\'."), + type: ['array', 'string'], + }, + languages: { + description: nls.localize('vscode.extension.contributes.debuggers.languages', "List of languages for which the debug extension could be considered the \"default debugger\"."), + type: 'array' + }, + adapterExecutableCommand: { + description: nls.localize('vscode.extension.contributes.debuggers.adapterExecutableCommand', "If specified VS Code will call this command to determine the executable path of the debug adapter and the arguments to pass."), + type: 'string' + }, + configurationSnippets: { + description: nls.localize('vscode.extension.contributes.debuggers.configurationSnippets', "Snippets for adding new configurations in \'launch.json\'."), + type: 'array' + }, + configurationAttributes: { + description: nls.localize('vscode.extension.contributes.debuggers.configurationAttributes', "JSON schema configurations for validating \'launch.json\'."), + type: 'object' + }, + windows: { + description: nls.localize('vscode.extension.contributes.debuggers.windows', "Windows specific settings."), + type: 'object', + properties: { + runtime: { + description: nls.localize('vscode.extension.contributes.debuggers.windows.runtime', "Runtime used for Windows."), + type: 'string' + } } - } - }, - osx: { - description: nls.localize('vscode.extension.contributes.debuggers.osx', "macOS specific settings."), - type: 'object', - properties: { - runtime: { - description: nls.localize('vscode.extension.contributes.debuggers.osx.runtime', "Runtime used for macOS."), - type: 'string' + }, + osx: { + description: nls.localize('vscode.extension.contributes.debuggers.osx', "macOS specific settings."), + type: 'object', + properties: { + runtime: { + description: nls.localize('vscode.extension.contributes.debuggers.osx.runtime', "Runtime used for macOS."), + type: 'string' + } } - } - }, - linux: { - description: nls.localize('vscode.extension.contributes.debuggers.linux', "Linux specific settings."), - type: 'object', - properties: { - runtime: { - description: nls.localize('vscode.extension.contributes.debuggers.linux.runtime', "Runtime used for Linux."), - type: 'string' + }, + linux: { + description: nls.localize('vscode.extension.contributes.debuggers.linux', "Linux specific settings."), + type: 'object', + properties: { + runtime: { + description: nls.localize('vscode.extension.contributes.debuggers.linux.runtime', "Runtime used for Linux."), + type: 'string' + } } } } @@ -106,18 +109,21 @@ export interface IRawBreakpointContribution { } // breakpoints extension point #9037 -export const breakpointsExtPoint = extensionsRegistry.ExtensionsRegistry.registerExtensionPoint('breakpoints', [], { - description: nls.localize('vscode.extension.contributes.breakpoints', 'Contributes breakpoints.'), - type: 'array', - defaultSnippets: [{ body: [{ language: '' }] }], - items: { - type: 'object', - defaultSnippets: [{ body: { language: '' } }], - properties: { - language: { - description: nls.localize('vscode.extension.contributes.breakpoints.language', "Allow breakpoints for this language."), - type: 'string' - }, +export const breakpointsExtPoint = extensionsRegistry.ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'breakpoints', + jsonSchema: { + description: nls.localize('vscode.extension.contributes.breakpoints', 'Contributes breakpoints.'), + type: 'array', + defaultSnippets: [{ body: [{ language: '' }] }], + items: { + type: 'object', + defaultSnippets: [{ body: { language: '' } }], + properties: { + language: { + description: nls.localize('vscode.extension.contributes.breakpoints.language', "Allow breakpoints for this language."), + type: 'string' + }, + } } } }); diff --git a/src/vs/workbench/parts/localizations/electron-browser/localizations.contribution.ts b/src/vs/workbench/parts/localizations/electron-browser/localizations.contribution.ts index ee89a7d8f5048cfcb8a465d096d11034268b3262..d841013ca21650c424bbf234d8567bca5e706bae 100644 --- a/src/vs/workbench/parts/localizations/electron-browser/localizations.contribution.ts +++ b/src/vs/workbench/parts/localizations/electron-browser/localizations.contribution.ts @@ -251,48 +251,51 @@ registerLocaleDefinitionSchema([platform.language]); const workbenchRegistry = Registry.as(WorkbenchExtensions.Workbench); workbenchRegistry.registerWorkbenchContribution(LocalizationWorkbenchContribution, LifecyclePhase.Eventually); -ExtensionsRegistry.registerExtensionPoint('localizations', [], { - description: localize('vscode.extension.contributes.localizations', "Contributes localizations to the editor"), - type: 'array', - default: [], - items: { - type: 'object', - required: ['languageId', 'translations'], - defaultSnippets: [{ body: { languageId: '', languageName: '', localizedLanguageName: '', translations: [{ id: 'vscode', path: '' }] } }], - properties: { - languageId: { - description: localize('vscode.extension.contributes.localizations.languageId', 'Id of the language into which the display strings are translated.'), - type: 'string' - }, - languageName: { - description: localize('vscode.extension.contributes.localizations.languageName', 'Name of the language in English.'), - type: 'string' - }, - localizedLanguageName: { - description: localize('vscode.extension.contributes.localizations.languageNameLocalized', 'Name of the language in contributed language.'), - type: 'string' - }, - translations: { - description: localize('vscode.extension.contributes.localizations.translations', 'List of translations associated to the language.'), - type: 'array', - default: [{ id: 'vscode', path: '' }], - items: { - type: 'object', - required: ['id', 'path'], - properties: { - id: { - type: 'string', - description: localize('vscode.extension.contributes.localizations.translations.id', "Id of VS Code or Extension for which this translation is contributed to. Id of VS Code is always `vscode` and of extension should be in format `publisherId.extensionName`."), - pattern: '^((vscode)|([a-z0-9A-Z][a-z0-9\-A-Z]*)\\.([a-z0-9A-Z][a-z0-9\-A-Z]*))$', - patternErrorMessage: localize('vscode.extension.contributes.localizations.translations.id.pattern', "Id should be `vscode` or in format `publisherId.extensionName` for translating VS code or an extension respectively.") +ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'localizations', + jsonSchema: { + description: localize('vscode.extension.contributes.localizations', "Contributes localizations to the editor"), + type: 'array', + default: [], + items: { + type: 'object', + required: ['languageId', 'translations'], + defaultSnippets: [{ body: { languageId: '', languageName: '', localizedLanguageName: '', translations: [{ id: 'vscode', path: '' }] } }], + properties: { + languageId: { + description: localize('vscode.extension.contributes.localizations.languageId', 'Id of the language into which the display strings are translated.'), + type: 'string' + }, + languageName: { + description: localize('vscode.extension.contributes.localizations.languageName', 'Name of the language in English.'), + type: 'string' + }, + localizedLanguageName: { + description: localize('vscode.extension.contributes.localizations.languageNameLocalized', 'Name of the language in contributed language.'), + type: 'string' + }, + translations: { + description: localize('vscode.extension.contributes.localizations.translations', 'List of translations associated to the language.'), + type: 'array', + default: [{ id: 'vscode', path: '' }], + items: { + type: 'object', + required: ['id', 'path'], + properties: { + id: { + type: 'string', + description: localize('vscode.extension.contributes.localizations.translations.id', "Id of VS Code or Extension for which this translation is contributed to. Id of VS Code is always `vscode` and of extension should be in format `publisherId.extensionName`."), + pattern: '^((vscode)|([a-z0-9A-Z][a-z0-9\-A-Z]*)\\.([a-z0-9A-Z][a-z0-9\-A-Z]*))$', + patternErrorMessage: localize('vscode.extension.contributes.localizations.translations.id.pattern', "Id should be `vscode` or in format `publisherId.extensionName` for translating VS code or an extension respectively.") + }, + path: { + type: 'string', + description: localize('vscode.extension.contributes.localizations.translations.path', "A relative path to a file containing translations for the language.") + } }, - path: { - type: 'string', - description: localize('vscode.extension.contributes.localizations.translations.path', "A relative path to a file containing translations for the language.") - } + defaultSnippets: [{ body: { id: '', path: '' } }], }, - defaultSnippets: [{ body: { id: '', path: '' } }], - }, + } } } } diff --git a/src/vs/workbench/parts/snippets/electron-browser/snippetsService.ts b/src/vs/workbench/parts/snippets/electron-browser/snippetsService.ts index 0ad757d0df9641fa8ce863068940c6b282884e86..dce33c0e97cce82b0083c2f531b4804fe74d457d 100644 --- a/src/vs/workbench/parts/snippets/electron-browser/snippetsService.ts +++ b/src/vs/workbench/parts/snippets/electron-browser/snippetsService.ts @@ -106,7 +106,11 @@ namespace snippetExt { } }; - export const point = ExtensionsRegistry.registerExtensionPoint('snippets', [languagesExtPoint], snippetExt.snippetsContribution); + export const point = ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'snippets', + deps: [languagesExtPoint], + jsonSchema: snippetExt.snippetsContribution + }); } function watch(service: IFileService, resource: URI, callback: (type: FileChangeType, resource: URI) => any): IDisposable { diff --git a/src/vs/workbench/parts/tasks/common/problemMatcher.ts b/src/vs/workbench/parts/tasks/common/problemMatcher.ts index 188cc53270e7181c8b1e83f37623b841841726e9..47518fe14941fc7d1f16b0ffad8ed8924f602588 100644 --- a/src/vs/workbench/parts/tasks/common/problemMatcher.ts +++ b/src/vs/workbench/parts/tasks/common/problemMatcher.ts @@ -1086,14 +1086,17 @@ export namespace Schemas { }; } -let problemPatternExtPoint = ExtensionsRegistry.registerExtensionPoint('problemPatterns', [], { - description: localize('ProblemPatternExtPoint', 'Contributes problem patterns'), - type: 'array', - items: { - anyOf: [ - Schemas.NamedProblemPattern, - Schemas.NamedMultiLineProblemPattern - ] +const problemPatternExtPoint = ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'problemPatterns', + jsonSchema: { + description: localize('ProblemPatternExtPoint', 'Contributes problem patterns'), + type: 'array', + items: { + anyOf: [ + Schemas.NamedProblemPattern, + Schemas.NamedMultiLineProblemPattern + ] + } } }); @@ -1659,10 +1662,14 @@ export namespace Schemas { }; } -let problemMatchersExtPoint = ExtensionsRegistry.registerExtensionPoint('problemMatchers', [problemPatternExtPoint], { - description: localize('ProblemMatcherExtPoint', 'Contributes problem matchers'), - type: 'array', - items: Schemas.NamedProblemMatcher +const problemMatchersExtPoint = ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'problemMatchers', + deps: [problemPatternExtPoint], + jsonSchema: { + description: localize('ProblemMatcherExtPoint', 'Contributes problem matchers'), + type: 'array', + items: Schemas.NamedProblemMatcher + } }); export interface IProblemMatcherRegistry { diff --git a/src/vs/workbench/parts/tasks/common/taskDefinitionRegistry.ts b/src/vs/workbench/parts/tasks/common/taskDefinitionRegistry.ts index 57fa3aba3cc765440b457ccf5a38a3d076ebd057..09f5e13d15918e68907ba3ad5467442fd67d1b71 100644 --- a/src/vs/workbench/parts/tasks/common/taskDefinitionRegistry.ts +++ b/src/vs/workbench/parts/tasks/common/taskDefinitionRegistry.ts @@ -67,10 +67,13 @@ namespace Configuration { } -const taskDefinitionsExtPoint = ExtensionsRegistry.registerExtensionPoint('taskDefinitions', [], { - description: nls.localize('TaskDefinitionExtPoint', 'Contributes task kinds'), - type: 'array', - items: taskDefinitionSchema +const taskDefinitionsExtPoint = ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'taskDefinitions', + jsonSchema: { + description: nls.localize('TaskDefinitionExtPoint', 'Contributes task kinds'), + type: 'array', + items: taskDefinitionSchema + } }); export interface ITaskDefinitionRegistry { diff --git a/src/vs/workbench/services/actions/electron-browser/menusExtensionPoint.ts b/src/vs/workbench/services/actions/electron-browser/menusExtensionPoint.ts index b7e0f358dbe9c90d062fd2bb9d92fd03996cfed6..b7435e930dc1da3b4d424ec863bd943479bed556 100644 --- a/src/vs/workbench/services/actions/electron-browser/menusExtensionPoint.ts +++ b/src/vs/workbench/services/actions/electron-browser/menusExtensionPoint.ts @@ -276,7 +276,10 @@ namespace schema { }; } -ExtensionsRegistry.registerExtensionPoint('commands', [], schema.commandsContribution).setHandler(extensions => { +ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'commands', + jsonSchema: schema.commandsContribution +}).setHandler(extensions => { function handleCommand(userFriendlyCommand: schema.IUserFriendlyCommand, extension: IExtensionPointUser) { @@ -316,7 +319,10 @@ ExtensionsRegistry.registerExtensionPoint('menus', [], schema.menusContribtion).setHandler(extensions => { +ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyMenuItem[] }>({ + extensionPoint: 'menus', + jsonSchema: schema.menusContribtion +}).setHandler(extensions => { for (let extension of extensions) { const { value, collector } = extension; diff --git a/src/vs/workbench/services/configuration/common/configurationExtensionPoint.ts b/src/vs/workbench/services/configuration/common/configurationExtensionPoint.ts index 0f83fe3d726cefb96788d701e9ab28853f5f4c17..e44874aa4feb4011daae51a809d7015cffd05c21 100644 --- a/src/vs/workbench/services/configuration/common/configurationExtensionPoint.ts +++ b/src/vs/workbench/services/configuration/common/configurationExtensionPoint.ts @@ -80,15 +80,18 @@ const configurationEntrySchema: IJSONSchema = { let registeredDefaultConfigurations: IDefaultConfigurationExtension[] = []; // BEGIN VSCode extension point `configurationDefaults` -const defaultConfigurationExtPoint = ExtensionsRegistry.registerExtensionPoint('configurationDefaults', [], { - description: nls.localize('vscode.extension.contributes.defaultConfiguration', 'Contributes default editor configuration settings by language.'), - type: 'object', - defaultSnippets: [{ body: {} }], - patternProperties: { - '\\[.*\\]$': { - type: 'object', - default: {}, - $ref: editorConfigurationSchemaId, +const defaultConfigurationExtPoint = ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'configurationDefaults', + jsonSchema: { + description: nls.localize('vscode.extension.contributes.defaultConfiguration', 'Contributes default editor configuration settings by language.'), + type: 'object', + defaultSnippets: [{ body: {} }], + patternProperties: { + '\\[.*\\]$': { + type: 'object', + default: {}, + $ref: editorConfigurationSchemaId, + } } } }); @@ -106,15 +109,19 @@ defaultConfigurationExtPoint.setHandler(extensions => { // BEGIN VSCode extension point `configuration` -const configurationExtPoint = ExtensionsRegistry.registerExtensionPoint('configuration', [defaultConfigurationExtPoint], { - description: nls.localize('vscode.extension.contributes.configuration', 'Contributes configuration settings.'), - oneOf: [ - configurationEntrySchema, - { - type: 'array', - items: configurationEntrySchema - } - ] +const configurationExtPoint = ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'configuration', + deps: [defaultConfigurationExtPoint], + jsonSchema: { + description: nls.localize('vscode.extension.contributes.configuration', 'Contributes configuration settings.'), + oneOf: [ + configurationEntrySchema, + { + type: 'array', + items: configurationEntrySchema + } + ] + } }); configurationExtPoint.setHandler(extensions => { const configurations: IConfigurationNode[] = []; diff --git a/src/vs/workbench/services/extensions/common/extensionsRegistry.ts b/src/vs/workbench/services/extensions/common/extensionsRegistry.ts index 16adcf10c8f1d5b0f4216cfb587abeb14fdc7d95..4d8421190e80a832e2af38ae70d845c572adb008 100644 --- a/src/vs/workbench/services/extensions/common/extensionsRegistry.ts +++ b/src/vs/workbench/services/extensions/common/extensionsRegistry.ts @@ -331,6 +331,13 @@ export const schema = { } }; +export interface IExtensionPointDescriptor { + isDynamic?: boolean; + extensionPoint: string; + deps?: IExtensionPoint[]; + jsonSchema: IJSONSchema; +} + export class ExtensionsRegistryImpl { private _extensionPoints: { [extPoint: string]: ExtensionPoint; }; @@ -339,14 +346,14 @@ export class ExtensionsRegistryImpl { this._extensionPoints = {}; } - public registerExtensionPoint(extensionPoint: string, deps: IExtensionPoint[], jsonSchema: IJSONSchema): IExtensionPoint { - if (hasOwnProperty.call(this._extensionPoints, extensionPoint)) { - throw new Error('Duplicate extension point: ' + extensionPoint); + public registerExtensionPoint(desc: IExtensionPointDescriptor): IExtensionPoint { + if (hasOwnProperty.call(this._extensionPoints, desc.extensionPoint)) { + throw new Error('Duplicate extension point: ' + desc.extensionPoint); } - let result = new ExtensionPoint(extensionPoint); - this._extensionPoints[extensionPoint] = result; + let result = new ExtensionPoint(desc.extensionPoint); + this._extensionPoints[desc.extensionPoint] = result; - schema.properties['contributes'].properties[extensionPoint] = jsonSchema; + schema.properties['contributes'].properties[desc.extensionPoint] = desc.jsonSchema; schemaRegistry.registerSchema(schemaId, schema); return result; diff --git a/src/vs/workbench/services/jsonschemas/common/jsonValidationExtensionPoint.ts b/src/vs/workbench/services/jsonschemas/common/jsonValidationExtensionPoint.ts index 99a43a42c53c80f6914ea36ff32e005534ead031..ee7f27af9455010b8a6bf0ff814227472ee1d949 100644 --- a/src/vs/workbench/services/jsonschemas/common/jsonValidationExtensionPoint.ts +++ b/src/vs/workbench/services/jsonschemas/common/jsonValidationExtensionPoint.ts @@ -13,21 +13,24 @@ interface IJSONValidationExtensionPoint { url: string; } -let configurationExtPoint = ExtensionsRegistry.registerExtensionPoint('jsonValidation', [], { - description: nls.localize('contributes.jsonValidation', 'Contributes json schema configuration.'), - type: 'array', - defaultSnippets: [{ body: [{ fileMatch: '${1:file.json}', url: '${2:url}' }] }], - items: { - type: 'object', - defaultSnippets: [{ body: { fileMatch: '${1:file.json}', url: '${2:url}' } }], - properties: { - fileMatch: { - type: 'string', - description: nls.localize('contributes.jsonValidation.fileMatch', 'The file pattern to match, for example "package.json" or "*.launch".'), - }, - url: { - description: nls.localize('contributes.jsonValidation.url', 'A schema URL (\'http:\', \'https:\') or relative path to the extension folder (\'./\').'), - type: 'string' +const configurationExtPoint = ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'jsonValidation', + jsonSchema: { + description: nls.localize('contributes.jsonValidation', 'Contributes json schema configuration.'), + type: 'array', + defaultSnippets: [{ body: [{ fileMatch: '${1:file.json}', url: '${2:url}' }] }], + items: { + type: 'object', + defaultSnippets: [{ body: { fileMatch: '${1:file.json}', url: '${2:url}' } }], + properties: { + fileMatch: { + type: 'string', + description: nls.localize('contributes.jsonValidation.fileMatch', 'The file pattern to match, for example "package.json" or "*.launch".'), + }, + url: { + description: nls.localize('contributes.jsonValidation.url', 'A schema URL (\'http:\', \'https:\') or relative path to the extension folder (\'./\').'), + type: 'string' + } } } } diff --git a/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts b/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts index e4475591350d003d1f5c8cbd06b9eb384a0e3a4c..777e825e55db9d8a431c2c39ebc8e1d8d65a5dcb 100644 --- a/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts +++ b/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts @@ -230,15 +230,18 @@ let keybindingType: IJSONSchema = { } }; -let keybindingsExtPoint = ExtensionsRegistry.registerExtensionPoint('keybindings', [], { - description: nls.localize('vscode.extension.contributes.keybindings', "Contributes keybindings."), - oneOf: [ - keybindingType, - { - type: 'array', - items: keybindingType - } - ] +const keybindingsExtPoint = ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'keybindings', + jsonSchema: { + description: nls.localize('vscode.extension.contributes.keybindings', "Contributes keybindings."), + oneOf: [ + keybindingType, + { + type: 'array', + items: keybindingType + } + ] + } }); export const enum DispatchConfig { diff --git a/src/vs/workbench/services/mode/common/workbenchModeService.ts b/src/vs/workbench/services/mode/common/workbenchModeService.ts index 14e01bb84e6d7de9c4ff4cb219a1f8b0421bc227..739bd17c643f6a27dd6b7f022bbeefffe9ec3eb8 100644 --- a/src/vs/workbench/services/mode/common/workbenchModeService.ts +++ b/src/vs/workbench/services/mode/common/workbenchModeService.ts @@ -27,61 +27,65 @@ export interface IRawLanguageExtensionPoint { configuration: string; } -export const languagesExtPoint: IExtensionPoint = ExtensionsRegistry.registerExtensionPoint('languages', [], { - description: nls.localize('vscode.extension.contributes.languages', 'Contributes language declarations.'), - type: 'array', - items: { - type: 'object', - 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.'), - type: 'string' - }, - aliases: { - description: nls.localize('vscode.extension.contributes.languages.aliases', 'Name aliases for the language.'), - type: 'array', - items: { +export const languagesExtPoint: IExtensionPoint = ExtensionsRegistry.registerExtensionPoint({ + isDynamic: true, + extensionPoint: 'languages', + jsonSchema: { + description: nls.localize('vscode.extension.contributes.languages', 'Contributes language declarations.'), + type: 'array', + items: { + type: 'object', + 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.'), type: 'string' - } - }, - extensions: { - description: nls.localize('vscode.extension.contributes.languages.extensions', 'File extensions associated to the language.'), - default: ['.foo'], - type: 'array', - items: { - type: 'string' - } - }, - filenames: { - description: nls.localize('vscode.extension.contributes.languages.filenames', 'File names associated to the language.'), - type: 'array', - items: { - type: 'string' - } - }, - filenamePatterns: { - description: nls.localize('vscode.extension.contributes.languages.filenamePatterns', 'File name glob patterns associated to the language.'), - type: 'array', - items: { - type: 'string' - } - }, - mimetypes: { - description: nls.localize('vscode.extension.contributes.languages.mimetypes', 'Mime types associated to the language.'), - type: 'array', - items: { + }, + aliases: { + description: nls.localize('vscode.extension.contributes.languages.aliases', 'Name aliases for the language.'), + type: 'array', + items: { + type: 'string' + } + }, + extensions: { + description: nls.localize('vscode.extension.contributes.languages.extensions', 'File extensions associated to the language.'), + default: ['.foo'], + type: 'array', + items: { + type: 'string' + } + }, + filenames: { + description: nls.localize('vscode.extension.contributes.languages.filenames', 'File names associated to the language.'), + type: 'array', + items: { + type: 'string' + } + }, + filenamePatterns: { + description: nls.localize('vscode.extension.contributes.languages.filenamePatterns', 'File name glob patterns associated to the language.'), + type: 'array', + items: { + type: 'string' + } + }, + mimetypes: { + description: nls.localize('vscode.extension.contributes.languages.mimetypes', 'Mime types associated to the language.'), + type: 'array', + items: { + type: 'string' + } + }, + firstLine: { + description: nls.localize('vscode.extension.contributes.languages.firstLine', 'A regular expression matching the first line of a file of the language.'), type: 'string' + }, + configuration: { + description: nls.localize('vscode.extension.contributes.languages.configuration', 'A relative path to a file containing configuration options for the language.'), + type: 'string', + default: './language-configuration.json' } - }, - firstLine: { - description: nls.localize('vscode.extension.contributes.languages.firstLine', 'A regular expression matching the first line of a file of the language.'), - type: 'string' - }, - configuration: { - description: nls.localize('vscode.extension.contributes.languages.configuration', 'A relative path to a file containing configuration options for the language.'), - type: 'string', - default: './language-configuration.json' } } } diff --git a/src/vs/workbench/services/textMate/electron-browser/TMGrammars.ts b/src/vs/workbench/services/textMate/electron-browser/TMGrammars.ts index 3e6290686b418ab86a1d99ff65a88d7a047cd302..6cc44b7ac1216a6c344917039389a90796e2a335 100644 --- a/src/vs/workbench/services/textMate/electron-browser/TMGrammars.ts +++ b/src/vs/workbench/services/textMate/electron-browser/TMGrammars.ts @@ -24,45 +24,49 @@ export interface ITMSyntaxExtensionPoint { injectTo: string[]; } -export const grammarsExtPoint: IExtensionPoint = ExtensionsRegistry.registerExtensionPoint('grammars', [languagesExtPoint], { - description: nls.localize('vscode.extension.contributes.grammars', 'Contributes textmate tokenizers.'), - type: 'array', - defaultSnippets: [{ body: [{ language: '${1:id}', scopeName: 'source.${2:id}', path: './syntaxes/${3:id}.tmLanguage.' }] }], - items: { - type: 'object', - 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.'), - type: 'string' - }, - scopeName: { - description: nls.localize('vscode.extension.contributes.grammars.scopeName', 'Textmate scope name used by the tmLanguage file.'), - type: 'string' - }, - path: { - description: nls.localize('vscode.extension.contributes.grammars.path', 'Path of the tmLanguage file. The path is relative to the extension folder and typically starts with \'./syntaxes/\'.'), - type: 'string' - }, - embeddedLanguages: { - description: nls.localize('vscode.extension.contributes.grammars.embeddedLanguages', 'A map of scope name to language id if this grammar contains embedded languages.'), - type: 'object' - }, - tokenTypes: { - description: nls.localize('vscode.extension.contributes.grammars.tokenTypes', 'A map of scope name to token types.'), - type: 'object', - additionalProperties: { - enum: ['string', 'comment', 'other'] - } - }, - injectTo: { - description: nls.localize('vscode.extension.contributes.grammars.injectTo', 'List of language scope names to which this grammar is injected to.'), - type: 'array', - items: { +export const grammarsExtPoint: IExtensionPoint = ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'grammars', + deps: [languagesExtPoint], + jsonSchema: { + description: nls.localize('vscode.extension.contributes.grammars', 'Contributes textmate tokenizers.'), + type: 'array', + defaultSnippets: [{ body: [{ language: '${1:id}', scopeName: 'source.${2:id}', path: './syntaxes/${3:id}.tmLanguage.' }] }], + items: { + type: 'object', + 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.'), + type: 'string' + }, + scopeName: { + description: nls.localize('vscode.extension.contributes.grammars.scopeName', 'Textmate scope name used by the tmLanguage file.'), type: 'string' + }, + path: { + description: nls.localize('vscode.extension.contributes.grammars.path', 'Path of the tmLanguage file. The path is relative to the extension folder and typically starts with \'./syntaxes/\'.'), + type: 'string' + }, + embeddedLanguages: { + description: nls.localize('vscode.extension.contributes.grammars.embeddedLanguages', 'A map of scope name to language id if this grammar contains embedded languages.'), + type: 'object' + }, + tokenTypes: { + description: nls.localize('vscode.extension.contributes.grammars.tokenTypes', 'A map of scope name to token types.'), + type: 'object', + additionalProperties: { + enum: ['string', 'comment', 'other'] + } + }, + injectTo: { + description: nls.localize('vscode.extension.contributes.grammars.injectTo', 'List of language scope names to which this grammar is injected to.'), + type: 'array', + items: { + type: 'string' + } } - } - }, - required: ['scopeName', 'path'] + }, + required: ['scopeName', 'path'] + } } }); diff --git a/src/vs/workbench/services/themes/common/colorExtensionPoint.ts b/src/vs/workbench/services/themes/common/colorExtensionPoint.ts index 4b6aa709183c03aa1d65e8e174afa3ae6ac6a04b..42a0650ed29527ac64fc9baae5de4b28e62c8100 100644 --- a/src/vs/workbench/services/themes/common/colorExtensionPoint.ts +++ b/src/vs/workbench/services/themes/common/colorExtensionPoint.ts @@ -17,51 +17,54 @@ interface IColorExtensionPoint { const colorReferenceSchema = getColorRegistry().getColorReferenceSchema(); const colorIdPattern = '^\\w+[.\\w+]*$'; -const configurationExtPoint = ExtensionsRegistry.registerExtensionPoint('colors', [], { - description: nls.localize('contributes.color', 'Contributes extension defined themable colors'), - type: 'array', - items: { - type: 'object', - properties: { - id: { - type: 'string', - description: nls.localize('contributes.color.id', 'The identifier of the themable color'), - pattern: colorIdPattern, - patternErrorMessage: nls.localize('contributes.color.id.format', 'Identifiers should be in the form aa[.bb]*'), - }, - description: { - type: 'string', - description: nls.localize('contributes.color.description', 'The description of the themable color'), - }, - defaults: { - type: 'object', - properties: { - light: { - description: nls.localize('contributes.defaults.light', 'The default color for light themes. Either a color value in hex (#RRGGBB[AA]) or the identifier of a themable color which provides the default.'), - type: 'string', - anyOf: [ - colorReferenceSchema, - { type: 'string', format: 'color-hex' } - ] - }, - dark: { - description: nls.localize('contributes.defaults.dark', 'The default color for dark themes. Either a color value in hex (#RRGGBB[AA]) or the identifier of a themable color which provides the default.'), - type: 'string', - anyOf: [ - colorReferenceSchema, - { type: 'string', format: 'color-hex' } - ] - }, - highContrast: { - description: nls.localize('contributes.defaults.highContrast', 'The default color for high contrast themes. Either a color value in hex (#RRGGBB[AA]) or the identifier of a themable color which provides the default.'), - type: 'string', - anyOf: [ - colorReferenceSchema, - { type: 'string', format: 'color-hex' } - ] +const configurationExtPoint = ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'colors', + jsonSchema: { + description: nls.localize('contributes.color', 'Contributes extension defined themable colors'), + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + description: nls.localize('contributes.color.id', 'The identifier of the themable color'), + pattern: colorIdPattern, + patternErrorMessage: nls.localize('contributes.color.id.format', 'Identifiers should be in the form aa[.bb]*'), + }, + description: { + type: 'string', + description: nls.localize('contributes.color.description', 'The description of the themable color'), + }, + defaults: { + type: 'object', + properties: { + light: { + description: nls.localize('contributes.defaults.light', 'The default color for light themes. Either a color value in hex (#RRGGBB[AA]) or the identifier of a themable color which provides the default.'), + type: 'string', + anyOf: [ + colorReferenceSchema, + { type: 'string', format: 'color-hex' } + ] + }, + dark: { + description: nls.localize('contributes.defaults.dark', 'The default color for dark themes. Either a color value in hex (#RRGGBB[AA]) or the identifier of a themable color which provides the default.'), + type: 'string', + anyOf: [ + colorReferenceSchema, + { type: 'string', format: 'color-hex' } + ] + }, + highContrast: { + description: nls.localize('contributes.defaults.highContrast', 'The default color for high contrast themes. Either a color value in hex (#RRGGBB[AA]) or the identifier of a themable color which provides the default.'), + type: 'string', + anyOf: [ + colorReferenceSchema, + { type: 'string', format: 'color-hex' } + ] + } } - } - }, + }, + } } } }); diff --git a/src/vs/workbench/services/themes/electron-browser/colorThemeStore.ts b/src/vs/workbench/services/themes/electron-browser/colorThemeStore.ts index 471dfffb9f3cc6d37be4a5541febf3cb6e2f861e..f40462cbae856b2133f5c0188e289eb952247253 100644 --- a/src/vs/workbench/services/themes/electron-browser/colorThemeStore.ts +++ b/src/vs/workbench/services/themes/electron-browser/colorThemeStore.ts @@ -14,32 +14,34 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten import { Event, Emitter } from 'vs/base/common/event'; import { URI } from 'vs/base/common/uri'; - -let themesExtPoint = ExtensionsRegistry.registerExtensionPoint('themes', [], { - description: nls.localize('vscode.extension.contributes.themes', 'Contributes textmate color themes.'), - type: 'array', - items: { - type: 'object', - defaultSnippets: [{ body: { label: '${1:label}', id: '${2:id}', uiTheme: VS_DARK_THEME, path: './themes/${3:id}.tmTheme.' } }], - properties: { - id: { - description: nls.localize('vscode.extension.contributes.themes.id', 'Id of the icon theme as used in the user settings.'), - type: 'string' - }, - label: { - description: nls.localize('vscode.extension.contributes.themes.label', 'Label of the color theme as shown in the UI.'), - type: 'string' - }, - uiTheme: { - description: nls.localize('vscode.extension.contributes.themes.uiTheme', 'Base theme defining the colors around the editor: \'vs\' is the light color theme, \'vs-dark\' is the dark color theme. \'hc-black\' is the dark high contrast theme.'), - enum: [VS_LIGHT_THEME, VS_DARK_THEME, VS_HC_THEME] +const themesExtPoint = ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'themes', + jsonSchema: { + description: nls.localize('vscode.extension.contributes.themes', 'Contributes textmate color themes.'), + type: 'array', + items: { + type: 'object', + defaultSnippets: [{ body: { label: '${1:label}', id: '${2:id}', uiTheme: VS_DARK_THEME, path: './themes/${3:id}.tmTheme.' } }], + properties: { + id: { + description: nls.localize('vscode.extension.contributes.themes.id', 'Id of the icon theme as used in the user settings.'), + type: 'string' + }, + label: { + description: nls.localize('vscode.extension.contributes.themes.label', 'Label of the color theme as shown in the UI.'), + type: 'string' + }, + uiTheme: { + description: nls.localize('vscode.extension.contributes.themes.uiTheme', 'Base theme defining the colors around the editor: \'vs\' is the light color theme, \'vs-dark\' is the dark color theme. \'hc-black\' is the dark high contrast theme.'), + enum: [VS_LIGHT_THEME, VS_DARK_THEME, VS_HC_THEME] + }, + path: { + description: nls.localize('vscode.extension.contributes.themes.path', 'Path of the tmTheme file. The path is relative to the extension folder and is typically \'./themes/themeFile.tmTheme\'.'), + type: 'string' + } }, - path: { - description: nls.localize('vscode.extension.contributes.themes.path', 'Path of the tmTheme file. The path is relative to the extension folder and is typically \'./themes/themeFile.tmTheme\'.'), - type: 'string' - } - }, - required: ['path', 'uiTheme'] + required: ['path', 'uiTheme'] + } } }); diff --git a/src/vs/workbench/services/themes/electron-browser/fileIconThemeStore.ts b/src/vs/workbench/services/themes/electron-browser/fileIconThemeStore.ts index a8b9e9a00245220ec11df38fe6bd10f77249d304..333b229de080b9f3f036c9e4df492540e8465b75 100644 --- a/src/vs/workbench/services/themes/electron-browser/fileIconThemeStore.ts +++ b/src/vs/workbench/services/themes/electron-browser/fileIconThemeStore.ts @@ -14,29 +14,33 @@ import { Event, Emitter } from 'vs/base/common/event'; import { FileIconThemeData } from 'vs/workbench/services/themes/electron-browser/fileIconThemeData'; import { URI } from 'vs/base/common/uri'; -let iconThemeExtPoint = ExtensionsRegistry.registerExtensionPoint('iconThemes', [], { - description: nls.localize('vscode.extension.contributes.iconThemes', 'Contributes file icon themes.'), - type: 'array', - items: { - type: 'object', - 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.'), - type: 'string' - }, - label: { - description: nls.localize('vscode.extension.contributes.iconThemes.label', 'Label of the icon theme as shown in the UI.'), - type: 'string' +const iconThemeExtPoint = ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'iconThemes', + jsonSchema: { + description: nls.localize('vscode.extension.contributes.iconThemes', 'Contributes file icon themes.'), + type: 'array', + items: { + type: 'object', + 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.'), + type: 'string' + }, + label: { + description: nls.localize('vscode.extension.contributes.iconThemes.label', 'Label of the icon theme as shown in the UI.'), + type: 'string' + }, + path: { + description: nls.localize('vscode.extension.contributes.iconThemes.path', 'Path of the icon theme definition file. The path is relative to the extension folder and is typically \'./icons/awesome-icon-theme.json\'.'), + type: 'string' + } }, - path: { - description: nls.localize('vscode.extension.contributes.iconThemes.path', 'Path of the icon theme definition file. The path is relative to the extension folder and is typically \'./icons/awesome-icon-theme.json\'.'), - type: 'string' - } - }, - required: ['path', 'id'] + required: ['path', 'id'] + } } }); + export class FileIconThemeStore { private knownIconThemes: FileIconThemeData[];