From 51276091203d48cecb154271e69be0ce784ed01d Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 5 Nov 2024 14:05:49 +0100 Subject: [PATCH] Fix: deal with dashes in the path --- src/Utils.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Utils.ts b/src/Utils.ts index 73b908f5a..a341fc6a8 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -1524,7 +1524,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be const error = new Error("No error") const stack = error.stack.split("\n") stack.shift() // Remove "Error: No error" - const regex = /at (.*) \(([a-zA-Z0-9/.]+):([0-9]+):([0-9]+)\)/ + const regex = /at (.*) \(([a-zA-Z0-9-/.]+):([0-9]+):([0-9]+)\)/ const stackItem = stack[Math.abs(offset) + 1] let functionName: string @@ -1534,10 +1534,10 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be let _: string const matchWithFuncName = stackItem.match(regex) if (matchWithFuncName) { - ;[_, functionName, path, line, column] = matchWithFuncName + [_, functionName, path, line, column] = matchWithFuncName } else { - const regexNoFuncName: RegExp = new RegExp("at ([a-zA-Z0-9/.]+):([0-9]+):([0-9]+)") - ;[_, path, line, column] = stackItem.match(regexNoFuncName) + const regexNoFuncName: RegExp = new RegExp("at ([a-zA-Z0-9-/.]+):([0-9]+):([0-9]+)"); + [_, path, line, column] = stackItem.match(regexNoFuncName) } const markdownLocation = path.substring(path.indexOf("MapComplete/src") + 11) + "#L" + line