mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 20:14:01 -06:00
Hold at most 4 snapshots per file in the server. This is about 1K per file.
This commit is contained in:
parent
04320e415e
commit
37c6f69f01
@ -1073,6 +1073,7 @@ module ts.server {
|
||||
|
||||
static changeNumberThreshold = 8;
|
||||
static changeLengthThreshold = 256;
|
||||
static maxVersions = 8;
|
||||
|
||||
// REVIEW: can optimize by coalescing simple edits
|
||||
edit(pos: number, deleteLen: number, insertedText?: string) {
|
||||
@ -1133,6 +1134,13 @@ module ts.server {
|
||||
this.currentVersion = snap.version;
|
||||
this.versions[snap.version] = snap;
|
||||
this.changes = [];
|
||||
if ((this.currentVersion - this.minVersion) >= ScriptVersionCache.maxVersions) {
|
||||
var oldMin = this.minVersion;
|
||||
this.minVersion = (this.currentVersion - ScriptVersionCache.maxVersions) + 1;
|
||||
for (var j = oldMin; j < this.minVersion; j++) {
|
||||
this.versions[j] = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
return snap;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user