@@ -11,6 +11,7 @@ import * as childProcess from 'child_process';
11
11
import { DidOpenTextDocumentNotification , DidChangeTextDocumentNotification , DidCloseTextDocumentNotification } from 'vscode-languageserver-protocol' ;
12
12
import * as tmp from 'tmp' ;
13
13
import { Range } from 'vscode-languageserver-textdocument' ;
14
+ import { uriToFsPath , URI } from 'vscode-uri' ;
14
15
15
16
// See https://microsoft.github.io/language-server-protocol/specification Abstract Message
16
17
// version is fixed to 2.0
@@ -203,8 +204,7 @@ let startWatchingBsbOutputFile = (root: p.DocumentUri, process: NodeJS.Process)
203
204
let openFiles = Object . keys ( stupidFileContentCache ) ;
204
205
let bsbLogDirs : Set < p . DocumentUri > = new Set ( ) ;
205
206
openFiles . forEach ( openFile => {
206
- // TODO: remove this hack
207
- let filePath = openFile . replace ( 'file://' , '' ) ;
207
+ let filePath = uriToFsPath ( URI . parse ( openFile ) , true ) ;
208
208
let bsbLogDir = findDirOfFileNearFile ( bsbLogPartialPath , filePath )
209
209
if ( bsbLogDir != null ) {
210
210
bsbLogDirs . add ( bsbLogDir ) ;
@@ -355,8 +355,7 @@ process.on('message', (a: (m.RequestMessage | m.NotificationMessage)) => {
355
355
}
356
356
} else if ( aa . method === p . DocumentFormattingRequest . method ) {
357
357
let params = ( aa . params as p . DocumentFormattingParams )
358
- // TODO: remove this hack
359
- let filePath = params . textDocument . uri . replace ( 'file://' , '' )
358
+ let filePath = uriToFsPath ( URI . parse ( params . textDocument . uri ) , true ) ;
360
359
let extension = path . extname ( params . textDocument . uri ) ;
361
360
if ( extension !== resExt && extension !== resiExt ) {
362
361
let response : m . ResponseMessage = {
0 commit comments