From 8b584b3a75598ea8b57e7045399a6ce02cb62e47 Mon Sep 17 00:00:00 2001 From: Florian Hammerschmidt Date: Thu, 24 Oct 2024 14:36:27 +0200 Subject: [PATCH] More logging --- server/src/server.ts | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/server/src/server.ts b/server/src/server.ts index a9b45f037..12e1c1948 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -216,8 +216,8 @@ let compilerLogsWatcher = chokidar stabilityThreshold: 1, }, }) - .on("all", (_e, changedPath) => { - console.log("changes in path: ", changedPath); + .on("all", (eventName, changedPath, stats) => { + console.log(eventName, changedPath, stats); if (changedPath.includes("build.ninja")) { if (config.extensionConfiguration.cache?.projectConfig?.enable === true) { console.log("Changed path includes build ninja"); @@ -227,10 +227,32 @@ let compilerLogsWatcher = chokidar syncProjectConfigCache(projectRoot); } } + } else if ( + eventName === "unlink" && + changedPath.includes(".compiler.log") + ) { + console.log(compilerLogsWatcher.getWatched()); + console.log(".compiler.log has been deleted"); + + let projectRoot = utils.findProjectRootOfFile(changedPath); + if (projectRoot != null) { + compilerLogsWatcher.add( + path.join(projectRoot, c.compilerLogPartialPath) + ); + if ( + config.extensionConfiguration.cache?.projectConfig?.enable === true + ) { + compilerLogsWatcher.add( + path.join(projectRoot, c.buildNinjaPartialPath) + ); + syncProjectConfigCache(projectRoot); + } + } } else { try { console.log("Send updated diagnostics"); sendUpdatedDiagnostics(); + console.log("Send compilation finished message"); sendCompilationFinishedMessage(); if (config.extensionConfiguration.inlayHints?.enable === true) { sendInlayHintsRefresh();