Skip to content

Commit f37b93f

Browse files
committed
1 parent 1d69cae commit f37b93f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/vs/workbench/contrib/logs/common/logs.contribution.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,16 @@ class LogOutputChannels extends Disposable implements IWorkbenchContribution {
7373
private async registerLogChannel(id: string, label: string, file: URI): Promise<void> {
7474
await whenProviderRegistered(file, this.fileService);
7575
const outputChannelRegistry = Registry.as<IOutputChannelRegistry>(OutputExt.OutputChannels);
76+
77+
/* watch first and then check if file exists so that to avoid missing file creation event after watching #102117 */
78+
const watcher = this.fileService.watch(dirname(file));
7679
const exists = await this.fileService.exists(file);
7780
if (exists) {
81+
watcher.dispose();
7882
outputChannelRegistry.registerChannel({ id, label, file, log: true });
7983
return;
8084
}
8185

82-
const watcher = this.fileService.watch(dirname(file));
8386
const disposable = this.fileService.onDidFilesChange(e => {
8487
if (e.contains(file, FileChangeType.ADDED) || e.contains(file, FileChangeType.UPDATED)) {
8588
watcher.dispose();

0 commit comments

Comments
 (0)