@@ -6,7 +6,6 @@ import * as path from "path";
66import * as t from "vscode-languageserver-types" ;
77import fs from "fs" ;
88import * as os from "os" ;
9- import { URI } from 'vscode-uri' ;
109
1110let tempFilePrefix = "rescript_format_file_" + process . pid + "_" ;
1211let tempFileId = 0 ;
@@ -161,7 +160,7 @@ export let parseDiagnosticLocation = (location: string): Range => {
161160} ;
162161
163162let findLocationSeparator = ( fileAndLocation : string ) => {
164- // Exclude the two first letters in windows paths to avoid the first colon in eg "c:\\.."
163+ // Exclude the two first letters in windows paths to avoid the first colon in eg "c:\\.."
165164 if ( process . platform === "win32" ) {
166165 return fileAndLocation . indexOf ( ":" , 2 ) ;
167166 } else {
@@ -174,11 +173,13 @@ let separateFileAndLocation = (fileAndLocation: string): [string, string] => {
174173 let file = fileAndLocation . slice ( 0 , locationSeparator ) ;
175174 let location = fileAndLocation . slice ( locationSeparator + 1 ) ;
176175
177- return [ URI . file ( file ) . toString ( ) , location ] ;
176+ if ( process . platform === "win32" ) {
177+ return [ `file:\\\\\\${ file } ` , location ] ;
178+ } else {
179+ return [ file , location ]
180+ }
178181} ;
179182
180-
181-
182183type filesDiagnostics = {
183184 [ key : string ] : p . Diagnostic [ ] ;
184185} ;
0 commit comments