From 63d867d80403f6be290955e71a7b7e05ea414ba8 Mon Sep 17 00:00:00 2001 From: orange4glace Date: Wed, 19 Jun 2019 21:36:30 +0900 Subject: [PATCH] fix: code convention --- .../files/browser/views/explorerViewer.ts | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts index 3da1ae98039bf..184916e4ee56c 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts @@ -218,8 +218,17 @@ export class FilesRenderer implements ITreeRenderer inputBox.focus(), 100); - inputBox.select({ start: 0, end: lastDot > 0 && !stat.isDirectory ? lastDot : value.length }); + + let isFinishableDisposeEvent = false; + setTimeout(() => { + // Check if disposed + if (!inputBox.inputElement) { + return; + } + inputBox.focus(); + inputBox.select({ start: 0, end: lastDot > 0 && !stat.isDirectory ? lastDot : value.length }); + isFinishableDisposeEvent = true; + }, 0); const done = once(async (success: boolean) => { label.element.style.display = 'none'; @@ -251,8 +260,12 @@ export class FilesRenderer implements ITreeRenderer { - blurDisposable.dispose(); - done(false); + if (isFinishableDisposeEvent) { + done(false); + } + else { + dispose(toDispose); + } }); }