extensions/typescript-language-features/src/typescriptServiceClient.ts/TypeScriptServiceClient/serviceExited
class TypeScriptServiceClient:	private serviceExited(restart: boolean): void {
		this.loadingIndicator.reset();

		const previousState = this.serverState;
		this.serverState = ServerState.None;

		if (restart) {
			const diff = Date.now() - this.lastStart;
			this.numberRestarts++;
			let startService = true;

			const reportIssueItem: vscode.MessageItem = {
				title: localize('serverDiedReportIssue', 'Report Issue'),
			};
			let prompt: Thenable<undefined | vscode.MessageItem> | undefined = undefined;

			if (this.numberRestarts > 5) {
				this.numberRestarts = 0;
				if (diff < 10 * 1000 /* 10 seconds */) {
					this.lastStart = Date.now();
					startService = false;
					this.hasServerFatallyCrashedTooManyTimes = true;
					prompt = vscode.window.showErrorMessage(
						localize('serverDiedAfterStart', 'The TypeScript language service died 5 times right after it got started. The service will not be restarted.'),
						reportIssueItem);

					/* __GDPR__
						"serviceExited" : {
							"owner": "mjbvz",
							"${include}": [
								"${TypeScriptCommonProperties}"
							]
						}
					*/
					this.logTelemetry('serviceExited');
				} else if (diff < 60 * 1000 * 5 /* 5 Minutes */) {
					this.lastStart = Date.now();
					prompt = vscode.window.showWarningMessage(
						localize('serverDied', 'The TypeScript language service died unexpectedly 5 times in the last 5 Minutes.'),
						reportIssueItem);
				}
			} else if (['vscode-insiders', 'code-oss'].includes(vscode.env.uriScheme)) {
				// Prompt after a single restart
				if (!this._isPromptingAfterCrash && previousState.type === ServerState.Type.Errored && previousState.error instanceof TypeScriptServerError) {
					this.numberRestarts = 0;
					this._isPromptingAfterCrash = true;
					prompt = vscode.window.showWarningMessage(
						localize('serverDiedOnce', 'The TypeScript language service died unexpectedly.'),
						reportIssueItem);
				}
			}

			prompt?.then(item => {
				this._isPromptingAfterCrash = false;

				if (item === reportIssueItem) {
					const minModernTsVersion = this.versionProvider.bundledVersion.apiVersion;

					if (minModernTsVersion && this.apiVersion.lt(minModernTsVersion)) {
						vscode.window.showWarningMessage(
							localize('usingOldTsVersion.title', 'Please update your TypeScript version'),
							{
								modal: true,
								detail: localize(
									'usingOldTsVersion.detail',
									'The workspace is using an old version of TypeScript ({0}).\n\nBefore reporting an issue, please update the workspace to use the latest stable TypeScript release to make sure the bug has not already been fixed.',
									previousState.type === ServerState.Type.Errored && previousState.error instanceof TypeScriptServerError ? previousState.error.version.apiVersion?.displayName : undefined),
								useCustom: true
							});
					} else {
						const args = previousState.type === ServerState.Type.Errored && previousState.error instanceof TypeScriptServerError
							? getReportIssueArgsForError(previousState.error, previousState.tsServerLogFile)
							: undefined;
						vscode.commands.executeCommand('workbench.action.openIssueReporter', args);
					}
				}
			});

			if (startService) {
				this.startService(true);
			}
		}
	}