From faffa553f3b8bd9b8cfa1f6e40f6404513b02539 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 25 Jan 2017 23:14:51 -0800 Subject: [PATCH] Fixes #3912 --- .../typescript/src/typescriptServiceClient.ts | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/extensions/typescript/src/typescriptServiceClient.ts b/extensions/typescript/src/typescriptServiceClient.ts index 59efef27ba8..d72c05e49d5 100644 --- a/extensions/typescript/src/typescriptServiceClient.ts +++ b/extensions/typescript/src/typescriptServiceClient.ts @@ -70,7 +70,8 @@ enum MessageAction { useLocal, useBundled, learnMore, - close + close, + reportIssue } interface MyMessageItem extends MessageItem { @@ -553,13 +554,33 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient this.numberRestarts++; let startService = true; if (this.numberRestarts > 5) { + let prompt: Thenable | undefined = undefined; if (diff < 60 * 1000 /* 1 Minutes */) { - window.showWarningMessage(localize('serverDied', 'The TypeScript language service died unexpectedly 5 times in the last 5 Minutes. Please consider to open a bug report.')); + prompt = window.showWarningMessage( + localize('serverDied', 'The TypeScript language service died unexpectedly 5 times in the last 5 Minutes.'), + { + title: localize('serverDiedReportIssue', 'Report Issue'), + id: MessageAction.reportIssue, + isCloseAffordance: true + }); } else if (diff < 2 * 1000 /* 2 seconds */) { startService = false; - window.showErrorMessage(localize('serverDiedAfterStart', 'The TypeScript language service died 5 times right after it got started. The service will not be restarted. Please open a bug report.')); + prompt = window.showErrorMessage( + localize('serverDiedAfterStart', 'The TypeScript language service died 5 times right after it got started. The service will not be restarted.'), + { + title: localize('serverDiedReportIssue', 'Report Issue'), + id: MessageAction.reportIssue, + isCloseAffordance: true + }); this.logTelemetry('serviceExited'); } + if (prompt) { + prompt.then(item => { + if (item && item.id === MessageAction.reportIssue) { + return commands.executeCommand('workbench.action.reportIssues'); + } + }); + } } if (startService) { this.startService(true); -- GitLab