mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -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 {
|
||||
|
||||
Reference in New Issue
Block a user