Skip to content

Commit

Permalink
#98 use fsPath which is handed over from UI instead of trying to figu…
Browse files Browse the repository at this point in the history
…re it out again
  • Loading branch information
DavidFeldhoff committed Feb 18, 2021
1 parent 439500b commit 325e6ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions vscode-extension/src/App logic/Services/ObjectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, [])) {
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ export class ElementInsertionUtils {
}

private static async addNewScenarioToCode(msg: MessageUpdate): Promise<boolean> {
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);
Expand Down

0 comments on commit 325e6ec

Please sign in to comment.