( server: LspServerDefinition, launcher: LauncherConfig | undefined, cacheKey: string, )
| 870 | } |
| 871 | |
| 872 | async function performInstallCheck( |
| 873 | server: LspServerDefinition, |
| 874 | launcher: LauncherConfig | undefined, |
| 875 | cacheKey: string, |
| 876 | ): Promise<boolean> { |
| 877 | try { |
| 878 | const checkCommand = |
| 879 | launcher?.checkCommand || buildDerivedCheckCommand(server); |
| 880 | if (checkCommand) { |
| 881 | await runQuickCommand(checkCommand); |
| 882 | } |
| 883 | checkedCommands.set(cacheKey, STATUS_PRESENT); |
| 884 | return true; |
| 885 | } catch (error) { |
| 886 | if (!getInstallCommand(server, "install")) { |
| 887 | checkedCommands.set(cacheKey, STATUS_FAILED); |
| 888 | console.warn( |
| 889 | `LSP server ${server.id} is missing check command result and has no installer.`, |
| 890 | error, |
| 891 | ); |
| 892 | throw error; |
| 893 | } |
| 894 | |
| 895 | const installed = await installServer(server, "install", { |
| 896 | promptConfirm: true, |
| 897 | }); |
| 898 | if (!installed) { |
| 899 | checkedCommands.set(cacheKey, STATUS_DECLINED); |
| 900 | return false; |
| 901 | } |
| 902 | checkedCommands.set(cacheKey, STATUS_PRESENT); |
| 903 | return true; |
| 904 | } |
| 905 | } |
| 906 | |
| 907 | async function startInteractiveServer( |
| 908 | command: string, |
no test coverage detected