mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 11:49:38 +00:00
Tell users about enabled TS plugins on crash (#156514)
We've been seeing a fair number of reported issues about TS Server crashes that are caused by plugins contributed by extension. This change adds info to the error message about enabled global plugins so users can try disabling them Other changes: - Use `JS/TS` instead of Typescript since the server is used for javascript too (a common source of confusion) - Fix some missing checks to `_isPromptingAfterCrash` and some extra guards that were causing some crashes to now show this message - Use `crashed` instead of `died unexpectedly`
This commit is contained in:
@@ -584,6 +584,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
|||||||
this.numberRestarts++;
|
this.numberRestarts++;
|
||||||
let startService = true;
|
let startService = true;
|
||||||
|
|
||||||
|
const pluginExtensionList = this.pluginManager.plugins.map(plugin => plugin.extension.id).join(', ');
|
||||||
const reportIssueItem: vscode.MessageItem = {
|
const reportIssueItem: vscode.MessageItem = {
|
||||||
title: localize('serverDiedReportIssue', 'Report Issue'),
|
title: localize('serverDiedReportIssue', 'Report Issue'),
|
||||||
};
|
};
|
||||||
@@ -596,7 +597,9 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
|||||||
startService = false;
|
startService = false;
|
||||||
this.hasServerFatallyCrashedTooManyTimes = true;
|
this.hasServerFatallyCrashedTooManyTimes = true;
|
||||||
prompt = vscode.window.showErrorMessage(
|
prompt = vscode.window.showErrorMessage(
|
||||||
localize('serverDiedAfterStart', 'The TypeScript language service died 5 times right after it got started. The service will not be restarted.'),
|
this.pluginManager.plugins.length
|
||||||
|
? localize('serverDiedImmediatelyWithPlugins', "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)
|
||||||
|
: localize('serverDiedImmediately', "The JS/TS language service immediately crashed 5 times. The service will not be restarted."),
|
||||||
reportIssueItem);
|
reportIssueItem);
|
||||||
|
|
||||||
/* __GDPR__
|
/* __GDPR__
|
||||||
@@ -610,21 +613,30 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
|||||||
this.logTelemetry('serviceExited');
|
this.logTelemetry('serviceExited');
|
||||||
} else if (diff < 60 * 1000 * 5 /* 5 Minutes */) {
|
} else if (diff < 60 * 1000 * 5 /* 5 Minutes */) {
|
||||||
this.lastStart = Date.now();
|
this.lastStart = Date.now();
|
||||||
prompt = vscode.window.showWarningMessage(
|
if (!this._isPromptingAfterCrash) {
|
||||||
localize('serverDied', 'The TypeScript language service died unexpectedly 5 times in the last 5 Minutes.'),
|
prompt = vscode.window.showWarningMessage(
|
||||||
reportIssueItem);
|
this.pluginManager.plugins.length
|
||||||
|
? localize('serverDiedFiveTimesWithPlugins', "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)
|
||||||
|
: localize('serverDiedFiveTimes', "The JS/TS language service crashed 5 times in the last 5 Minutes."),
|
||||||
|
reportIssueItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (['vscode-insiders', 'code-oss'].includes(vscode.env.uriScheme)) {
|
} else if (['vscode-insiders', 'code-oss'].includes(vscode.env.uriScheme)) {
|
||||||
// Prompt after a single restart
|
// Prompt after a single restart
|
||||||
if (!this._isPromptingAfterCrash && previousState.type === ServerState.Type.Errored && previousState.error instanceof TypeScriptServerError) {
|
this.numberRestarts = 0;
|
||||||
this.numberRestarts = 0;
|
if (!this._isPromptingAfterCrash) {
|
||||||
this._isPromptingAfterCrash = true;
|
|
||||||
prompt = vscode.window.showWarningMessage(
|
prompt = vscode.window.showWarningMessage(
|
||||||
localize('serverDiedOnce', 'The TypeScript language service died unexpectedly.'),
|
this.pluginManager.plugins.length
|
||||||
|
? localize('serverDiedOnceWithPlugins', "The JS/TS language service crashed.\nThis may be caused by a plugin contributed by one of these extensions: {0}", pluginExtensionList)
|
||||||
|
: localize('serverDiedOnce', "The JS/TS language service crashed."),
|
||||||
reportIssueItem);
|
reportIssueItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prompt) {
|
||||||
|
this._isPromptingAfterCrash = true;
|
||||||
|
}
|
||||||
|
|
||||||
prompt?.then(item => {
|
prompt?.then(item => {
|
||||||
this._isPromptingAfterCrash = false;
|
this._isPromptingAfterCrash = false;
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import * as arrays from './arrays';
|
|||||||
import { Disposable } from './dispose';
|
import { Disposable } from './dispose';
|
||||||
|
|
||||||
export interface TypeScriptServerPlugin {
|
export interface TypeScriptServerPlugin {
|
||||||
|
readonly extension: vscode.Extension<unknown>;
|
||||||
readonly uri: vscode.Uri;
|
readonly uri: vscode.Uri;
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly enableForWorkspaceTypeScriptVersions: boolean;
|
readonly enableForWorkspaceTypeScriptVersions: boolean;
|
||||||
@@ -74,6 +75,7 @@ export class PluginManager extends Disposable {
|
|||||||
const plugins: TypeScriptServerPlugin[] = [];
|
const plugins: TypeScriptServerPlugin[] = [];
|
||||||
for (const plugin of pack.contributes.typescriptServerPlugins) {
|
for (const plugin of pack.contributes.typescriptServerPlugins) {
|
||||||
plugins.push({
|
plugins.push({
|
||||||
|
extension,
|
||||||
name: plugin.name,
|
name: plugin.name,
|
||||||
enableForWorkspaceTypeScriptVersions: !!plugin.enableForWorkspaceTypeScriptVersions,
|
enableForWorkspaceTypeScriptVersions: !!plugin.enableForWorkspaceTypeScriptVersions,
|
||||||
uri: extension.extensionUri,
|
uri: extension.extensionUri,
|
||||||
|
|||||||
Reference in New Issue
Block a user