@@ -40,17 +40,15 @@ export class Host implements ts.LanguageServiceHost {
40
40
}
41
41
42
42
getScriptVersion ( fileName : string ) {
43
- let fileName_ = path . normalize ( fileName ) ;
44
- if ( this . state . getFile ( fileName_ ) ) {
45
- return this . state . getFile ( fileName_ ) . version . toString ( ) ;
43
+ if ( this . state . getFile ( fileName ) ) {
44
+ return this . state . getFile ( fileName ) . version . toString ( ) ;
46
45
}
47
46
}
48
47
49
48
getScriptSnapshot ( fileName ) {
50
- let fileName_ = path . normalize ( fileName ) ;
51
- let file = this . state . getFile ( fileName_ ) ;
49
+ let file = this . state . getFile ( fileName ) ;
52
50
if ( ! file ) {
53
- throw new Error ( `Requested file is unknown: ${ fileName_ } ` ) ;
51
+ throw new Error ( `Requested file is unknown: ${ fileName } ` ) ;
54
52
}
55
53
return this . state . ts . ScriptSnapshot . fromString ( file . text ) ;
56
54
}
@@ -175,8 +173,6 @@ export class State {
175
173
}
176
174
177
175
emit ( fileName : string ) : IEmitOutput {
178
- fileName = this . normalizePath ( fileName ) ;
179
-
180
176
if ( ! this . program ) {
181
177
this . program = this . services . getProgram ( ) ;
182
178
}
@@ -216,8 +212,6 @@ export class State {
216
212
}
217
213
218
214
fastEmit ( fileName : string ) {
219
- fileName = this . normalizePath ( fileName ) ;
220
-
221
215
let file = this . getFile ( fileName ) ;
222
216
if ( ! file ) {
223
217
throw new Error ( `Unknown file ${ fileName } ` ) ;
@@ -236,7 +230,6 @@ export class State {
236
230
}
237
231
238
232
updateFile ( fileName : string , text : string , checked : boolean = false ) : boolean {
239
- fileName = this . normalizePath ( fileName ) ;
240
233
let prevFile = this . files [ fileName ] ;
241
234
let version = 0 ;
242
235
let changed = true ;
@@ -261,7 +254,6 @@ export class State {
261
254
}
262
255
263
256
addFile ( fileName : string , text : string , isDefaultLib = false ) : IFile {
264
- fileName = this . normalizePath ( fileName ) ;
265
257
return this . files [ fileName ] = {
266
258
text,
267
259
isDefaultLib,
@@ -270,36 +262,27 @@ export class State {
270
262
}
271
263
272
264
getFile ( fileName : string ) : IFile {
273
- fileName = this . normalizePath ( fileName ) ;
274
265
return this . files [ fileName ] ;
275
266
}
276
267
277
268
hasFile ( fileName : string ) : boolean {
278
- fileName = this . normalizePath ( fileName ) ;
279
269
return this . files . hasOwnProperty ( fileName ) ;
280
270
}
281
271
282
272
readFile ( fileName : string ) : string {
283
- fileName = this . normalizePath ( fileName ) ;
284
273
// Use global fs here, because local doesn't contain `readFileSync`
285
274
return fs . readFileSync ( fileName , { encoding : 'utf-8' } ) ;
286
275
}
287
276
288
277
readFileAndAdd ( fileName : string , isDefaultLib = false ) {
289
- fileName = this . normalizePath ( fileName ) ;
290
278
let text = this . readFile ( fileName ) ;
291
279
this . addFile ( fileName , text , isDefaultLib ) ;
292
280
}
293
281
294
282
readFileAndUpdate ( fileName : string , checked : boolean = false ) : boolean {
295
- fileName = this . normalizePath ( fileName ) ;
296
283
let text = this . readFile ( fileName ) ;
297
284
return this . updateFile ( fileName , text , checked ) ;
298
285
}
299
-
300
- normalizePath ( filePath : string ) : string {
301
- return path . normalize ( filePath ) ;
302
- }
303
286
}
304
287
305
288
/**
0 commit comments