Skip to content

Commit

Permalink
fix: code convention
Browse files Browse the repository at this point in the history
  • Loading branch information
orange4glace committed Jun 19, 2019
1 parent 4b59606 commit 63d867d
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/vs/workbench/contrib/files/browser/views/explorerViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,17 @@ export class FilesRenderer implements ITreeRenderer<ExplorerItem, FuzzyScore, IF
const lastDot = value.lastIndexOf('.');

inputBox.value = value;
setTimeout(() => 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';
Expand Down Expand Up @@ -251,8 +260,12 @@ export class FilesRenderer implements ITreeRenderer<ExplorerItem, FuzzyScore, IF
];

return toDisposable(() => {
blurDisposable.dispose();
done(false);
if (isFinishableDisposeEvent) {
done(false);
}
else {
dispose(toDispose);
}
});
}

Expand Down

0 comments on commit 63d867d

Please sign in to comment.