Skip to content

Commit d1e90b5

Browse files
authored
Remove outdated logic from getConfigIndexForPlatform (#1992)
1 parent 7f10e90 commit d1e90b5

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

Extension/src/LanguageServer/configurations.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,13 @@ export class CppProperties {
267267
}
268268

269269
private getConfigIndexForPlatform(config: any): number {
270-
if (this.configurationJson.configurations.length > 3) {
271-
return this.configurationJson.configurations.length - 1; // Default to the last custom configuration.
272-
}
273-
let nodePlatform: NodeJS.Platform = process.platform;
274270
let plat: string;
275-
if (nodePlatform === 'linux') {
276-
plat = "Linux";
277-
} else if (nodePlatform === 'darwin') {
271+
if (process.platform === 'darwin') {
278272
plat = "Mac";
279-
} else if (nodePlatform === 'win32') {
273+
} else if (process.platform === 'win32') {
280274
plat = "Win32";
275+
} else {
276+
plat = "Linux";
281277
}
282278
for (let i: number = 0; i < this.configurationJson.configurations.length; i++) {
283279
if (config.configurations[i].name === plat) {
@@ -293,14 +289,12 @@ export class CppProperties {
293289
return "clang-x64";
294290
} else if (name === "Win32") {
295291
return "msvc-x64";
296-
} else {
292+
} else if (process.platform === 'win32') {
297293
// Custom configs default to the OS's preference.
298-
let nodePlatform: NodeJS.Platform = process.platform;
299-
if (nodePlatform === 'linux' || nodePlatform === 'darwin') {
300-
return "clang-x64";
301-
}
294+
return "msvc-x64";
295+
} else {
296+
return "clang-x64";
302297
}
303-
return "msvc-x64";
304298
}
305299

306300
private includePathConverted(): boolean {
@@ -595,7 +589,7 @@ export class CppProperties {
595589
for (let i: number = 0; i < this.configurationJson.configurations.length; i++) {
596590
let config: Configuration = this.configurationJson.configurations[i];
597591
// Look for Mac configs and extra configs on Mac systems
598-
if (config.name === "Mac" || (process.platform === "darwin" && config.name !== "Win32" && config.name !== "Linux")) {
592+
if (config.name === "Mac" || (process.platform === 'darwin' && config.name !== "Win32" && config.name !== "Linux")) {
599593
if (config.macFrameworkPath === undefined) {
600594
config.macFrameworkPath = [
601595
"/System/Library/Frameworks",

0 commit comments

Comments
 (0)