@@ -35,7 +35,7 @@ module ts.server {
3535 formatCodeOptions = ts . clone ( CompilerService . defaultFormatCodeOptions ) ;
3636
3737 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 ) ;
3939 }
4040
4141 setFormatOptions ( formatOptions : protocol . FormatOptions ) : void {
@@ -915,7 +915,7 @@ module ts.server {
915915 return rawConfig . error ;
916916 }
917917 else {
918- var parsedCommandLine = ts . parseConfigFile ( rawConfig . config , ts . sys , dirPath ) ;
918+ var parsedCommandLine = ts . parseConfigFile ( rawConfig . config , this . host , dirPath ) ;
919919 if ( parsedCommandLine . errors && ( parsedCommandLine . errors . length > 0 ) ) {
920920 return { errorMsg : "tsconfig option errors" } ;
921921 }
@@ -984,7 +984,7 @@ module ts.server {
984984 static defaultFormatCodeOptions : ts . FormatCodeOptions = {
985985 IndentSize : 4 ,
986986 TabSize : 4 ,
987- NewLineCharacter : ts . sys . newLine ,
987+ NewLineCharacter : ts . sys ? ts . sys . newLine : '\n' ,
988988 ConvertTabsToSpaces : true ,
989989 InsertSpaceAfterCommaDelimiter : true ,
990990 InsertSpaceAfterSemicolonInForStatements : true ,
@@ -1262,6 +1262,7 @@ module ts.server {
12621262 versions : LineIndexSnapshot [ ] = [ ] ;
12631263 minVersion = 0 ; // no versions earlier than min version will maintain change history
12641264 private currentVersion = 0 ;
1265+ private host : System ;
12651266
12661267 static changeNumberThreshold = 8 ;
12671268 static changeLengthThreshold = 256 ;
@@ -1289,7 +1290,7 @@ module ts.server {
12891290 }
12901291
12911292 reloadFromFile ( filename : string , cb ?: ( ) => any ) {
1292- var content = ts . sys . readFile ( filename ) ;
1293+ var content = this . host . readFile ( filename ) ;
12931294 this . reload ( content ) ;
12941295 if ( cb )
12951296 cb ( ) ;
@@ -1359,10 +1360,11 @@ module ts.server {
13591360 }
13601361 }
13611362
1362- static fromString ( script : string ) {
1363+ static fromString ( host : System , script : string ) {
13631364 var svc = new ScriptVersionCache ( ) ;
13641365 var snap = new LineIndexSnapshot ( 0 , svc ) ;
13651366 svc . versions [ svc . currentVersion ] = snap ;
1367+ svc . host = host ;
13661368 snap . index = new LineIndex ( ) ;
13671369 var lm = LineIndex . linesFromText ( script ) ;
13681370 snap . index . load ( lm . lines ) ;
0 commit comments