private async void HandleRunspaceChanged(object sender, RunspaceChangedEventArgs e)
        {
            if (e.ChangeAction == RunspaceChangeAction.Enter)
            {
                this.RegisterPSEditFunction(e.NewRunspace);
            }
            else
            {
                // Close any remote files that were opened
                if (e.PreviousRunspace.Location == RunspaceLocation.Remote &&
                    (e.ChangeAction == RunspaceChangeAction.Shutdown ||
                     !string.Equals(
                         e.NewRunspace.SessionDetails.ComputerName,
                         e.PreviousRunspace.SessionDetails.ComputerName,
                         StringComparison.CurrentCultureIgnoreCase)))
                {
                    RemotePathMappings remotePathMappings;
                    if (this.filesPerComputer.TryGetValue(e.PreviousRunspace.SessionDetails.ComputerName, out remotePathMappings))
                    {
                        foreach (string remotePath in remotePathMappings.OpenedPaths)
                        {
                            await this.editorOperations?.CloseFile(remotePath);
                        }
                    }
                }

                if (e.PreviousRunspace != null)
                {
                    this.RemovePSEditFunction(e.PreviousRunspace);
                }
            }
        }
        private async void HandleRunspaceChanged(object sender, RunspaceChangedEventArgs e)
        {
            if (e.ChangeAction == RunspaceChangeAction.Enter)
            {
                this.RegisterPSEditFunction(e.NewRunspace);
            }
            else
            {
                // Close any remote files that were opened
                RemotePathMappings remotePathMappings;
                if (this.filesPerRunspace.TryGetValue(e.PreviousRunspace, out remotePathMappings))
                {
                    foreach (string remotePath in remotePathMappings.OpenedPaths)
                    {
                        await this.editorOperations.CloseFile(remotePath);
                    }
                }

                if (e.PreviousRunspace != null)
                {
                    this.RemovePSEditFunction(e.PreviousRunspace);
                }
            }
        }