diff --git a/CHANGELOG.md b/CHANGELOG.md index f9e50a372..0567ee038 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 1.0.x (unreleased) - Fix diagnostics when location's not found (advice: use fewer ppxes!). See [#77](https://github.com/rescript-lang/rescript-vscode/issues/77). +- Fix request failing when there's a white space in the project path. ## 1.0.5 diff --git a/server/src/RescriptEditorSupport.ts b/server/src/RescriptEditorSupport.ts index 1c3b80e25..d4d36f58a 100644 --- a/server/src/RescriptEditorSupport.ts +++ b/server/src/RescriptEditorSupport.ts @@ -19,7 +19,11 @@ let findExecutable = (uri: string) => { if (projectRootPath == null || !binaryExists) { return null; } else { - return { binaryPath, filePath, cwd: projectRootPath }; + return { + binaryPathQuoted: '"' + binaryPath + '"', // path could have white space + filePathQuoted: '"' + filePath + '"', + cwd: projectRootPath, + }; } }; @@ -34,9 +38,9 @@ export function runDumpCommand( onResult(null); } else { let command = - executable.binaryPath + + executable.binaryPathQuoted + " dump " + - executable.filePath + + executable.filePathQuoted + ":" + msg.params.position.line + ":" + @@ -65,9 +69,9 @@ export function runCompletionCommand( fs.writeFileSync(tmpname, code, { encoding: "utf-8" }); let command = - executable.binaryPath + + executable.binaryPathQuoted + " complete " + - executable.filePath + + executable.filePathQuoted + ":" + msg.params.position.line + ":" +