mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-10 06:41:59 -06:00
Added logic to handle requests for changes past the end of the buffer.
This commit is contained in:
parent
42bc64b168
commit
f9fd365215
@ -1259,7 +1259,7 @@ module ts.server {
|
||||
|
||||
getText(rangeStart: number, rangeLength: number) {
|
||||
var accum = "";
|
||||
if (rangeLength > 0) {
|
||||
if ((rangeLength > 0) && (rangeStart < this.root.charCount())) {
|
||||
this.walk(rangeStart, rangeLength, {
|
||||
goSubtree: true,
|
||||
done: false,
|
||||
@ -1322,14 +1322,14 @@ module ts.server {
|
||||
}
|
||||
else if (pos >= this.root.charCount()) {
|
||||
// insert at end
|
||||
var endString = this.getText(pos - 1, 1);
|
||||
pos = this.root.charCount() - 1;
|
||||
var endString = this.getText(pos, 1);
|
||||
if (newText) {
|
||||
newText = endString + newText;
|
||||
}
|
||||
else {
|
||||
newText = endString;
|
||||
}
|
||||
pos = pos - 1;
|
||||
deleteLength = 0;
|
||||
walker.suppressTrailingText = true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user