Skip to content

Commit 0c8ccb1

Browse files
author
Waisman, Yiftah
committed
fixes after merge
1 parent e273731 commit 0c8ccb1

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

Extension/src/LanguageServer/configurations.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,11 +1092,13 @@ export class CppProperties {
10921092
}
10931093

10941094
if (configuration.compileCommands) {
1095-
configuration.compileCommands = configuration.compileCommands.map((path: string) => this.resolvePath(path));
1096-
if (!this.compileCommandsFileWatcherFallbackTime.has(configuration.compileCommands)) {
1097-
// Start tracking the fallback time for a new path.
1098-
this.compileCommandsFileWatcherFallbackTime.set(configuration.compileCommands, new Date());
1099-
}
1095+
configuration.compileCommands = configuration.compileCommands?.map((path: string) => this.resolvePath(path));
1096+
configuration.compileCommands?.forEach((path: string) => {
1097+
if (!this.compileCommandsFileWatcherFallbackTime.has(path)) {
1098+
// Start tracking the fallback time for a new path.
1099+
this.compileCommandsFileWatcherFallbackTime.set(path, new Date());
1100+
}
1101+
});
11001102
}
11011103

11021104
if (configuration.forcedInclude) {
@@ -1120,10 +1122,12 @@ export class CppProperties {
11201122
// Instead, we clear entries that are no longer relevant.
11211123
const trackedCompileCommandsPaths: Set<string> = new Set();
11221124
this.configurationJson?.configurations.forEach((config: Configuration) => {
1123-
const path = this.resolvePath(config.compileCommands);
1124-
if (path.length > 0) {
1125-
trackedCompileCommandsPaths.add(path);
1126-
}
1125+
config.compileCommands?.forEach((path: string) => {
1126+
const compileCommandsFile = this.resolvePath(path);
1127+
if (compileCommandsFile.length > 0) {
1128+
trackedCompileCommandsPaths.add(compileCommandsFile);
1129+
}
1130+
});
11271131
});
11281132

11291133
for (const path of this.compileCommandsFileWatcherFallbackTime.keys()) {
@@ -1145,9 +1149,9 @@ export class CppProperties {
11451149
const filePaths: Set<string> = new Set<string>();
11461150
this.configurationJson.configurations.forEach(c => {
11471151
c.compileCommands?.forEach((path: string) => {
1148-
const fileSystemCompileCommandsPath: string = this.resolvePath(path);
1149-
if (fs.existsSync(fileSystemCompileCommandsPath)) {
1150-
filePaths.add(fileSystemCompileCommandsPath);
1152+
const compileCommandsFile: string = this.resolvePath(path);
1153+
if (fs.existsSync(compileCommandsFile)) {
1154+
filePaths.add(compileCommandsFile);
11511155
}
11521156
})
11531157
});

0 commit comments

Comments
 (0)