fix(lsp): improve custom server transport setup#1998
fix(lsp): improve custom server transport setup#1998bajrangCoder merged 3 commits intoAcode-Foundation:mainfrom
Conversation
Greptile SummaryThis PR improves the custom LSP server workflow in several meaningful ways: it adds a transport-type selection step (STDIO vs direct WebSocket) when registering a custom server, fixes the STDIO transport so it can work with auto-discovered bridge ports (not just a statically configured URL), hides install/update/uninstall controls for externally-managed WebSocket servers, adds a "Remove custom server" action from the detail page, and pre-fills the check-command prompt with a sensible default derived from the binary/installer config. Key changes:
Confidence Score: 5/5Safe to merge; all remaining findings are P2 style suggestions with no impact on runtime correctness. The core logic changes in transport.ts, lspConfigUtils.js, and lspServerDetail.js are correct: the dynamic-port bypass is properly guarded, the hasOwnProperty-based transport/launcher merging correctly handles explicit undefined, and the remove flow stops the server before unregistering. The only issue found is an unquoted-path default in a user-editable prompt, which cannot cause data loss or runtime breakage. src/settings/lspSettings.js — the buildDefaultCheckCommand helper generates unquoted paths; low severity since it is only a pre-filled default the user can edit. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant lspSettings as lspSettings.js
participant lspConfigUtils as lspConfigUtils.js
participant lspServerDetail as lspServerDetail.js
participant transport as transport.ts
participant lspApi as lspApi
User->>lspSettings: Add custom server
lspSettings->>User: Prompt: Server ID / Languages
lspSettings->>User: Select transport (STDIO or WebSocket)
alt WebSocket
lspSettings->>User: Prompt: WebSocket URL (validated)
lspSettings->>lspConfigUtils: upsertCustomServer({transport:{kind:"websocket",url}, launcher:undefined})
else STDIO
lspSettings->>User: Prompt: binary command, args, installer
lspSettings->>User: Prompt: check command (pre-filled via buildDefaultCheckCommand)
lspSettings->>lspConfigUtils: upsertCustomServer({transport:{kind:"stdio",...}, launcher:{bridge:{...}}})
end
lspConfigUtils->>lspApi: upsert(definition)
lspConfigUtils->>appSettings: persist config
User->>lspServerDetail: Open server detail
lspServerDetail->>lspConfigUtils: isCustomServer(id)
lspServerDetail->>lspServerDetail: isDirectWebSocketServer(merged)
alt Direct WebSocket
lspServerDetail-->>User: Hide install/update/uninstall controls
else STDIO / bridged
lspServerDetail-->>User: Show install/update/uninstall controls
lspServerDetail->>transport: createStdioTransport(server, context)
transport->>transport: check url OR dynamicPort>0
transport->>transport: createWebSocketTransport(server, context)
end
User->>lspServerDetail: Remove custom server
lspServerDetail->>User: Confirm dialog
lspServerDetail->>lspServerDetail: stopManagedServer(serverId)
lspServerDetail->>lspConfigUtils: removeCustomServer(serverId)
lspConfigUtils->>appSettings: delete server from config
lspConfigUtils->>lspApi: servers.unregister(key)
lspServerDetail-->>User: Toast + navigate back to LSP settings
|
Changes
Fixes: #1993