MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / refreshVisibleState

Function refreshVisibleState

src/settings/lspServerDetail.js:402–456  ·  view source on GitHub ↗
($list, itemsByKey, serverId)

Source from the content-addressed store, hash-verified

400}
401
402async function refreshVisibleState($list, itemsByKey, serverId) {
403 if (!$list) return;
404
405 const snapshot = await buildSnapshot(serverId);
406 if (!snapshot) return;
407
408 updateItemDisplay($list, itemsByKey, "enabled", undefined, {
409 checkbox: snapshot.merged.enabled !== false,
410 });
411 updateItemDisplay($list, itemsByKey, "install_status", undefined, {
412 info: formatInstallInfo(snapshot.installResult),
413 text: formatStatusLabel(snapshot.installResult),
414 });
415 updateItemDisplay($list, itemsByKey, "install_server", "");
416 updateItemDisplay($list, itemsByKey, "update_server", "");
417 updateItemDisplay($list, itemsByKey, "uninstall_server", "");
418
419 const $installItem = $list.querySelector('[data-key="install_server"]');
420 if ($installItem) {
421 $installItem.style.display =
422 snapshot.installCommand || snapshot.installResult?.canInstall
423 ? ""
424 : "none";
425 }
426 const $updateItem = $list.querySelector('[data-key="update_server"]');
427 if ($updateItem) {
428 $updateItem.style.display =
429 snapshot.updateCommand || snapshot.installResult?.canUpdate ? "" : "none";
430 }
431 const $uninstallItem = $list.querySelector('[data-key="uninstall_server"]');
432 if ($uninstallItem) {
433 $uninstallItem.style.display = snapshot.uninstallCommand ? "" : "none";
434 }
435
436 updateItemDisplay(
437 $list,
438 itemsByKey,
439 "startup_timeout",
440 formatStartupTimeoutValue(snapshot.merged.startupTimeout),
441 );
442 updateItemDisplay(
443 $list,
444 itemsByKey,
445 "edit_init_options",
446 Object.keys(snapshot.override.initializationOptions || {}).length
447 ? strings["lsp-configured"]
448 : strings["lsp-empty"],
449 );
450
451 getFeatureItems().forEach(([key, extKey]) => {
452 updateItemDisplay($list, itemsByKey, key, undefined, {
453 checkbox: isBuiltinFeatureEnabled(snapshot.builtinExts, extKey),
454 });
455 });
456}
457
458function isBuiltinFeatureEnabled(builtinExts, extKey) {
459 if (extKey === "inlayHints") {

Callers 2

showFunction · 0.85
callbackFunction · 0.85

Calls 7

buildSnapshotFunction · 0.85
updateItemDisplayFunction · 0.85
formatInstallInfoFunction · 0.85
formatStatusLabelFunction · 0.85
getFeatureItemsFunction · 0.85
isBuiltinFeatureEnabledFunction · 0.85

Tested by

no test coverage detected