MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / closed

Method closed

src/extension/analysis/analyzer.ts:726–752  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

724 }
725
726 public closed(): ls.CloseHandlerResult {
727 this.restarts.push(Date.now());
728 this.logger.warn(`LSP Client closed (${this.restarts.length} recent restarts recorded)`);
729 if (this.restarts.length <= this.maxRestartCount) {
730 return { action: ls.CloseAction.Restart };
731 } else {
732 const diff = this.restarts[this.restarts.length - 1] - this.restarts[0];
733 if (diff <= 3 * 60 * 1000) {
734 const prompt = `The Dart Analysis Server crashed ${this.maxRestartCount + 1} times in the last 3 minutes and will not restart. Please [file an issue on GitHub](https://github.com/dart-lang/sdk/issues/new/choose) with any error from the end of the log.`;
735 void promptToReloadExtension(this.logger, {
736 prompt,
737 offerLog: true,
738 severity: "ERROR",
739 restartReason: ExtensionRestartReason.AnalysisServerCrashedManyTimes
740 });
741 return {
742 action: ls.CloseAction.DoNotRestart,
743 handled: true,
744 };
745 } else {
746 this.restarts.shift();
747 return {
748 action: ls.CloseAction.Restart,
749 };
750 }
751 }
752 }
753}

Callers

nothing calls this directly

Calls 2

promptToReloadExtensionFunction · 0.90
warnMethod · 0.65

Tested by

no test coverage detected