(key, value)
| 264 | } |
| 265 | |
| 266 | async function callback(key, value) { |
| 267 | if (key === "allow_non_terminal_workspace") { |
| 268 | await appSettings.update({ |
| 269 | lsp: { |
| 270 | ...(appSettings.value.lsp || {}), |
| 271 | allowNonTerminalWorkspace: value === true, |
| 272 | }, |
| 273 | }); |
| 274 | return; |
| 275 | } |
| 276 | |
| 277 | if (key === "add_custom_server") { |
| 278 | try { |
| 279 | const idInput = await prompt(strings["lsp-server-id"], "", "text"); |
| 280 | if (idInput === null) return; |
| 281 | |
| 282 | const serverId = normalizeServerId(idInput); |
| 283 | if (!serverId) { |
| 284 | toast(strings["lsp-error-server-id-required"]); |
| 285 | return; |
| 286 | } |
| 287 | |
| 288 | const label = await prompt( |
| 289 | strings["lsp-server-label"], |
| 290 | serverId, |
| 291 | "text", |
| 292 | ); |
| 293 | if (label === null) return; |
| 294 | |
| 295 | const languageInput = await prompt( |
| 296 | strings["lsp-language-ids"], |
| 297 | "", |
| 298 | "text", |
| 299 | ); |
| 300 | if (languageInput === null) return; |
| 301 | const languages = normalizeLanguages(languageInput); |
| 302 | if (!languages.length) { |
| 303 | toast(strings["lsp-error-language-id-required"]); |
| 304 | return; |
| 305 | } |
| 306 | |
| 307 | const transportKind = await select( |
| 308 | strings.type || "Type", |
| 309 | getTransportMethods(), |
| 310 | ); |
| 311 | if (!transportKind) return; |
| 312 | |
| 313 | let transport; |
| 314 | let launcher; |
| 315 | |
| 316 | if (transportKind === "websocket") { |
| 317 | const websocketUrlInput = await prompt( |
| 318 | strings["lsp-websocket-url"] || "WebSocket URL", |
| 319 | "ws://127.0.0.1:3000/", |
| 320 | "text", |
| 321 | { |
| 322 | test: (value) => { |
| 323 | try { |
nothing calls this directly
no test coverage detected