Skip to content

Commit d1e5411

Browse files
cristianocchenglou
andauthored
Fix request failed when there's a white space in the project path. (#80)
Fixes #78 Co-authored-by: Cheng Lou <[email protected]>
1 parent 27a4ed5 commit d1e5411

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## 1.0.x (unreleased)
22
- Fix diagnostics when location's not found (advice: use fewer ppxes!). See [#77](https://github.com/rescript-lang/rescript-vscode/issues/77).
3+
- Fix request failing when there's a white space in the project path.
34

45
## 1.0.5
56

server/src/RescriptEditorSupport.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ let findExecutable = (uri: string) => {
1919
if (projectRootPath == null || !binaryExists) {
2020
return null;
2121
} else {
22-
return { binaryPath, filePath, cwd: projectRootPath };
22+
return {
23+
binaryPathQuoted: '"' + binaryPath + '"', // path could have white space
24+
filePathQuoted: '"' + filePath + '"',
25+
cwd: projectRootPath,
26+
};
2327
}
2428
};
2529

@@ -34,9 +38,9 @@ export function runDumpCommand(
3438
onResult(null);
3539
} else {
3640
let command =
37-
executable.binaryPath +
41+
executable.binaryPathQuoted +
3842
" dump " +
39-
executable.filePath +
43+
executable.filePathQuoted +
4044
":" +
4145
msg.params.position.line +
4246
":" +
@@ -65,9 +69,9 @@ export function runCompletionCommand(
6569
fs.writeFileSync(tmpname, code, { encoding: "utf-8" });
6670

6771
let command =
68-
executable.binaryPath +
72+
executable.binaryPathQuoted +
6973
" complete " +
70-
executable.filePath +
74+
executable.filePathQuoted +
7175
":" +
7276
msg.params.position.line +
7377
":" +

0 commit comments

Comments
 (0)