Skip to content

Commit

Permalink
Detect compile_commands.json after containing folder deleted and recr…
Browse files Browse the repository at this point in the history
…eated on Windows (microsoft#13032)

* fix issue microsoft#7030
* check for the undefined case (on first load)
  • Loading branch information
yiftahw authored Dec 11, 2024
1 parent fa80d44 commit d04d53e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Extension/src/LanguageServer/configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2340,7 +2340,9 @@ export class CppProperties {
}
} else {
const compileCommandsLastChanged: Date | undefined = this.compileCommandsFileWatcherFallbackTime.get(compileCommandsFile);
if (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.
Expand Down

0 comments on commit d04d53e

Please sign in to comment.