diff --git a/src/utils/ManifestUtils.ts b/src/utils/ManifestUtils.ts new file mode 100644 index 0000000..51afd58 --- /dev/null +++ b/src/utils/ManifestUtils.ts @@ -0,0 +1,37 @@ +import { extensions, Extension } from 'vscode'; + +export class ExtensionManifestReader { + constructor(extensionId: string) { + this._extension = extensions.getExtension(extensionId); + } + + private _extension: Extension + + 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]; + } + } + } +} \ No newline at end of file