Skip to content

Commit add5596

Browse files
committed
Correct pathToURI
1 parent d793679 commit add5596

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

server/src/utils.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import fs from "fs";
1010
import fsAsync from "fs/promises";
1111
import * as os from "os";
1212
import semver from "semver";
13-
import { fileURLToPath } from "url";
13+
import { fileURLToPath, pathToFileURL } from "url";
1414

1515
import * as codeActions from "./codeActions";
1616
import * as c from "./constants";
@@ -704,9 +704,7 @@ export let runBuildWatcherUsingValidBuildPath = (
704704

705705
// parser helpers
706706
export let pathToURI = (file: NormalizedPath): FileURI => {
707-
return (
708-
process.platform === "win32" ? `file:\\\\\\${file}` : `file://${file}`
709-
) as FileURI;
707+
return pathToFileURL(file).toString() as FileURI;
710708
};
711709
let parseFileAndRange = (fileAndRange: string) => {
712710
// https://github.com/rescript-lang/rescript-compiler/blob/0a3f4bb32ca81e89cefd5a912b8795878836f883/jscomp/super_errors/super_location.ml#L15-L25

0 commit comments

Comments
 (0)