move saveTo to ScriptInfo
This commit is contained in:
parent
ac9717dc3d
commit
aea1534704
|
@ -267,15 +267,6 @@ namespace ts.server {
|
|||
}
|
||||
}
|
||||
|
||||
saveTo(filename: NormalizedPath, tmpfilename: NormalizedPath) {
|
||||
const script = this.projectService.getScriptInfoForNormalizedPath(filename);
|
||||
if (script) {
|
||||
Debug.assert(script.isAttached(this));
|
||||
const snap = script.snap();
|
||||
this.projectService.host.writeFile(tmpfilename, snap.getText(0, snap.getLength()));
|
||||
}
|
||||
}
|
||||
|
||||
reloadScript(filename: NormalizedPath): boolean {
|
||||
const script = this.projectService.getScriptInfoForNormalizedPath(filename);
|
||||
if (script) {
|
||||
|
|
|
@ -110,6 +110,11 @@ namespace ts.server {
|
|||
this.markContainingProjectsAsDirty();
|
||||
}
|
||||
|
||||
saveTo(fileName: string) {
|
||||
const snap = this.snap();
|
||||
this.host.writeFile(fileName, snap.getText(0, snap.getLength()));
|
||||
}
|
||||
|
||||
reloadFromFile() {
|
||||
this.svc.reloadFromFile(this.fileName);
|
||||
this.markContainingProjectsAsDirty();
|
||||
|
|
|
@ -1015,12 +1015,9 @@ namespace ts.server {
|
|||
}
|
||||
|
||||
private saveToTmp(fileName: string, tempFileName: string) {
|
||||
const file = toNormalizedPath(fileName);
|
||||
const tmpfile = toNormalizedPath(tempFileName);
|
||||
|
||||
const project = this.projectService.getDefaultProjectForFile(file);
|
||||
if (project) {
|
||||
project.saveTo(file, tmpfile);
|
||||
const scriptInfo = this.projectService.getScriptInfo(fileName);
|
||||
if (scriptInfo) {
|
||||
scriptInfo.saveTo(tempFileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue