mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
Fix #59210
This commit is contained in:
@@ -94,6 +94,11 @@ export class ExtHostOutputChannelBackedByFile extends AbstractExtHostOutputChann
|
|||||||
this.validate();
|
this.validate();
|
||||||
this._appender.append(value);
|
this._appender.append(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clear(): void {
|
||||||
|
this._appender.flush();
|
||||||
|
super.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ExtHostLogFileOutputChannel extends AbstractExtHostOutputChannel {
|
export class ExtHostLogFileOutputChannel extends AbstractExtHostOutputChannel {
|
||||||
|
|||||||
@@ -351,12 +351,13 @@ class FileOutputChannel extends AbstractFileOutputChannel implements OutputChann
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadModel(): TPromise<ITextModel> {
|
loadModel(): TPromise<ITextModel> {
|
||||||
return this.fileService.resolveContent(this.file, { position: this.startOffset, encoding: 'utf8' })
|
return this.readContent()
|
||||||
.then(content => {
|
.then(content => this.createModel(content));
|
||||||
this.endOffset = this.startOffset + Buffer.from(content.value).byteLength;
|
}
|
||||||
this.etag = content.etag;
|
|
||||||
return this.createModel(content.value);
|
clear(): void {
|
||||||
});
|
this.readContent() // Read content from the file before clearing
|
||||||
|
.then(() => super.clear());
|
||||||
}
|
}
|
||||||
|
|
||||||
append(message: string): void {
|
append(message: string): void {
|
||||||
@@ -391,6 +392,15 @@ class FileOutputChannel extends AbstractFileOutputChannel implements OutputChann
|
|||||||
this.updateInProgress = false;
|
this.updateInProgress = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readContent(): TPromise<string> {
|
||||||
|
return this.fileService.resolveContent(this.file, { position: this.startOffset, encoding: 'utf8' })
|
||||||
|
.then(content => {
|
||||||
|
this.endOffset = this.startOffset + Buffer.from(content.value).byteLength;
|
||||||
|
this.etag = content.etag;
|
||||||
|
return content.value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private onDidContentChange(size: number): void {
|
private onDidContentChange(size: number): void {
|
||||||
if (!this.updateInProgress) {
|
if (!this.updateInProgress) {
|
||||||
this.updateInProgress = true;
|
this.updateInProgress = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user