Add ExtensionManifestReader
This commit is contained in:
parent
966ab047ef
commit
351608a718
37
src/utils/ManifestUtils.ts
Normal file
37
src/utils/ManifestUtils.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import { extensions, Extension } from 'vscode';
|
||||
|
||||
export class ExtensionManifestReader {
|
||||
constructor(extensionId: string) {
|
||||
this._extension = extensions.getExtension(extensionId);
|
||||
}
|
||||
|
||||
private _extension: Extension<any>
|
||||
|
||||
name: string;
|
||||
version: string;
|
||||
publisher: string;
|
||||
displayName: string;
|
||||
description: string;
|
||||
categories: string[];
|
||||
keywords: string[];
|
||||
icon: string;
|
||||
|
||||
private _checkPropertyExists(propertyName: string) {
|
||||
for (let property in this) {
|
||||
if (property === propertyName) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
refresh(): void {
|
||||
let manifest: any = this._extension.packageJSON;
|
||||
|
||||
for (let property in manifest)
|
||||
{
|
||||
if (this._checkPropertyExists(property)) {
|
||||
this[property] = manifest[property];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user