@@ -35,7 +35,7 @@ module ts.server {
35
35
formatCodeOptions = ts . clone ( CompilerService . defaultFormatCodeOptions ) ;
36
36
37
37
constructor ( private host : ServerHost , public fileName : string , public content : string , public isOpen = false ) {
38
- this . svc = ScriptVersionCache . fromString ( content ) ;
38
+ this . svc = ScriptVersionCache . fromString ( host , content ) ;
39
39
}
40
40
41
41
setFormatOptions ( formatOptions : protocol . FormatOptions ) : void {
@@ -915,7 +915,7 @@ module ts.server {
915
915
return rawConfig . error ;
916
916
}
917
917
else {
918
- var parsedCommandLine = ts . parseConfigFile ( rawConfig . config , ts . sys , dirPath ) ;
918
+ var parsedCommandLine = ts . parseConfigFile ( rawConfig . config , this . host , dirPath ) ;
919
919
if ( parsedCommandLine . errors && ( parsedCommandLine . errors . length > 0 ) ) {
920
920
return { errorMsg : "tsconfig option errors" } ;
921
921
}
@@ -984,7 +984,7 @@ module ts.server {
984
984
static defaultFormatCodeOptions : ts . FormatCodeOptions = {
985
985
IndentSize : 4 ,
986
986
TabSize : 4 ,
987
- NewLineCharacter : ts . sys . newLine ,
987
+ NewLineCharacter : ts . sys ? ts . sys . newLine : '\n' ,
988
988
ConvertTabsToSpaces : true ,
989
989
InsertSpaceAfterCommaDelimiter : true ,
990
990
InsertSpaceAfterSemicolonInForStatements : true ,
@@ -1262,6 +1262,7 @@ module ts.server {
1262
1262
versions : LineIndexSnapshot [ ] = [ ] ;
1263
1263
minVersion = 0 ; // no versions earlier than min version will maintain change history
1264
1264
private currentVersion = 0 ;
1265
+ private host : System ;
1265
1266
1266
1267
static changeNumberThreshold = 8 ;
1267
1268
static changeLengthThreshold = 256 ;
@@ -1289,7 +1290,7 @@ module ts.server {
1289
1290
}
1290
1291
1291
1292
reloadFromFile ( filename : string , cb ?: ( ) => any ) {
1292
- var content = ts . sys . readFile ( filename ) ;
1293
+ var content = this . host . readFile ( filename ) ;
1293
1294
this . reload ( content ) ;
1294
1295
if ( cb )
1295
1296
cb ( ) ;
@@ -1359,10 +1360,11 @@ module ts.server {
1359
1360
}
1360
1361
}
1361
1362
1362
- static fromString ( script : string ) {
1363
+ static fromString ( host : System , script : string ) {
1363
1364
var svc = new ScriptVersionCache ( ) ;
1364
1365
var snap = new LineIndexSnapshot ( 0 , svc ) ;
1365
1366
svc . versions [ svc . currentVersion ] = snap ;
1367
+ svc . host = host ;
1366
1368
snap . index = new LineIndex ( ) ;
1367
1369
var lm = LineIndex . linesFromText ( script ) ;
1368
1370
snap . index . load ( lm . lines ) ;
0 commit comments