Fix for Markdown File in Jupyter Books Viewlet not Opening After 2x (#8009)

* fix for markdown not opening after opened twice

* PR comment to add return type
This commit is contained in:
Chris LaFreniere
2019-10-24 22:14:24 -07:00
committed by GitHub
parent f7059a2365
commit f8067ffada

View File

@@ -203,8 +203,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
private runThrottledAction(resource: string, action: () => void) {
const isResourceChange = resource !== this._resource;
if (isResourceChange) {
clearTimeout(this._throttleTimer);
this._throttleTimer = undefined;
this.clearAndResetThrottleTimer();
}
this._resource = resource;
@@ -214,11 +213,19 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
if (isResourceChange) {
action();
} else {
this._throttleTimer = setTimeout(() => action(), 300);
this._throttleTimer = setTimeout(() => {
action();
this.clearAndResetThrottleTimer();
}, 300);
}
}
}
private clearAndResetThrottleTimer(): void {
clearTimeout(this._throttleTimer);
this._throttleTimer = undefined;
}
openExternalLink(resource: string): void {
try {
vscode.env.openExternal(vscode.Uri.parse(resource));