From f43d80f02f161d3cb1274b7338d07c1de00a607a Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 9 Sep 2021 09:23:31 +0200 Subject: [PATCH] #126477 add trace statements --- .../output/common/outputChannelModel.ts | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/vs/workbench/contrib/output/common/outputChannelModel.ts b/src/vs/workbench/contrib/output/common/outputChannelModel.ts index 42cea337e9a..f22d94acbe2 100644 --- a/src/vs/workbench/contrib/output/common/outputChannelModel.ts +++ b/src/vs/workbench/contrib/output/common/outputChannelModel.ts @@ -17,7 +17,7 @@ import { isNumber } from 'vs/base/common/types'; import { EditOperation } from 'vs/editor/common/core/editOperation'; import { Position } from 'vs/editor/common/core/position'; import { VSBuffer } from 'vs/base/common/buffer'; -import { ILogger, ILoggerService } from 'vs/platform/log/common/log'; +import { ILogger, ILoggerService, ILogService } from 'vs/platform/log/common/log'; export interface IOutputChannelModel extends IDisposable { readonly onDidAppendedContent: Event; @@ -151,7 +151,8 @@ class OutputFileListener extends Disposable { constructor( private readonly file: URI, - private readonly fileService: IFileService + private readonly fileService: IFileService, + private readonly logService: ILogService ) { super(); this.syncDelayer = new ThrottledDelayer(500); @@ -161,6 +162,7 @@ class OutputFileListener extends Disposable { if (!this.watching) { this.etag = eTag; this.poll(); + this.logService.trace('Started polling', this.file.toString()); this.watching = true; } } @@ -170,20 +172,19 @@ class OutputFileListener extends Disposable { this.syncDelayer.trigger(loop); } - private doWatch(): Promise { - return this.fileService.resolve(this.file, { resolveMetadata: true }) - .then(stat => { - if (stat.etag !== this.etag) { - this.etag = stat.etag; - this._onDidContentChange.fire(stat.size); - } - }); + private async doWatch(): Promise { + const stat = await this.fileService.resolve(this.file, { resolveMetadata: true }); + if (stat.etag !== this.etag) { + this.etag = stat.etag; + this._onDidContentChange.fire(stat.size); + } } unwatch(): void { if (this.watching) { this.syncDelayer.cancel(); this.watching = false; + this.logService.trace('Stopped polling', this.file.toString()); } } @@ -210,11 +211,12 @@ class FileOutputChannelModel extends AbstractFileOutputChannelModel implements I file: URI, @IFileService fileService: IFileService, @IModelService modelService: IModelService, - @IModeService modeService: IModeService + @IModeService modeService: IModeService, + @ILogService logService: ILogService ) { super(modelUri, mimeType, file, fileService, modelService, modeService); - this.fileHandler = this._register(new OutputFileListener(this.file, this.fileService)); + this.fileHandler = this._register(new OutputFileListener(this.file, this.fileService, logService)); this._register(this.fileHandler.onDidContentChange(size => this.update(size))); this._register(toDisposable(() => this.fileHandler.unwatch())); }