@@ -46,6 +46,9 @@ namespace ts.server {
4646 */
4747 private pendingReloadFromDisk = false ;
4848
49+ mapper : DocumentPositionMapper | false | undefined = false ;
50+ sourceFileLike : SourceFileLike | undefined ;
51+
4952 constructor ( private readonly host : ServerHost , private readonly fileName : NormalizedPath , initialVersion : ScriptInfoVersion | undefined , private readonly info : ScriptInfo ) {
5053 this . version = initialVersion || { svc : 0 , text : 0 } ;
5154 }
@@ -70,6 +73,8 @@ namespace ts.server {
7073 this . text = newText ;
7174 this . lineMap = undefined ;
7275 this . fileSize = undefined ;
76+ this . mapper = undefined ;
77+ this . sourceFileLike = undefined ;
7378 this . version . text ++ ;
7479 }
7580
@@ -79,6 +84,8 @@ namespace ts.server {
7984 this . text = undefined ;
8085 this . lineMap = undefined ;
8186 this . fileSize = undefined ;
87+ this . mapper = undefined ;
88+ this . sourceFileLike = undefined ;
8289 }
8390
8491 /**
@@ -156,8 +163,8 @@ namespace ts.server {
156163 : ScriptSnapshot . fromString ( this . getOrLoadText ( ) ) ;
157164 }
158165
159- public getLineInfo ( line : number ) : AbsolutePositionAndLineText {
160- return this . switchToScriptVersionCache ( ) . getLineInfo ( line ) ;
166+ public getAbsolutePositionAndLineText ( line : number ) : AbsolutePositionAndLineText {
167+ return this . switchToScriptVersionCache ( ) . getAbsolutePositionAndLineText ( line ) ;
161168 }
162169 /**
163170 * @param line 0 based index
@@ -246,6 +253,17 @@ namespace ts.server {
246253 Debug . assert ( ! this . svc , "ScriptVersionCache should not be set" ) ;
247254 return this . lineMap || ( this . lineMap = computeLineStarts ( this . getOrLoadText ( ) ) ) ;
248255 }
256+
257+ getLineInfo ( ) : LineInfo {
258+ if ( this . svc ) {
259+ return {
260+ getLineCount : ( ) => this . svc ! . getLineCount ( ) ,
261+ getLineText : line => this . svc ! . getAbsolutePositionAndLineText ( line + 1 ) . lineText !
262+ } ;
263+ }
264+ const lineMap = this . getLineMap ( ) ;
265+ return getLineInfo ( this . text ! , lineMap ) ;
266+ }
249267 }
250268
251269 /*@internal */
@@ -269,7 +287,7 @@ namespace ts.server {
269287
270288 /* @internal */
271289 fileWatcher : FileWatcher | undefined ;
272- private textStorage : TextStorage ;
290+ /* @internal */ textStorage : TextStorage ;
273291
274292 /*@internal */
275293 readonly isDynamic : boolean ;
@@ -284,6 +302,9 @@ namespace ts.server {
284302 /*@internal */
285303 mTime ?: number ;
286304
305+ /*@internal */
306+ mapInfo ?: ScriptInfo ;
307+
287308 constructor (
288309 private readonly host : ServerHost ,
289310 readonly fileName : NormalizedPath ,
@@ -521,8 +542,8 @@ namespace ts.server {
521542 }
522543
523544 /*@internal */
524- getLineInfo ( line : number ) : AbsolutePositionAndLineText {
525- return this . textStorage . getLineInfo ( line ) ;
545+ getAbsolutePositionAndLineText ( line : number ) : AbsolutePositionAndLineText {
546+ return this . textStorage . getAbsolutePositionAndLineText ( line ) ;
526547 }
527548
528549 editContent ( start : number , end : number , newText : string ) : void {
0 commit comments