Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting not working on Windows #5

Closed
illbexyz opened this issue Sep 1, 2020 · 1 comment
Closed

Formatting not working on Windows #5

illbexyz opened this issue Sep 1, 2020 · 1 comment

Comments

@illbexyz
Copy link
Contributor

illbexyz commented Sep 1, 2020

When formatting on Windows I get this error:

[Error - 20:56:35] Request textDocument/formatting failed.
  Message: Cannot find a nearby node_modules\bs-platform\win32\bsc.exe. It's needed for formatting.
  Code: -32600 

I found the cause of the error in:

// TODO: remove this hack
let filePath = openFile.replace('file://', '');

because just removing the file:// prefix isn't enough in Windows. On my system filePath contains \c%3A\Users\Alberto\workspace\rescript-vscode\node_modules\bs-platform\win32\bsc.exe which isn't recognized by NodeJS's APIs.

illbexyz added a commit to illbexyz/rescript-vscode that referenced this issue Sep 1, 2020
@samcf
Copy link

samcf commented Sep 5, 2020

Manually patched this for myself with the following but the work done here #6 seems obviously better.

// chenglou92.rescript-vscode-0.0.4\server\out\server.js#374
// TODO: remove this hack
let filePath = params.textDocument.uri.replace('file://', '');
if (process_1.default.platform === "win32") {
    filePath = decodeURIComponent(filePath).substring(1)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants