提交 af21dc79 编写于 作者: J Jean Pierre 提交者: Ramya Rao

Fix for #46106 (#46309)

上级 15ee956b
...@@ -17,6 +17,7 @@ export class DocumentStreamReader { ...@@ -17,6 +17,7 @@ export class DocumentStreamReader {
private document: TextDocument; private document: TextDocument;
private start: Position; private start: Position;
private _eof: Position; private _eof: Position;
private _sof: Position;
public pos: Position; public pos: Position;
private _eol: string; private _eol: string;
...@@ -24,10 +25,18 @@ export class DocumentStreamReader { ...@@ -24,10 +25,18 @@ export class DocumentStreamReader {
this.document = document; this.document = document;
this.start = this.pos = pos ? pos : new Position(0, 0); this.start = this.pos = pos ? pos : new Position(0, 0);
this._sof = limit ? limit.start : new Position(0, 0);
this._eof = limit ? limit.end : new Position(this.document.lineCount - 1, this._lineLength(this.document.lineCount - 1)); this._eof = limit ? limit.end : new Position(this.document.lineCount - 1, this._lineLength(this.document.lineCount - 1));
this._eol = this.document.eol === EndOfLine.LF ? '\n' : '\r\n'; this._eol = this.document.eol === EndOfLine.LF ? '\n' : '\r\n';
} }
/**
* Returns true only if the stream is at the start of the file.
*/
sof(): boolean {
return this.pos.isBeforeOrEqual(this._sof);
}
/** /**
* Returns true only if the stream is at the end of the file. * Returns true only if the stream is at the end of the file.
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册