Skip to content

Commit

Permalink
Fixes #3912
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbvz committed Jan 26, 2017
1 parent 08ff1fa commit faffa55
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions extensions/typescript/src/typescriptServiceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ enum MessageAction {
useLocal,
useBundled,
learnMore,
close
close,
reportIssue
}

interface MyMessageItem extends MessageItem {
Expand Down Expand Up @@ -553,13 +554,33 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
this.numberRestarts++;
let startService = true;
if (this.numberRestarts > 5) {
let prompt: Thenable<MyMessageItem | undefined> | 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<MyMessageItem>(
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<MyMessageItem>(
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);
Expand Down

0 comments on commit faffa55

Please sign in to comment.