From 58f86a327e2390be672c09a6024139281aa918d9 Mon Sep 17 00:00:00 2001 From: Test Date: Sun, 22 Mar 2026 07:53:32 +0100 Subject: [PATCH] fix(vscode): set LSP working directory + better error diagnostics - LSP server options include cwd set to workspace root - Error messages show which binary path was tried - Console logging for successful LSP start and failure details Trace: skip --- vscode-rivet/src/extension.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vscode-rivet/src/extension.ts b/vscode-rivet/src/extension.ts index 124164a..fb449ee 100644 --- a/vscode-rivet/src/extension.ts +++ b/vscode-rivet/src/extension.ts @@ -44,11 +44,13 @@ export async function activate(context: vscode.ExtensionContext) { return; } + const lspWorkspaceRoot = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath; try { const serverOptions: ServerOptions = { command: rivetPath, args: ['lsp'], transport: TransportKind.stdio, + options: { cwd: lspWorkspaceRoot }, }; const clientOptions: LanguageClientOptions = { @@ -70,10 +72,13 @@ export async function activate(context: vscode.ExtensionContext) { }); statusBarItem.text = '$(shield) Rivet'; + console.log(`rivet LSP started: ${rivetPath}`); } catch (err: unknown) { const msg = err instanceof Error ? err.message : String(err); - vscode.window.showWarningMessage(`Rivet LSP failed to start: ${msg}`); + vscode.window.showWarningMessage(`Rivet LSP failed to start (${rivetPath}): ${msg}`); statusBarItem.text = '$(shield) Rivet (LSP error)'; + console.error(`rivet LSP error: ${msg}, binary: ${rivetPath}, cwd: ${lspWorkspaceRoot}`); + // Continue without LSP — serve and commands still work } // --- Start serve --watch in background ---