@@ -257,16 +257,15 @@ namespace ts.server {
257257 }
258258
259259 export class ScriptVersionCache {
260- changes : TextChange [ ] = [ ] ;
261- versions : LineIndexSnapshot [ ] = new Array < LineIndexSnapshot > ( ScriptVersionCache . maxVersions ) ;
262- minVersion = 0 ; // no versions earlier than min version will maintain change history
260+ private changes : TextChange [ ] = [ ] ;
261+ private readonly versions : LineIndexSnapshot [ ] = new Array < LineIndexSnapshot > ( ScriptVersionCache . maxVersions ) ;
262+ private minVersion = 0 ; // no versions earlier than min version will maintain change history
263263
264- private host : ServerHost ;
265264 private currentVersion = 0 ;
266265
267- static changeNumberThreshold = 8 ;
268- static changeLengthThreshold = 256 ;
269- static maxVersions = 8 ;
266+ private static readonly changeNumberThreshold = 8 ;
267+ private static readonly changeLengthThreshold = 256 ;
268+ private static readonly maxVersions = 8 ;
270269
271270 private versionToIndex ( version : number ) {
272271 if ( version < this . minVersion || version > this . currentVersion ) {
@@ -300,16 +299,6 @@ namespace ts.server {
300299 return this . currentVersion ;
301300 }
302301
303- reloadFromFile ( filename : string ) {
304- let content = this . host . readFile ( filename ) ;
305- // If the file doesn't exist or cannot be read, we should
306- // wipe out its cached content on the server to avoid side effects.
307- if ( ! content ) {
308- content = "" ;
309- }
310- this . reload ( content ) ;
311- }
312-
313302 // reload whole script, leaving no change history behind reload
314303 reload ( script : string ) {
315304 this . currentVersion ++ ;
@@ -369,11 +358,10 @@ namespace ts.server {
369358 }
370359 }
371360
372- static fromString ( host : ServerHost , script : string ) {
361+ static fromString ( script : string ) {
373362 const svc = new ScriptVersionCache ( ) ;
374363 const snap = new LineIndexSnapshot ( 0 , svc , new LineIndex ( ) ) ;
375364 svc . versions [ svc . currentVersion ] = snap ;
376- svc . host = host ;
377365 const lm = LineIndex . linesFromText ( script ) ;
378366 snap . index . load ( lm . lines ) ;
379367 return svc ;
@@ -774,7 +762,7 @@ namespace ts.server {
774762 return { child, childIndex : i , charOffset, lineNumber } ;
775763 }
776764
777- splitAfter ( childIndex : number ) {
765+ private splitAfter ( childIndex : number ) {
778766 let splitNode : LineNode ;
779767 const clen = this . children . length ;
780768 childIndex ++ ;
0 commit comments