Add initial resource view (#12180)

* add inital resource view

* fix strict compile

* hide resource viewer behind arc

* fix arc detection

* fix hygiene

* add disposable

* make the css more specific
This commit is contained in:
Anthony Dresser
2020-09-09 10:49:14 -07:00
committed by GitHub
parent 5ae9495bc6
commit 8a8137e96c
8 changed files with 394 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Emitter, Event } from 'vs/base/common/event';
import { Registry } from 'vs/platform/registry/common/platform';
export const Extensions = {
ResourceViewerExtension: 'resourceViewer.resources'
};
export interface ResourceType {
readonly id: string;
readonly icon: string;
readonly name: string;
}
export interface ResourceViewerResourcesRegistry {
registerResource(resource: ResourceType): void;
readonly allResources: ReadonlyArray<ResourceType>;
readonly onDidRegisterResource: Event<void>;
}
const resourceViewerResourceRegistery = new class implements ResourceViewerResourcesRegistry {
private readonly resources: ResourceType[] = [];
private readonly _onDidRegisterResource = new Emitter<void>();
public readonly onDidRegisterResource = this._onDidRegisterResource.event;
public registerResource(resource: ResourceType): void {
this.resources.push(Object.assign({}, resource));
this._onDidRegisterResource.fire();
}
get allResources(): ReadonlyArray<ResourceType> {
return this.resources;
}
};
Registry.add(Extensions.ResourceViewerExtension, resourceViewerResourceRegistery);