Skip to content

Commit 4d247ba

Browse files
authored
Don't allow one click reporting of TS Server crashes against VS Code repo when TS server plugins are enabled (microsoft#175186)
Don't allow one click reporting of TS Server crashes when TS server plugins are enabled Fixes microsoft#175184
1 parent f105526 commit 4d247ba

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

extensions/typescript-language-features/src/typescriptServiceClient.ts

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -605,11 +605,14 @@ export default class TypeScriptServiceClient extends Disposable implements IType
605605
this.lastStart = Date.now();
606606
startService = false;
607607
this.hasServerFatallyCrashedTooManyTimes = true;
608-
prompt = vscode.window.showErrorMessage(
609-
this.pluginManager.plugins.length
610-
? vscode.l10n.t("The JS/TS language service immediately crashed 5 times. The service will not be restarted.\nThis may be caused by a plugin contributed by one of these extensions: {0}", pluginExtensionList)
611-
: vscode.l10n.t("The JS/TS language service immediately crashed 5 times. The service will not be restarted."),
612-
reportIssueItem);
608+
if (this.pluginManager.plugins.length) {
609+
prompt = vscode.window.showErrorMessage<vscode.MessageItem>(
610+
vscode.l10n.t("The JS/TS language service immediately crashed 5 times. The service will not be restarted.\nThis may be caused by a plugin contributed by one of these extensions: {0}.\nPlease try disabling these extensions before filing an issue against VS Code.", pluginExtensionList));
611+
} else {
612+
prompt = vscode.window.showErrorMessage(
613+
vscode.l10n.t("The JS/TS language service immediately crashed 5 times. The service will not be restarted."),
614+
reportIssueItem);
615+
}
613616

614617
/* __GDPR__
615618
"serviceExited" : {
@@ -623,22 +626,28 @@ export default class TypeScriptServiceClient extends Disposable implements IType
623626
} else if (diff < 60 * 1000 * 5 /* 5 Minutes */) {
624627
this.lastStart = Date.now();
625628
if (!this._isPromptingAfterCrash) {
626-
prompt = vscode.window.showWarningMessage(
627-
this.pluginManager.plugins.length
628-
? vscode.l10n.t("The JS/TS language service crashed 5 times in the last 5 Minutes.\nThis may be caused by a plugin contributed by one of these extensions: {0}", pluginExtensionList)
629-
: vscode.l10n.t("The JS/TS language service crashed 5 times in the last 5 Minutes."),
630-
reportIssueItem);
629+
if (this.pluginManager.plugins.length) {
630+
prompt = vscode.window.showWarningMessage<vscode.MessageItem>(
631+
vscode.l10n.t("The JS/TS language service crashed 5 times in the last 5 Minutes.\nThis may be caused by a plugin contributed by one of these extensions: {0}\nPlease try disabling these extensions before filing an issue against VS Code.", pluginExtensionList));
632+
} else {
633+
prompt = vscode.window.showWarningMessage(
634+
vscode.l10n.t("The JS/TS language service crashed 5 times in the last 5 Minutes."),
635+
reportIssueItem);
636+
}
631637
}
632638
}
633639
} else if (['vscode-insiders', 'code-oss'].includes(vscode.env.uriScheme)) {
634640
// Prompt after a single restart
635641
this.numberRestarts = 0;
636642
if (!this._isPromptingAfterCrash) {
637-
prompt = vscode.window.showWarningMessage(
638-
this.pluginManager.plugins.length
639-
? vscode.l10n.t("The JS/TS language service crashed.\nThis may be caused by a plugin contributed by one of these extensions: {0}", pluginExtensionList)
640-
: vscode.l10n.t("The JS/TS language service crashed."),
641-
reportIssueItem);
643+
if (this.pluginManager.plugins.length) {
644+
prompt = vscode.window.showWarningMessage<vscode.MessageItem>(
645+
vscode.l10n.t("The JS/TS language service crashed.\nThis may be caused by a plugin contributed by one of these extensions: {0}.\nPlease try disabling these extensions before filing an issue against VS Code.", pluginExtensionList));
646+
} else {
647+
prompt = vscode.window.showWarningMessage(
648+
vscode.l10n.t("The JS/TS language service crashed."),
649+
reportIssueItem);
650+
}
642651
}
643652
}
644653

@@ -1047,7 +1056,7 @@ function getReportIssueArgsForError(
10471056
[
10481057
`**Global TypeScript Server Plugins**`,
10491058
`❗️ Please test with extensions disabled. Extensions are the root cause of most TypeScript server crashes`,
1050-
globalPlugins.map(plugin => `- \`${plugin.name}\``).join('\n')
1059+
globalPlugins.map(plugin => `- \`${plugin.name}\` contributed by the \`${plugin.extension.id}\` extension`).join('\n')
10511060
].join('\n\n')
10521061
);
10531062
}

0 commit comments

Comments
 (0)