Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with disabled compiler path in config UI if none detected #4912

Merged
merged 3 commits into from
Jan 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Extension/ui/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@
<!-- input compilerPath -->
<div class="section-note" data-loc-id="specify.a.compiler">Specify a compiler path or select a detected compiler path from the drop-down list.</div>
<div class="select-editable">
<span id="noCompilerPathsDetected" class="error" style="display: none" data-loc-id="no.compiler.paths.detected">(No compiler paths detected)</span>
<span id="noCompilerPathsDetected" style="display: none" data-loc-id="no.compiler.paths.detected">(No compiler paths detected)</span>
<select id="knownCompilers" style="width: 810px; display: none"></select>
<input name="inputValue" id="compilerPath" style="width: 777px; display: none" type="text"/>
</div>
Expand Down
25 changes: 15 additions & 10 deletions Extension/ui/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const elementId: { [key: string]: string } = {
compilerPath: "compilerPath",
compilerPathInvalid: "compilerPathInvalid",
knownCompilers: "knownCompilers",
noCompilerPathsDetected: "noCompilerPathsDetected",
compilerArgs: "compilerArgs",

intelliSenseMode: "intelliSenseMode",
Expand Down Expand Up @@ -338,20 +339,24 @@ class SettingsApp {
}

if (compilers.length === 0) {
this.showElement("noCompilerPathsDetected", true);
return;
}

this.showElement("compilerPath", true);
this.showElement("knownCompilers", true);

for (let path of compilers) {
// Get HTML element containing the string, as we can't localize strings in HTML js
let noCompilerSpan: HTMLSpanElement = <HTMLSpanElement>document.getElementById(elementId.noCompilerPathsDetected);
let option: HTMLOptionElement = document.createElement("option");
option.text = path;
option.value = path;
option.text = noCompilerSpan.textContent;
option.disabled = true;
list.append(option);
} else {
for (let path of compilers) {
let option: HTMLOptionElement = document.createElement("option");
option.text = path;
option.value = path;
list.append(option);
}
}

this.showElement(elementId.compilerPath, true);
this.showElement(elementId.knownCompilers, true);

// Initialize list with no selected item
list.value = "";
} finally {
Expand Down