From 8496e20247dfab44cd0c423929593def3fedbb07 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 13 Dec 2024 05:55:30 +0000 Subject: [PATCH] =?UTF-8?q?refactor:=20simplify=20findScript=20function=20?= =?UTF-8?q?logic=20=E2=99=BB=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/vscode/src/fragmentcommands.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/vscode/src/fragmentcommands.ts b/packages/vscode/src/fragmentcommands.ts index 9260ae1d38..0fd293e976 100644 --- a/packages/vscode/src/fragmentcommands.ts +++ b/packages/vscode/src/fragmentcommands.ts @@ -82,17 +82,16 @@ export function activateFragmentCommands(state: ExtensionState) { const findScript = (filename: vscode.Uri) => { const fp = state.host.path.resolve(filename.fsPath) const scripts = state.project.scripts.filter((p) => !!p.filename) - const script = scripts - .filter((p) => !!p.filename) - .find((p) => { - const sfp = scriptFile(p) - return sfp === fp - }) + const script = scripts.find((p) => { + const sfp = scriptFile(p) + return sfp === fp + }) if (!script) { - state.output.appendLine(`requested script: ${fp}`) + state.output.appendLine(`fspath: ${filename.fsPath}`) + state.output.appendLine(`resolved: ${fp}`) state.output.appendLine( - `project folder: ${state.host.projectFolder()}` + `projectfolder: ${state.host.projectFolder()}` ) scripts.forEach((s) => state.output.appendLine(`- ${s.filename}\n ${scriptFile(s)}`)