mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Refresh master with initial release/0.24 snapshot (#332)
* Initial port of release/0.24 source code * Fix additional headers * Fix a typo in launch.json
This commit is contained in:
@@ -5,9 +5,8 @@
|
||||
'use strict';
|
||||
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import platform = require('vs/platform/registry/common/platform');
|
||||
import { EventEmitter } from 'vs/base/common/eventEmitter';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import * as platform from 'vs/platform/registry/common/platform';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export const Extensions = {
|
||||
JSONContribution: 'base.contributions.json'
|
||||
@@ -19,6 +18,8 @@ export interface ISchemaContributions {
|
||||
|
||||
export interface IJSONContributionRegistry {
|
||||
|
||||
readonly onDidChangeSchema: Event<string>;
|
||||
|
||||
/**
|
||||
* Register a schema to the registry.
|
||||
*/
|
||||
@@ -28,12 +29,6 @@ export interface IJSONContributionRegistry {
|
||||
* Get all schemas
|
||||
*/
|
||||
getSchemaContributions(): ISchemaContributions;
|
||||
|
||||
/**
|
||||
* Adds a change listener
|
||||
*/
|
||||
addRegistryChangedListener(callback: (e: IJSONContributionRegistryEvent) => void): IDisposable;
|
||||
|
||||
}
|
||||
|
||||
export interface IJSONContributionRegistryEvent {
|
||||
@@ -50,21 +45,19 @@ function normalizeId(id: string) {
|
||||
|
||||
|
||||
class JSONContributionRegistry implements IJSONContributionRegistry {
|
||||
|
||||
private schemasById: { [id: string]: IJSONSchema };
|
||||
private eventEmitter: EventEmitter;
|
||||
|
||||
private _onDidChangeSchema: Emitter<string> = new Emitter<string>();
|
||||
readonly onDidChangeSchema: Event<string> = this._onDidChangeSchema.event;
|
||||
|
||||
constructor() {
|
||||
this.schemasById = {};
|
||||
this.eventEmitter = new EventEmitter();
|
||||
}
|
||||
|
||||
public addRegistryChangedListener(callback: (e: IJSONContributionRegistryEvent) => void): IDisposable {
|
||||
return this.eventEmitter.addListener('registryChanged', callback);
|
||||
}
|
||||
|
||||
public registerSchema(uri: string, unresolvedSchemaContent: IJSONSchema): void {
|
||||
this.schemasById[normalizeId(uri)] = unresolvedSchemaContent;
|
||||
this.eventEmitter.emit('registryChanged', {});
|
||||
this._onDidChangeSchema.fire(uri);
|
||||
}
|
||||
|
||||
public getSchemaContributions(): ISchemaContributions {
|
||||
|
||||
@@ -39,10 +39,10 @@ export class JSONValidationExtensionPoint {
|
||||
|
||||
constructor() {
|
||||
configurationExtPoint.setHandler((extensions) => {
|
||||
for (var i = 0; i < extensions.length; i++) {
|
||||
var extensionValue = <IJSONValidationExtensionPoint[]>extensions[i].value;
|
||||
var collector = extensions[i].collector;
|
||||
var extensionPath = extensions[i].description.extensionFolderPath;
|
||||
for (let i = 0; i < extensions.length; i++) {
|
||||
const extensionValue = <IJSONValidationExtensionPoint[]>extensions[i].value;
|
||||
const collector = extensions[i].collector;
|
||||
const extensionPath = extensions[i].description.extensionFolderPath;
|
||||
|
||||
if (!extensionValue || !Array.isArray(extensionValue)) {
|
||||
collector.error(nls.localize('invalid.jsonValidation', "'configuration.jsonValidation' must be a array"));
|
||||
|
||||
Reference in New Issue
Block a user