Script infos while opening/closing shouldnt mark project as dirty if the contents dont change

This commit is contained in:
Sheetal Nandi
2017-08-25 20:20:14 -07:00
parent 17565d8407
commit 10ea5bf460
6 changed files with 168 additions and 134 deletions

View File

@@ -2,6 +2,7 @@
/// <reference path="..\services\services.ts" />
/// <reference path="session.ts" />
/*@internal*/
namespace ts.server {
const lineCollectionCapacity = 4;
@@ -285,24 +286,6 @@ namespace ts.server {
}
}
// reload whole script, leaving no change history behind reload
reload(script: string) {
this.currentVersion++;
this.changes = []; // history wiped out by reload
const snap = new LineIndexSnapshot(this.currentVersion, this, new LineIndex());
// delete all versions
for (let i = 0; i < this.versions.length; i++) {
this.versions[i] = undefined;
}
this.versions[this.currentVersionToIndex()] = snap;
const lm = LineIndex.linesFromText(script);
snap.index.load(lm.lines);
this.minVersion = this.currentVersion;
}
getSnapshot(): IScriptSnapshot { return this._getSnapshot(); }
private _getSnapshot(): LineIndexSnapshot {
@@ -843,4 +826,4 @@ namespace ts.server {
return 1;
}
}
}
}