MCPcopy Create free account
hub / github.com/microsoft/vscode-cpptools / setKnownCompilers

Method setKnownCompilers

Extension/ui/settings.ts:371–406  ·  view source on GitHub ↗
(compilers: string[])

Source from the content-addressed store, hash-verified

369 }
370
371 private setKnownCompilers(compilers: string[]): void {
372 this.updating = true;
373 try {
374 const list: HTMLSelectElement = <HTMLSelectElement>document.getElementById(elementId.knownCompilers);
375
376 // No need to add items unless webview is reloaded, in which case it will not have any elements.
377 // Otherwise, add items again.
378 if (list.firstChild) {
379 return;
380 }
381
382 if (compilers.length === 0) {
383 // Get HTML element containing the string, as we can't localize strings in HTML js
384 const noCompilerSpan: HTMLSpanElement = <HTMLSpanElement>document.getElementById(elementId.noCompilerPathsDetected);
385 const option: HTMLOptionElement = document.createElement("option");
386 option.text = noCompilerSpan.textContent ?? "";
387 option.disabled = true;
388 list.append(option);
389 } else {
390 for (const path of compilers) {
391 const option: HTMLOptionElement = document.createElement("option");
392 option.text = path;
393 option.value = path;
394 list.append(option);
395 }
396 }
397
398 this.showElement(elementId.compilerPath, true);
399 this.showElement(elementId.knownCompilers, true);
400
401 // Initialize list with no selected item
402 list.value = "";
403 } finally {
404 this.updating = false;
405 }
406 }
407
408 private showElement(elementID: string, show: boolean): void {
409 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion

Callers 1

onMessageReceivedMethod · 0.95

Calls 2

showElementMethod · 0.95
appendMethod · 0.65

Tested by

no test coverage detected