Skip to content

Commit 63d867d

Browse files
committed
fix: code convention
1 parent 4b59606 commit 63d867d

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

‎src/vs/workbench/contrib/files/browser/views/explorerViewer.ts‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,17 @@ export class FilesRenderer implements ITreeRenderer<ExplorerItem, FuzzyScore, IF
218218
const lastDot = value.lastIndexOf('.');
219219

220220
inputBox.value = value;
221-
setTimeout(() => inputBox.focus(), 100);
222-
inputBox.select({ start: 0, end: lastDot > 0 && !stat.isDirectory ? lastDot : value.length });
221+
222+
let isFinishableDisposeEvent = false;
223+
setTimeout(() => {
224+
// Check if disposed
225+
if (!inputBox.inputElement) {
226+
return;
227+
}
228+
inputBox.focus();
229+
inputBox.select({ start: 0, end: lastDot > 0 && !stat.isDirectory ? lastDot : value.length });
230+
isFinishableDisposeEvent = true;
231+
}, 0);
223232

224233
const done = once(async (success: boolean) => {
225234
label.element.style.display = 'none';
@@ -251,8 +260,12 @@ export class FilesRenderer implements ITreeRenderer<ExplorerItem, FuzzyScore, IF
251260
];
252261

253262
return toDisposable(() => {
254-
blurDisposable.dispose();
255-
done(false);
263+
if (isFinishableDisposeEvent) {
264+
done(false);
265+
}
266+
else {
267+
dispose(toDispose);
268+
}
256269
});
257270
}
258271

0 commit comments

Comments
 (0)