mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 10:08:49 +01:00
Fix #59210
This commit is contained in:
@@ -94,6 +94,11 @@ export class ExtHostOutputChannelBackedByFile extends AbstractExtHostOutputChann
|
||||
this.validate();
|
||||
this._appender.append(value);
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
this._appender.flush();
|
||||
super.clear();
|
||||
}
|
||||
}
|
||||
|
||||
export class ExtHostLogFileOutputChannel extends AbstractExtHostOutputChannel {
|
||||
|
||||
@@ -351,12 +351,13 @@ class FileOutputChannel extends AbstractFileOutputChannel implements OutputChann
|
||||
}
|
||||
|
||||
loadModel(): TPromise<ITextModel> {
|
||||
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 this.createModel(content.value);
|
||||
});
|
||||
return this.readContent()
|
||||
.then(content => this.createModel(content));
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
this.readContent() // Read content from the file before clearing
|
||||
.then(() => super.clear());
|
||||
}
|
||||
|
||||
append(message: string): void {
|
||||
@@ -391,6 +392,15 @@ class FileOutputChannel extends AbstractFileOutputChannel implements OutputChann
|
||||
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 {
|
||||
if (!this.updateInProgress) {
|
||||
this.updateInProgress = true;
|
||||
|
||||
Reference in New Issue
Block a user