Skip to content

Commit 9b29698

Browse files
fix cl.exe check and other UI fixes (#3769)
1 parent b5c94e9 commit 9b29698

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

Extension/src/LanguageServer/configurations.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,10 +959,13 @@ export class CppProperties {
959959
}
960960
}
961961
}
962-
962+
963963
if (!pathExists) {
964964
let message: string = `Cannot find: ${resolvedCompilerPath}`;
965965
compilerPathErrors.push(message);
966+
} else if (compilerPathAndArgs.compilerPath === "") {
967+
let message: string = `Invalid input, cannot resolve compiler path`;
968+
compilerPathErrors.push(message);
966969
} else if (!util.checkFileExistsSync(resolvedCompilerPath)) {
967970
let message: string = `Path is not a file: ${resolvedCompilerPath}`;
968971
compilerPathErrors.push(message);

Extension/src/common.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,12 @@ export function extractCompilerPathAndArgs(inputCompilerPath: string): CompilerP
794794
let additionalArgs: string[];
795795
let isWindows: boolean = os.platform() === 'win32';
796796
if (compilerPath) {
797-
if (compilerPath.startsWith("\"")) {
797+
if (compilerPath === "cl.exe") {
798+
// Input is only compiler name, this is only for cl.exe
799+
compilerName = compilerPath;
800+
801+
} else if (compilerPath.startsWith("\"")) {
802+
// Input has quotes around compiler path
798803
let endQuote: number = compilerPath.substr(1).search("\"") + 1;
799804
if (endQuote !== -1) {
800805
additionalArgs = compilerPath.substr(endQuote + 1).split(" ");
@@ -803,6 +808,7 @@ export function extractCompilerPathAndArgs(inputCompilerPath: string): CompilerP
803808
compilerName = compilerPath.replace(/^.*(\\|\/|\:)/, '');
804809
}
805810
} else {
811+
// Input has no quotes but can have a compiler path with spaces and args.
806812
// Go from right to left checking if a valid path is to the left of a space.
807813
let spaceStart: number = compilerPath.lastIndexOf(" ");
808814
if (spaceStart !== -1 && (!isWindows || !compilerPath.endsWith("cl.exe")) && !checkFileExistsSync(compilerPath)) {
@@ -824,7 +830,7 @@ export function extractCompilerPathAndArgs(inputCompilerPath: string): CompilerP
824830
}
825831
}
826832
// Get compiler name if there are no args but path is valid or a valid path was found with args.
827-
if (checkFileExistsSync(compilerPath)) {
833+
if (compilerPath === "cl.exe" || checkFileExistsSync(compilerPath)) {
828834
compilerName = compilerPath.replace(/^.*(\\|\/|\:)/, '');
829835
}
830836
}

Extension/ui/settings.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
margin-right: 6px;
6363
margin-top: -4px;
6464
content: '\276E';
65-
transform: rotate(90deg);
65+
transform: rotate(270deg);
6666
}
6767

6868
.collapse:after {
@@ -71,7 +71,7 @@
7171
margin-right: 6px;
7272
margin-top: -4px;
7373
content: '\276E';
74-
transform: rotate(270deg);
74+
transform: rotate(90deg);
7575
}
7676

7777
.main {

Extension/ui/settings.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ class SettingsApp {
189189
this.vsCodeApi.postMessage({
190190
command: "knownCompilerSelect"
191191
});
192+
193+
// Reset selection to none
194+
el.value = "";
192195
}
193196
private onChangedCheckbox(id: string): void {
194197
if (this.updating) {

0 commit comments

Comments
 (0)