提交 519d6183 编写于 作者: M Martin Aeschlimann

Remove addSchemaFileAssociation (was only used by legacy JSON mode)

上级 ed3a686a
omnisharp-vscode @ 3c361af4
Subproject commit 3c361af4688c0d09fca99a220d80aec52b5c7052
......@@ -266,25 +266,6 @@ export class JSONSchemaService implements IJSONSchemaService {
this.contributionSchemas[id] = this.addSchemaHandle(id, schemas[id]);
}
}
if (schemaContributions.schemaAssociations) {
var schemaAssociations = schemaContributions.schemaAssociations;
for (let pattern in schemaAssociations) {
var associations = schemaAssociations[pattern];
if (this.contextService) {
let env = this.contextService.getConfiguration().env;
if (env) {
pattern = pattern.replace(/%APP_SETTINGS_HOME%/, URI.file(env.appSettingsHome).toString());
}
}
this.contributionAssociations[pattern] = associations;
var fpa = this.getOrAddFilePatternAssociation(pattern);
associations.forEach(schemaId => {
var id = this.normalizeId(schemaId);
fpa.addSchema(id);
});
}
}
}
private addSchemaHandle(id:string, unresolvedSchemaContent?: IJSONSchema) : SchemaHandle {
......
......@@ -62,10 +62,6 @@ class ConfigurationRegistry implements IConfigurationRegistry {
this._onDidRegisterConfiguration = new Emitter<IConfigurationRegistry>();
contributionRegistry.registerSchema(schemaId, this.configurationSchema);
contributionRegistry.addSchemaFileAssociation('vscode://defaultsettings/settings.json', schemaId);
contributionRegistry.addSchemaFileAssociation('%APP_SETTINGS_HOME%/settings.json', schemaId);
contributionRegistry.addSchemaFileAssociation('/.vscode/settings.json', schemaId);
}
public get onDidRegisterConfiguration() {
......
......@@ -438,5 +438,4 @@ const PRExtensions = {
Registry.add(PRExtensions.ExtensionsRegistry, new ExtensionsRegistryImpl());
export const ExtensionsRegistry: IExtensionsRegistry = Registry.as(PRExtensions.ExtensionsRegistry);
schemaRegistry.registerSchema(schemaId, schema);
schemaRegistry.addSchemaFileAssociation('/package.json', schemaId);
\ No newline at end of file
schemaRegistry.registerSchema(schemaId, schema);
\ No newline at end of file
......@@ -16,7 +16,6 @@ export const Extensions = {
export interface ISchemaContributions {
schemas?: { [id: string]: IJSONSchema };
schemaAssociations?: { [pattern: string]: string[] };
}
export interface IJSONContributionRegistry {
......@@ -26,11 +25,6 @@ export interface IJSONContributionRegistry {
*/
registerSchema(uri: string, unresolvedSchemaContent: IJSONSchema): void;
/**
* Register a schema association
*/
addSchemaFileAssociation(pattern: string, uri: string): void;
/**
* Get all schemas
*/
......@@ -58,12 +52,10 @@ function normalizeId(id: string) {
class JSONContributionRegistry implements IJSONContributionRegistry {
private schemasById: { [id: string]: IJSONSchema };
private schemaAssociations: { [pattern: string]: string[] };
private eventEmitter: IEventEmitter;
constructor() {
this.schemasById = {};
this.schemaAssociations = {};
this.eventEmitter = new EventEmitter();
}
......@@ -76,20 +68,9 @@ class JSONContributionRegistry implements IJSONContributionRegistry {
this.eventEmitter.emit('registryChanged', {});
}
public addSchemaFileAssociation(pattern: string, uri: string): void {
let uris = this.schemaAssociations[pattern];
if (!uris) {
uris = [];
this.schemaAssociations[pattern] = uris;
}
uris.push(uri);
this.eventEmitter.emit('registryChanged', {});
}
public getSchemaContributions(): ISchemaContributions {
return {
schemas: this.schemasById,
schemaAssociations: this.schemaAssociations
};
}
......
......@@ -6,9 +6,7 @@
import nls = require('vs/nls');
import {ExtensionsRegistry} from 'vs/platform/extensions/common/extensionsRegistry';
import {Registry} from 'vs/platform/platform';
import URI from 'vs/base/common/uri';
import JSONContributionRegistry = require('vs/platform/jsonschemas/common/jsonContributionRegistry');
import strings = require('vs/base/common/strings');
import paths = require('vs/base/common/paths');
......@@ -17,8 +15,6 @@ interface IJSONValidationExtensionPoint {
url: string;
}
let schemaRegistry = <JSONContributionRegistry.IJSONContributionRegistry>Registry.as(JSONContributionRegistry.Extensions.JSONContribution);
let configurationExtPoint = ExtensionsRegistry.registerExtensionPoint<IJSONValidationExtensionPoint[]>('jsonValidation', {
description: nls.localize('contributes.jsonValidation', 'Contributes json schema configuration.'),
type: 'array',
......@@ -72,11 +68,6 @@ export class JSONValidationExtensionPoint {
collector.error(nls.localize('invalid.url.schema', "'configuration.jsonValidation.url' must start with 'http:', 'https:' or './' to reference schemas located in the extension"));
return;
}
let fileMatch = extension.fileMatch;
if (!strings.startsWith(extension.fileMatch, '/')) {
fileMatch = '/' + fileMatch;
}
schemaRegistry.addSchemaFileAssociation(fileMatch, uri);
});
}
});
......
......@@ -142,7 +142,6 @@ const schema: IJSONSchema = {
const jsonRegistry = <jsonContributionRegistry.IJSONContributionRegistry>platform.Registry.as(jsonContributionRegistry.Extensions.JSONContribution);
jsonRegistry.registerSchema(schemaId, schema);
jsonRegistry.addSchemaFileAssociation('/.vscode/launch.json', schemaId);
export class ConfigurationManager implements debug.IConfigurationManager {
......
......@@ -163,5 +163,4 @@ let schema : IJSONSchema = {
};
let schemaRegistry = <JSONContributionRegistry.IJSONContributionRegistry>platform.Registry.as(JSONContributionRegistry.Extensions.JSONContribution);
schemaRegistry.registerSchema(schemaId, schema);
schemaRegistry.addSchemaFileAssociation('%APP_SETTINGS_HOME%/snippets/*.json', schemaId);
\ No newline at end of file
schemaRegistry.registerSchema(schemaId, schema);
\ No newline at end of file
......@@ -1308,4 +1308,3 @@ let schema : IJSONSchema =
};
let jsonRegistry = <jsonContributionRegistry.IJSONContributionRegistry>Registry.as(jsonContributionRegistry.Extensions.JSONContribution);
jsonRegistry.registerSchema(schemaId, schema);
jsonRegistry.addSchemaFileAssociation('/.vscode/tasks.json', schemaId);
......@@ -314,5 +314,3 @@ let schema : IJSONSchema = {
let schemaRegistry = <IJSONContributionRegistry>Registry.as(Extensions.JSONContribution);
schemaRegistry.registerSchema(schemaId, schema);
schemaRegistry.addSchemaFileAssociation('vscode://defaultsettings/keybindings.json', schemaId);
schemaRegistry.addSchemaFileAssociation('%APP_SETTINGS_HOME%/keybindings.json', schemaId);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册