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

Function callback

src/settings/lspServerDetail.js:556–783  ·  view source on GitHub ↗
(key, value)

Source from the content-addressed store, hash-verified

554 };
555
556 async function callback(key, value) {
557 const $list = this?.parentElement;
558 const $loader = loader.create("LSP", strings["loading..."]);
559
560 try {
561 const snapshot = await buildSnapshot(serverId);
562 if (!snapshot) {
563 toast(strings["lsp-server-not-found"]);
564 return;
565 }
566
567 switch (key) {
568 case "enabled":
569 await persistEnabled(serverId, value);
570 if (!value) {
571 stopManagedServer(serverId);
572 }
573 toast(
574 value
575 ? strings["lsp-server-enabled-toast"]
576 : strings["lsp-server-disabled-toast"],
577 );
578 break;
579
580 case "remove_custom_server":
581 $loader.hide();
582 if (
583 !(await confirm(
584 strings["lsp-remove-custom-server"],
585 fillTemplate(strings["lsp-remove-custom-server-confirm"], {
586 server: snapshot.liveServer.label || serverId,
587 }),
588 ))
589 ) {
590 break;
591 }
592 $loader.show();
593 stopManagedServer(serverId);
594 await removeCustomServer(serverId);
595 toast(strings["lsp-custom-server-removed"]);
596 page.hide();
597 appSettings.uiSettings["lsp-settings"]?.show();
598 return;
599
600 case "install_status": {
601 const result = await checkRuntimeServerInstallation(snapshot.merged);
602 $loader.hide();
603 const lines = [
604 fillTemplate(strings["lsp-status-line"], {
605 status: formatInstallStatus(result),
606 }),
607 result.version
608 ? fillTemplate(strings["lsp-version-line"], {
609 version: result.version,
610 })
611 : null,
612 fillTemplate(strings["lsp-details-line"], {
613 details: formatInstallInfo(result),

Callers

nothing calls this directly

Calls 15

stopManagedServerFunction · 0.90
removeCustomServerFunction · 0.90
installRuntimeServerFunction · 0.90
uninstallRuntimeServerFunction · 0.90
buildSnapshotFunction · 0.85
persistEnabledFunction · 0.85
confirmFunction · 0.85
fillTemplateFunction · 0.85
formatInstallStatusFunction · 0.85
formatInstallInfoFunction · 0.85
alertFunction · 0.85

Tested by

no test coverage detected