Skip to content

Commit 39312c9

Browse files
amiraliescristianoc
authored andcommitted
Fix using path as uri for diagnostics
1 parent 4cdc64a commit 39312c9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

server/src/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ export let runBuildWatcherUsingValidBuildPath = (
282282
*/
283283

284284
// parser helpers
285-
let normalizeFileForWindows = (file: string) => {
286-
return process.platform === "win32" ? `file:\\\\\\${file}` : file;
285+
let pathToURI = (file: string) => {
286+
return process.platform === "win32" ? `file:\\\\\\${file}` : `file://${file}`;
287287
};
288288
let parseFileAndRange = (fileAndRange: string) => {
289289
// https://github.com/rescript-lang/rescript-compiler/blob/0a3f4bb32ca81e89cefd5a912b8795878836f883/jscomp/super_errors/super_location.ml#L15-L25
@@ -307,7 +307,7 @@ let parseFileAndRange = (fileAndRange: string) => {
307307
if (match === null) {
308308
// no location! Though LSP insist that we provide at least a dummy location
309309
return {
310-
file: normalizeFileForWindows(trimmedFileAndRange),
310+
file: pathToURI(trimmedFileAndRange),
311311
range: {
312312
start: { line: 0, character: 0 },
313313
end: { line: 0, character: 0 },
@@ -352,7 +352,7 @@ let parseFileAndRange = (fileAndRange: string) => {
352352
};
353353
}
354354
return {
355-
file: normalizeFileForWindows(file),
355+
file: pathToURI(file),
356356
range,
357357
};
358358
};

0 commit comments

Comments
 (0)