From ea0ca74f5cf509c6e2c117354bce4d5e03fa4423 Mon Sep 17 00:00:00 2001 From: yiftahw <63462505+yiftahw@users.noreply.github.com> Date: Sun, 8 Dec 2024 09:36:15 +0200 Subject: [PATCH 1/2] fix issue #7030 --- Extension/src/LanguageServer/configurations.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extension/src/LanguageServer/configurations.ts b/Extension/src/LanguageServer/configurations.ts index 6f23eb347..88fd55280 100644 --- a/Extension/src/LanguageServer/configurations.ts +++ b/Extension/src/LanguageServer/configurations.ts @@ -2340,7 +2340,7 @@ export class CppProperties { } } else { const compileCommandsLastChanged: Date | undefined = this.compileCommandsFileWatcherFallbackTime.get(compileCommandsFile); - if (compileCommandsLastChanged !== undefined && stats.mtime > compileCommandsLastChanged) { + if ((this.compileCommandsFile === null) || (compileCommandsLastChanged !== undefined && stats.mtime > compileCommandsLastChanged)) { this.compileCommandsFileWatcherFallbackTime.set(compileCommandsFile, new Date()); this.onCompileCommandsChanged(compileCommandsFile); this.compileCommandsFile = vscode.Uri.file(compileCommandsFile); // File created. From 0ece3dc670c46b88eda333f280fdf1ac7e7361d1 Mon Sep 17 00:00:00 2001 From: yiftahw <63462505+yiftahw@users.noreply.github.com> Date: Sun, 8 Dec 2024 10:00:27 +0200 Subject: [PATCH 2/2] check for the undefined case (on first load) --- Extension/src/LanguageServer/configurations.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Extension/src/LanguageServer/configurations.ts b/Extension/src/LanguageServer/configurations.ts index 88fd55280..028cc7235 100644 --- a/Extension/src/LanguageServer/configurations.ts +++ b/Extension/src/LanguageServer/configurations.ts @@ -2340,7 +2340,9 @@ export class CppProperties { } } else { const compileCommandsLastChanged: Date | undefined = this.compileCommandsFileWatcherFallbackTime.get(compileCommandsFile); - if ((this.compileCommandsFile === null) || (compileCommandsLastChanged !== undefined && stats.mtime > compileCommandsLastChanged)) { + if ((this.compileCommandsFile === undefined) || + (this.compileCommandsFile === null) || + (compileCommandsLastChanged !== undefined && stats.mtime > compileCommandsLastChanged)) { this.compileCommandsFileWatcherFallbackTime.set(compileCommandsFile, new Date()); this.onCompileCommandsChanged(compileCommandsFile); this.compileCommandsFile = vscode.Uri.file(compileCommandsFile); // File created.