提交 26084647 编写于 作者: B Benjamin Pasero

fix: touching a file needs to update its model metadata

上级 58ec3f08
...@@ -394,7 +394,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil ...@@ -394,7 +394,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
this.setDirty(false); this.setDirty(false);
} }
this.toDispose.push(this.textEditorModel.onDidChangeRawContent((e: IModelContentChangedEvent) => this.onModelContentChanged(e))); this.toDispose.push(this.textEditorModel.onDidChangeRawContent(e => this.onModelContentChanged(e)));
return this; return this;
}, error => { }, error => {
...@@ -598,7 +598,11 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil ...@@ -598,7 +598,11 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
// to write the contents to disk, as they are already on disk. we still want to trigger // to write the contents to disk, as they are already on disk. we still want to trigger
// a change on the file though so that external file watchers can be notified // a change on the file though so that external file watchers can be notified
if (force && !this.dirty && reason === SaveReason.EXPLICIT && versionId === newVersionId) { if (force && !this.dirty && reason === SaveReason.EXPLICIT && versionId === newVersionId) {
return this.fileService.touchFile(this.resource).then(() => void 0, () => void 0 /* gracefully ignore errors if just touching */); return this.fileService.touchFile(this.resource).then(stat => {
// Updated resolved stat with updated stat since touching it might have changed mtime
this.updateVersionOnDiskStat(stat);
}, () => void 0 /* gracefully ignore errors if just touching */);
} }
// update versionId with its new value (if pre-save changes happened) // update versionId with its new value (if pre-save changes happened)
...@@ -619,7 +623,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil ...@@ -619,7 +623,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
mtime: this.versionOnDiskStat.mtime, mtime: this.versionOnDiskStat.mtime,
encoding: this.getEncoding(), encoding: this.getEncoding(),
etag: this.versionOnDiskStat.etag etag: this.versionOnDiskStat.etag
}).then((stat: IFileStat) => { }).then(stat => {
diag(`doSave(${versionId}) - after updateContent()`, this.resource, new Date()); diag(`doSave(${versionId}) - after updateContent()`, this.resource, new Date());
// Telemetry // Telemetry
...@@ -633,7 +637,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil ...@@ -633,7 +637,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
diag(`doSave(${versionId}) - not setting dirty to false because versionId did change meanwhile`, this.resource, new Date()); diag(`doSave(${versionId}) - not setting dirty to false because versionId did change meanwhile`, this.resource, new Date());
} }
// Updated resolved stat with updated stat, and keep old for event // Updated resolved stat with updated stat
this.updateVersionOnDiskStat(stat); this.updateVersionOnDiskStat(stat);
// Cancel any content change event promises as they are no longer valid // Cancel any content change event promises as they are no longer valid
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册