Skip to content

Don't update PackageManagement on ConstrainedLanguage mode #1288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ private async Task CheckPackageManagement()
break;
}

_logger.LogDebug("Old version of PackageManagement detected. Attempting to update.");
_logger.LogDebug("Old version of PackageManagement detected.");

if (_powerShellContextService.CurrentRunspace.Runspace.SessionStateProxy.LanguageMode != PSLanguageMode.FullLanguage)
{
_languageServer.Window.ShowWarning("You have an older version of PackageManagement known to cause issues with the PowerShell extension. Please run the following command in a new Windows PowerShell session and then restart the PowerShell extension: `Install-Module PackageManagement -Force -AllowClobber -MinimumVersion 1.4.6`");
return;
}

var takeActionText = "Yes";
MessageActionItem messageAction = await _languageServer.Window.ShowMessage(new ShowMessageRequestParams
Expand Down Expand Up @@ -120,6 +126,7 @@ await _powerShellContextService.ExecuteScriptStringAsync(

if (errors.Length == 0)
{
_logger.LogDebug("PackageManagement is updated.");
_languageServer.Window.ShowMessage(new ShowMessageParams
{
Type = MessageType.Info,
Expand All @@ -129,6 +136,7 @@ await _powerShellContextService.ExecuteScriptStringAsync(
else
{
// There were errors installing PackageManagement.
_logger.LogError($"PackageManagement installation had errors: {errors.ToString()}");
_languageServer.Window.ShowMessage(new ShowMessageParams
{
Type = MessageType.Error,
Expand Down