@@ -1977,6 +1977,7 @@ module ts {
1977
1977
}
1978
1978
1979
1979
function getValidSourceFile ( fileName : string ) : SourceFile {
1980
+ fileName = normalizeSlashes ( fileName ) ;
1980
1981
var sourceFile = program . getSourceFile ( getCanonicalFileName ( fileName ) ) ;
1981
1982
if ( ! sourceFile ) {
1982
1983
throw new Error ( "Could not find file: '" + fileName + "'." ) ;
@@ -2126,8 +2127,6 @@ module ts {
2126
2127
function getSyntacticDiagnostics ( fileName : string ) {
2127
2128
synchronizeHostData ( ) ;
2128
2129
2129
- fileName = normalizeSlashes ( fileName ) ;
2130
-
2131
2130
return program . getSyntacticDiagnostics ( getValidSourceFile ( fileName ) ) ;
2132
2131
}
2133
2132
@@ -2138,7 +2137,6 @@ module ts {
2138
2137
function getSemanticDiagnostics ( fileName : string ) {
2139
2138
synchronizeHostData ( ) ;
2140
2139
2141
- fileName = normalizeSlashes ( fileName )
2142
2140
var targetSourceFile = getValidSourceFile ( fileName ) ;
2143
2141
2144
2142
// Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file.
@@ -2215,8 +2213,6 @@ module ts {
2215
2213
function getCompletionsAtPosition ( fileName : string , position : number ) {
2216
2214
synchronizeHostData ( ) ;
2217
2215
2218
- fileName = normalizeSlashes ( fileName ) ;
2219
-
2220
2216
var syntacticStart = new Date ( ) . getTime ( ) ;
2221
2217
var sourceFile = getValidSourceFile ( fileName ) ;
2222
2218
@@ -2635,8 +2631,6 @@ module ts {
2635
2631
function getCompletionEntryDetails ( fileName : string , position : number , entryName : string ) : CompletionEntryDetails {
2636
2632
// Note: No need to call synchronizeHostData, as we have captured all the data we need
2637
2633
// in the getCompletionsAtPosition earlier
2638
- fileName = normalizeSlashes ( fileName ) ;
2639
-
2640
2634
var sourceFile = getValidSourceFile ( fileName ) ;
2641
2635
2642
2636
var session = activeCompletionSession ;
@@ -3155,7 +3149,6 @@ module ts {
3155
3149
function getQuickInfoAtPosition ( fileName : string , position : number ) : QuickInfo {
3156
3150
synchronizeHostData ( ) ;
3157
3151
3158
- fileName = normalizeSlashes ( fileName ) ;
3159
3152
var sourceFile = getValidSourceFile ( fileName ) ;
3160
3153
var node = getTouchingPropertyName ( sourceFile , position ) ;
3161
3154
if ( ! node ) {
@@ -3201,7 +3194,6 @@ module ts {
3201
3194
function getDefinitionAtPosition ( fileName : string , position : number ) : DefinitionInfo [ ] {
3202
3195
synchronizeHostData ( ) ;
3203
3196
3204
- fileName = normalizeSlashes ( fileName ) ;
3205
3197
var sourceFile = getValidSourceFile ( fileName ) ;
3206
3198
3207
3199
var node = getTouchingPropertyName ( sourceFile , position ) ;
@@ -3337,7 +3329,6 @@ module ts {
3337
3329
function getOccurrencesAtPosition ( fileName : string , position : number ) : ReferenceEntry [ ] {
3338
3330
synchronizeHostData ( ) ;
3339
3331
3340
- fileName = normalizeSlashes ( fileName ) ;
3341
3332
var sourceFile = getValidSourceFile ( fileName ) ;
3342
3333
3343
3334
var node = getTouchingWord ( sourceFile , position ) ;
@@ -3882,7 +3873,6 @@ module ts {
3882
3873
function findReferences ( fileName : string , position : number , findInStrings : boolean , findInComments : boolean ) : ReferenceEntry [ ] {
3883
3874
synchronizeHostData ( ) ;
3884
3875
3885
- fileName = normalizeSlashes ( fileName ) ;
3886
3876
var sourceFile = getValidSourceFile ( fileName ) ;
3887
3877
3888
3878
var node = getTouchingPropertyName ( sourceFile , position ) ;
@@ -4705,7 +4695,6 @@ module ts {
4705
4695
function getEmitOutput ( fileName : string ) : EmitOutput {
4706
4696
synchronizeHostData ( ) ;
4707
4697
4708
- fileName = normalizeSlashes ( fileName ) ;
4709
4698
var sourceFile = getValidSourceFile ( fileName ) ;
4710
4699
4711
4700
var outputFiles : OutputFile [ ] = [ ] ;
@@ -4849,21 +4838,17 @@ module ts {
4849
4838
function getSignatureHelpItems ( fileName : string , position : number ) : SignatureHelpItems {
4850
4839
synchronizeHostData ( ) ;
4851
4840
4852
- fileName = normalizeSlashes ( fileName ) ;
4853
4841
var sourceFile = getValidSourceFile ( fileName ) ;
4854
4842
4855
4843
return SignatureHelp . getSignatureHelpItems ( sourceFile , position , typeInfoResolver , cancellationToken ) ;
4856
4844
}
4857
4845
4858
4846
/// Syntactic features
4859
4847
function getCurrentSourceFile ( fileName : string ) : SourceFile {
4860
- fileName = normalizeSlashes ( fileName ) ;
4861
- var currentSourceFile = syntaxTreeCache . getCurrentSourceFile ( fileName ) ;
4862
- return currentSourceFile ;
4848
+ return syntaxTreeCache . getCurrentSourceFile ( fileName ) ;
4863
4849
}
4864
4850
4865
4851
function getNameOrDottedNameSpan ( fileName : string , startPos : number , endPos : number ) : TextSpan {
4866
- fileName = ts . normalizeSlashes ( fileName ) ;
4867
4852
// Get node at the location
4868
4853
var node = getTouchingPropertyName ( getCurrentSourceFile ( fileName ) , startPos ) ;
4869
4854
@@ -4919,19 +4904,15 @@ module ts {
4919
4904
4920
4905
function getBreakpointStatementAtPosition ( fileName : string , position : number ) {
4921
4906
// doesn't use compiler - no need to synchronize with host
4922
- fileName = ts . normalizeSlashes ( fileName ) ;
4923
4907
return BreakpointResolver . spanInSourceFileAtLocation ( getCurrentSourceFile ( fileName ) , position ) ;
4924
4908
}
4925
4909
4926
4910
function getNavigationBarItems ( fileName : string ) : NavigationBarItem [ ] {
4927
- fileName = normalizeSlashes ( fileName ) ;
4928
-
4929
4911
return NavigationBar . getNavigationBarItems ( getCurrentSourceFile ( fileName ) ) ;
4930
4912
}
4931
4913
4932
4914
function getSemanticClassifications ( fileName : string , span : TextSpan ) : ClassifiedSpan [ ] {
4933
4915
synchronizeHostData ( ) ;
4934
- fileName = normalizeSlashes ( fileName ) ;
4935
4916
4936
4917
var sourceFile = getValidSourceFile ( fileName ) ;
4937
4918
@@ -5005,7 +4986,6 @@ module ts {
5005
4986
5006
4987
function getSyntacticClassifications ( fileName : string , span : TextSpan ) : ClassifiedSpan [ ] {
5007
4988
// doesn't use compiler - no need to synchronize with host
5008
- fileName = normalizeSlashes ( fileName ) ;
5009
4989
var sourceFile = getCurrentSourceFile ( fileName ) ;
5010
4990
5011
4991
// Make a scanner we can get trivia from.
@@ -5224,7 +5204,6 @@ module ts {
5224
5204
5225
5205
function getOutliningSpans ( fileName : string ) : OutliningSpan [ ] {
5226
5206
// doesn't use compiler - no need to synchronize with host
5227
- fileName = normalizeSlashes ( fileName ) ;
5228
5207
var sourceFile = getCurrentSourceFile ( fileName ) ;
5229
5208
return OutliningElementsCollector . collectElements ( sourceFile ) ;
5230
5209
}
@@ -5283,8 +5262,6 @@ module ts {
5283
5262
}
5284
5263
5285
5264
function getIndentationAtPosition ( fileName : string , position : number , editorOptions : EditorOptions ) {
5286
- fileName = normalizeSlashes ( fileName ) ;
5287
-
5288
5265
var start = new Date ( ) . getTime ( ) ;
5289
5266
var sourceFile = getCurrentSourceFile ( fileName ) ;
5290
5267
log ( "getIndentationAtPosition: getCurrentSourceFile: " + ( new Date ( ) . getTime ( ) - start ) ) ;
@@ -5298,21 +5275,16 @@ module ts {
5298
5275
}
5299
5276
5300
5277
function getFormattingEditsForRange ( fileName : string , start : number , end : number , options : FormatCodeOptions ) : TextChange [ ] {
5301
- fileName = normalizeSlashes ( fileName ) ;
5302
5278
var sourceFile = getCurrentSourceFile ( fileName ) ;
5303
5279
return formatting . formatSelection ( start , end , sourceFile , getRuleProvider ( options ) , options ) ;
5304
5280
}
5305
5281
5306
5282
function getFormattingEditsForDocument ( fileName : string , options : FormatCodeOptions ) : TextChange [ ] {
5307
- fileName = normalizeSlashes ( fileName ) ;
5308
-
5309
5283
var sourceFile = getCurrentSourceFile ( fileName ) ;
5310
5284
return formatting . formatDocument ( sourceFile , getRuleProvider ( options ) , options ) ;
5311
5285
}
5312
5286
5313
5287
function getFormattingEditsAfterKeystroke ( fileName : string , position : number , key : string , options : FormatCodeOptions ) : TextChange [ ] {
5314
- fileName = normalizeSlashes ( fileName ) ;
5315
-
5316
5288
var sourceFile = getCurrentSourceFile ( fileName ) ;
5317
5289
5318
5290
if ( key === "}" ) {
@@ -5337,8 +5309,6 @@ module ts {
5337
5309
// anything away.
5338
5310
synchronizeHostData ( ) ;
5339
5311
5340
- fileName = normalizeSlashes ( fileName ) ;
5341
-
5342
5312
var sourceFile = getValidSourceFile ( fileName ) ;
5343
5313
5344
5314
cancellationToken . throwIfCancellationRequested ( ) ;
@@ -5484,7 +5454,6 @@ module ts {
5484
5454
function getRenameInfo ( fileName : string , position : number ) : RenameInfo {
5485
5455
synchronizeHostData ( ) ;
5486
5456
5487
- fileName = normalizeSlashes ( fileName ) ;
5488
5457
var sourceFile = getValidSourceFile ( fileName ) ;
5489
5458
5490
5459
var node = getTouchingWord ( sourceFile , position ) ;
0 commit comments