From 5f53e6f6b1ff93c2c13ca75373556956e778ce31 Mon Sep 17 00:00:00 2001 From: Dominic Saladin <43037258+DominicSaladin@users.noreply.github.com> Date: Tue, 25 Jul 2023 07:48:12 +0200 Subject: [PATCH 1/2] Fix package cache not loading --- src/Objects/Misc/ALInterface.ts | 3 +++ src/Reader.ts | 38 +++++++++++++++++++++------------ 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/Objects/Misc/ALInterface.ts b/src/Objects/Misc/ALInterface.ts index d26f8c3..3dee131 100644 --- a/src/Objects/Misc/ALInterface.ts +++ b/src/Objects/Misc/ALInterface.ts @@ -2,6 +2,9 @@ import { ALApp, ALObject, ObjectType } from "../../internal"; export class ALInterface extends ALObject { constructor(objectPath: string, objectID: string, objectName: string, alApp: ALApp) { + if (!objectID) + objectID = ""; + super(objectPath, ObjectType.Interface, objectID, objectName, alApp); } diff --git a/src/Reader.ts b/src/Reader.ts index 85e0c96..4c071b5 100644 --- a/src/Reader.ts +++ b/src/Reader.ts @@ -64,9 +64,18 @@ export class Reader { let workspaceFolderconfig = vscode.workspace.getConfiguration('al', wf.uri); let packageCache = workspaceFolderconfig.get('packageCachePath'); - if (packageCache) - if (!reader.alPackageCachePaths.includes(path.resolve(wf.uri.fsPath, packageCache[0]))) - reader.alPackageCachePaths.push(path.resolve(wf.uri.fsPath, packageCache[0])); + if (packageCache) { + let newPath = ""; + if (typeof packageCache === "string") + newPath = path.resolve(wf.uri.fsPath, packageCache); + else if (Array.isArray(packageCache)) + newPath = path.resolve(wf.uri.fsPath, packageCache[0]); + else + return; + + if (!reader.alPackageCachePaths.includes(newPath)) + reader.alPackageCachePaths.push(newPath); + } }); } } @@ -78,7 +87,7 @@ export class Reader { if (!this.alPackageCachePaths || this.alPackageCachePaths.length == 0) return; - this.alPackageCachePaths.forEach(async apcp => { + for (const apcp of this.alPackageCachePaths) { if (!path.isAbsolute(apcp)) { for (let index = 0; index < this.alApps.filter(app => app.appType === AppType.local).length; index++) { const alApp = this.alApps.filter(app => app.appType === AppType.local)[index]; @@ -88,14 +97,14 @@ export class Reader { else { await this.searchAppPackages(apcp); } - - if (this.printDebug) { this.outputChannel.appendLine(`Found ${this.alApps.filter(alApp => alApp.appType === AppType.appPackage).length} app files in all projects`); } - - await Promise.all([ - this.readLocalApps(this.alApps.filter(app => app.appType === AppType.local)), - this.readAppPackages(this.alApps.filter(app => app.appType === AppType.appPackage && app.appChanged)) - ]); - }); + } + + if (this.printDebug) { this.outputChannel.appendLine(`Found ${this.alApps.filter(alApp => alApp.appType === AppType.appPackage).length} app files in all projects`); } + + await Promise.all([ + this.readLocalApps(this.alApps.filter(app => app.appType === AppType.local)), + this.readAppPackages(this.alApps.filter(app => app.appType === AppType.appPackage && app.appChanged)) + ]); } addLocalFolderAsApp(folderPath: string): ALApp | null { @@ -115,7 +124,8 @@ export class Reader { if (supportedVersion === undefined) supportedVersion = json.platform; - this.alApplicationVersion = supportedVersion; + if (this.alApplicationVersion == "") + this.alApplicationVersion = supportedVersion; const alApp = new ALApp(AppType.local, json.id, json.name, json.publisher, json.version, supportedVersion, json.runtime, folderPath, new Date(), showMyCode); this.alApps.push(alApp); @@ -281,7 +291,7 @@ export class Reader { var hasCorrectMajorPackage: boolean = false; var alAppToUse: ALApp; alApps.forEach(alApp => { - if (compareVersions(alApp.appSupportedVersion, this.alApplicationVersion) > 0) { + if (compareVersions(alApp.appSupportedVersion, this.alApplicationVersion) < 0) { this.alApps.splice(this.alApps.indexOf(alApp), 1); return; } From cc70c1fe1f11db7ed44cd2d5355367afbf19110c Mon Sep 17 00:00:00 2001 From: Dominic Saladin <43037258+DominicSaladin@users.noreply.github.com> Date: Tue, 25 Jul 2023 07:49:37 +0200 Subject: [PATCH 2/2] Update to version 2.3.7 --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 024d0b4..a56bd17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Change Log All versions of AL Object Helper will be documented in this file. +## [2.3.7] - 2023-07-25 +### Fix +- App packages not loading if configuration is a string and not a array + ## [2.3.6] - 2023-07-21 ### Fix - Version Comparing when checking app packages @@ -255,6 +259,7 @@ All versions of AL Object Helper will be documented in this file. ## [1.0.0] - 2020-06-24 - Initial release +[2.3.7]: https://github.com/DSaladinCH/al-object-helper/compare/2.3.6...2.3.7 [2.3.6]: https://github.com/DSaladinCH/al-object-helper/compare/2.3.5...2.3.6 [2.3.5]: https://github.com/DSaladinCH/al-object-helper/compare/2.3.4...2.3.5 [2.3.4]: https://github.com/DSaladinCH/al-object-helper/compare/2.3.3...2.3.4 diff --git a/package.json b/package.json index 2bca703..c819a7f 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "name": "Dominic Saladin" }, "license": "MIT", - "version": "2.3.6", + "version": "2.3.7", "icon": "Images/ALObjectHelper_Small.png", "engines": { "vscode": "^1.65.0"