From 325e6ec3fce90766d39ef5f1d868988253420194 Mon Sep 17 00:00:00 2001 From: David Feldhoff Date: Thu, 18 Feb 2021 17:14:33 +0100 Subject: [PATCH] #98 use fsPath which is handed over from UI instead of trying to figure it out again --- vscode-extension/src/App logic/Services/ObjectService.ts | 8 ++++++-- .../src/App logic/Utils/elementInsertionUtils.ts | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/vscode-extension/src/App logic/Services/ObjectService.ts b/vscode-extension/src/App logic/Services/ObjectService.ts index 60c9941..5ef5c30 100644 --- a/vscode-extension/src/App logic/Services/ObjectService.ts +++ b/vscode-extension/src/App logic/Services/ObjectService.ts @@ -230,7 +230,9 @@ export class ObjectService { return { valid: true, reason: '' } } async isChangeValid_Scenario(msg: MessageUpdate): Promise<{ valid: boolean, reason: string }> { - let fsPath: string = await ElementUtils.getFSPathOfFeature(msg.Project, msg.Feature); + let fsPath: string = msg.FsPath; + if (fsPath == '') + fsPath = await ElementUtils.getFSPathOfFeature(msg.Project, msg.Feature); let document: TextDocument = await workspace.openTextDocument(fsPath); let scenarioProcedureName = TestMethodUtils.getProcedureName(TypeChanged.ScenarioName, msg.NewValue); if (await TestCodeunitUtils.isProcedureAlreadyDeclared(document, scenarioProcedureName, [])) { @@ -244,7 +246,9 @@ export class ObjectService { async isChangeValid_Element(msg: MessageUpdate): Promise<{ valid: boolean, reason: string }> { if (!msg.ArrayIndex && msg.ArrayIndex != 0) throw new Error('ArrayIndex not passed') - let fsPath: string = await ElementUtils.getFSPathOfFeature(msg.Project, msg.Feature); + let fsPath: string = msg.FsPath + if (fsPath == '') + fsPath = await ElementUtils.getFSPathOfFeature(msg.Project, msg.Feature); let document: TextDocument = await workspace.openTextDocument(fsPath); if (!await ElementUtils.getRangeOfElement(document, msg.Scenario, msg.Id, msg.Type, msg.ArrayIndex)) { return { diff --git a/vscode-extension/src/App logic/Utils/elementInsertionUtils.ts b/vscode-extension/src/App logic/Utils/elementInsertionUtils.ts index ad22cd8..f886329 100644 --- a/vscode-extension/src/App logic/Utils/elementInsertionUtils.ts +++ b/vscode-extension/src/App logic/Utils/elementInsertionUtils.ts @@ -81,7 +81,9 @@ export class ElementInsertionUtils { } private static async addNewScenarioToCode(msg: MessageUpdate): Promise { - let fsPath: string = await ElementUtils.getFSPathOfFeature(msg.Project, msg.Feature); + let fsPath: string = msg.FsPath + if (fsPath == '') + fsPath = await ElementUtils.getFSPathOfFeature(msg.Project, msg.Feature); let document: TextDocument = await workspace.openTextDocument(fsPath); let positionToInsert: Position = await ElementInsertionUtils.getPositionToInsertForScenario(document);