MCPcopy
hub / github.com/PowerShell/vscode-powershell / restartOnCriticalConfigChange

Method restartOnCriticalConfigChange

src/session.ts:615–685  ·  view source on GitHub ↗

There are some changes we cannot "hot" set, so these require a restart of the session

(
        changeEvent: vscode.ConfigurationChangeEvent,
    )

Source from the content-addressed store, hash-verified

613
614 /** There are some changes we cannot "hot" set, so these require a restart of the session */
615 private async restartOnCriticalConfigChange(
616 changeEvent: vscode.ConfigurationChangeEvent,
617 ): Promise<void> {
618 if (this.suppressRestartPrompt) {
619 return;
620 }
621 if (this.sessionStatus !== SessionStatus.Running) {
622 return;
623 }
624
625 // Restart not needed if shell integration is enabled but the shell is backgrounded.
626 const settings = getSettings();
627 if (
628 changeEvent.affectsConfiguration(
629 "terminal.integrated.shellIntegration.enabled",
630 )
631 ) {
632 const shellIntegrationEnabled =
633 vscode.workspace
634 .getConfiguration("terminal.integrated.shellIntegration")
635 .get<boolean>("enabled") ?? false;
636 if (
637 shellIntegrationEnabled &&
638 !settings.integratedConsole.startInBackground
639 ) {
640 return this.restartWithPrompt();
641 }
642 }
643
644 // Early return if the change doesn't affect the PowerShell extension settings from this point forward
645 if (!changeEvent.affectsConfiguration("powershell")) {
646 return;
647 }
648
649 // Detect any setting changes that would affect the session.
650 const coldRestartSettingNames = [
651 "developer.traceLsp",
652 "developer.traceDap",
653 "developer.editorServicesLogLevel",
654 ];
655 for (const settingName of coldRestartSettingNames) {
656 if (
657 changeEvent.affectsConfiguration(
658 "powershell" + "." + settingName,
659 )
660 ) {
661 return this.restartWithPrompt();
662 }
663 }
664
665 // TODO: Migrate these to affectsConfiguration style above
666 if (
667 settings.cwd !== this.sessionSettings.cwd ||
668 settings.powerShellDefaultVersion !==
669 this.sessionSettings.powerShellDefaultVersion ||
670 settings.developer.bundledModulesPath !==
671 this.sessionSettings.developer.bundledModulesPath ||
672 settings.developer.editorServicesWaitForDebugger !==

Callers 1

registerCommandsMethod · 0.95

Calls 2

restartWithPromptMethod · 0.95
getSettingsFunction · 0.90

Tested by

no test coverage detected