Skip to content

Commit

Permalink
Fix using path as uri for diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
amiralies authored and cristianoc committed May 9, 2021
1 parent 4cdc64a commit 39312c9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ export let runBuildWatcherUsingValidBuildPath = (
*/

// parser helpers
let normalizeFileForWindows = (file: string) => {
return process.platform === "win32" ? `file:\\\\\\${file}` : file;
let pathToURI = (file: string) => {
return process.platform === "win32" ? `file:\\\\\\${file}` : `file://${file}`;
};
let parseFileAndRange = (fileAndRange: string) => {
// https://github.com/rescript-lang/rescript-compiler/blob/0a3f4bb32ca81e89cefd5a912b8795878836f883/jscomp/super_errors/super_location.ml#L15-L25
Expand All @@ -307,7 +307,7 @@ let parseFileAndRange = (fileAndRange: string) => {
if (match === null) {
// no location! Though LSP insist that we provide at least a dummy location
return {
file: normalizeFileForWindows(trimmedFileAndRange),
file: pathToURI(trimmedFileAndRange),
range: {
start: { line: 0, character: 0 },
end: { line: 0, character: 0 },
Expand Down Expand Up @@ -352,7 +352,7 @@ let parseFileAndRange = (fileAndRange: string) => {
};
}
return {
file: normalizeFileForWindows(file),
file: pathToURI(file),
range,
};
};
Expand Down

0 comments on commit 39312c9

Please sign in to comment.