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

The compiler path selection control is not in sync with the textbox #12678

Merged
merged 4 commits into from
Sep 4, 2024
Merged
Changes from 2 commits
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
22 changes: 20 additions & 2 deletions Extension/ui/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,24 @@ class SettingsApp {
this.vsCodeApi.postMessage({
command: "knownCompilerSelect"
});
}

// Reset selection to none
el.value = "";
// To enable custom entries, the compiler path control is a text box on top of a select control.
// This function ensures that the select control is updated when the text box is changed.
private fixKnownCompilerSelection(): void {
const compilerPath = <HTMLInputElement>document.getElementById(elementId.compilerPath);
bobbrow marked this conversation as resolved.
Show resolved Hide resolved
const knownCompilers = <HTMLSelectElement>document.getElementById(elementId.knownCompilers);
for (let n = 0; n < knownCompilers.options.length; n++) {
bobbrow marked this conversation as resolved.
Show resolved Hide resolved
if (compilerPath.value.toLowerCase() === knownCompilers.options[n].value.toLowerCase()) {
knownCompilers.value = knownCompilers.options[n].value;
break;
}
if (n === knownCompilers.options.length - 1) {
knownCompilers.value = '';
}
}
}

private onChangedCheckbox(id: string): void {
if (this.updating) {
return;
Expand All @@ -235,6 +249,9 @@ class SettingsApp {
}

const el: HTMLInputElement = <HTMLInputElement>document.getElementById(id);
if (id === elementId.compilerPath) {
this.fixKnownCompilerSelection();
}
this.vsCodeApi.postMessage({
command: "change",
key: id,
Expand Down Expand Up @@ -268,6 +285,7 @@ class SettingsApp {
// Basic settings
(<HTMLInputElement>document.getElementById(elementId.configName)).value = config.name;
(<HTMLInputElement>document.getElementById(elementId.compilerPath)).value = config.compilerPath ? config.compilerPath : "";
this.fixKnownCompilerSelection();
(<HTMLInputElement>document.getElementById(elementId.compilerArgs)).value = joinEntries(config.compilerArgs);

(<HTMLInputElement>document.getElementById(elementId.intelliSenseMode)).value = config.intelliSenseMode ? config.intelliSenseMode : "${default}";
Expand Down
Loading