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

Function uninstallServer

src/cm/lsp/serverLauncher.ts:812–870  ·  view source on GitHub ↗
(
  server: LspServerDefinition,
  options: { promptConfirm?: boolean } = {},
)

Source from the content-addressed store, hash-verified

810}
811
812export async function uninstallServer(
813 server: LspServerDefinition,
814 options: { promptConfirm?: boolean } = {},
815): Promise<boolean> {
816 const bundle = getServerBundle(server.id);
817 if (bundle?.uninstallServer) {
818 return bundle.uninstallServer(server.id, server, options);
819 }
820
821 const { promptConfirm = false } = options;
822 const cacheKey = getInstallCacheKey(server);
823 const displayLabel = getInstallLabel(server);
824 const command = getUninstallCommand(server);
825
826 if (!command) {
827 throw new Error(`${displayLabel} has no uninstall command.`);
828 }
829
830 if (promptConfirm) {
831 notificationManager.pushNotification({
832 icon: "zap",
833 title: displayLabel,
834 message: strings["lsp-uninstall-notification"].replace(
835 "{server}",
836 displayLabel,
837 ),
838 type: "warning",
839 action: (notification) => {
840 uninstallServer(server, { promptConfirm: false });
841 notificationManager.closeNotification(notification);
842 },
843 });
844 return false;
845 }
846
847 let loading = true;
848 try {
849 notificationManager.pushNotification({
850 icon: "zap",
851 title: displayLabel,
852 message: `Uninstalling ${displayLabel}...`,
853 loading: () => loading,
854 });
855 //await runForegroundCommand(command);
856 await runQuickCommand(command);
857 if (cacheKey) {
858 checkedCommands.delete(cacheKey);
859 }
860 resetInstallState(server.id);
861 stopManagedServer(server.id);
862 return true;
863 } catch (error) {
864 console.error(`Failed to uninstall ${server.id}`, error);
865 toast(strings?.error ?? "Error");
866 throw error;
867 } finally {
868 loading = false;
869 }

Callers 1

uninstallFunction · 0.90

Calls 10

getServerBundleFunction · 0.90
runQuickCommandFunction · 0.90
getInstallCacheKeyFunction · 0.85
getInstallLabelFunction · 0.85
resetInstallStateFunction · 0.85
stopManagedServerFunction · 0.85
pushNotificationMethod · 0.80
getUninstallCommandFunction · 0.70
deleteMethod · 0.65
errorMethod · 0.45

Tested by

no test coverage detected