diff --git a/PowerShellEditorServices.build.ps1 b/PowerShellEditorServices.build.ps1 index 9934646ae..9d37cbe5e 100644 --- a/PowerShellEditorServices.build.ps1 +++ b/PowerShellEditorServices.build.ps1 @@ -224,10 +224,15 @@ namespace Microsoft.PowerShell.EditorServices.Hosting Set-Content -LiteralPath $script:BuildInfoPath -Value $buildInfoContents -Force } -task SetupHelpForTests -Before Test { +task SetupHelpForTests { if (-not (Get-Help Write-Host).Examples) { + Write-Host "Updating help for tests" Update-Help -Module Microsoft.PowerShell.Utility -Force -Scope CurrentUser } + else + { + Write-Host "Write-Host help found -- Update-Help skipped" + } } task Build BinClean,{ @@ -247,7 +252,7 @@ function DotNetTestFilter { if ($TestFilter) { @("--filter",$TestFilter) } else { "" } } -task Test TestServer,TestE2E +task Test SetupHelpForTests,TestServer,TestE2E task TestServer TestServerWinPS,TestServerPS7,TestServerPS71 diff --git a/src/PowerShellEditorServices/Services/Workspace/Handlers/ConfigurationHandler.cs b/src/PowerShellEditorServices/Services/Workspace/Handlers/ConfigurationHandler.cs index d340a54fe..f5fcdf84a 100644 --- a/src/PowerShellEditorServices/Services/Workspace/Handlers/ConfigurationHandler.cs +++ b/src/PowerShellEditorServices/Services/Workspace/Handlers/ConfigurationHandler.cs @@ -65,7 +65,7 @@ public async Task Handle(DidChangeConfigurationParams request, Cancellatio SendFeatureChangesTelemetry(incomingSettings); - bool oldLoadProfiles = _configurationService.CurrentSettings.EnableProfileLoading; + bool profileLoadingPreviouslyEnabled = _configurationService.CurrentSettings.EnableProfileLoading; bool oldScriptAnalysisEnabled = _configurationService.CurrentSettings.ScriptAnalysis.Enable ?? false; string oldScriptAnalysisSettingsPath = @@ -96,9 +96,12 @@ await _powerShellContextService.SetWorkingDirectoryAsync( this._cwdSet = true; } - if (!this._profilesLoaded && - _configurationService.CurrentSettings.EnableProfileLoading && - oldLoadProfiles != _configurationService.CurrentSettings.EnableProfileLoading) + // We need to load the profiles if: + // - Profile loading is configured, AND + // - Profiles haven't been loaded before, OR + // - The profile loading configuration just changed + if (_configurationService.CurrentSettings.EnableProfileLoading + && (!this._profilesLoaded || !profileLoadingPreviouslyEnabled)) { await _powerShellContextService.LoadHostProfilesAsync().ConfigureAwait(false); this._profilesLoaded = true; diff --git a/src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs b/src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs index f6b1b3314..0dcca5ce4 100644 --- a/src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs +++ b/src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs @@ -19,7 +19,7 @@ internal class LanguageServerSettings { private readonly object updateLock = new object(); - public bool EnableProfileLoading { get; set; } = true; + public bool EnableProfileLoading { get; set; } = false; public bool PromptToUpdatePackageManagement { get; set; } = true;