Skip to content

Commit 23f4aa2

Browse files
authored
Fix configuration processing to ensure that profiles are loaded (PowerShell#1415)
* Fix configuration processing for profile loading * Fix style * Try to fix help tests on Ubuntu * Fix typo in build script
1 parent c6a3048 commit 23f4aa2

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

PowerShellEditorServices.build.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,15 @@ namespace Microsoft.PowerShell.EditorServices.Hosting
224224
Set-Content -LiteralPath $script:BuildInfoPath -Value $buildInfoContents -Force
225225
}
226226

227-
task SetupHelpForTests -Before Test {
227+
task SetupHelpForTests {
228228
if (-not (Get-Help Write-Host).Examples) {
229+
Write-Host "Updating help for tests"
229230
Update-Help -Module Microsoft.PowerShell.Utility -Force -Scope CurrentUser
230231
}
232+
else
233+
{
234+
Write-Host "Write-Host help found -- Update-Help skipped"
235+
}
231236
}
232237

233238
task Build BinClean,{
@@ -247,7 +252,7 @@ function DotNetTestFilter {
247252
if ($TestFilter) { @("--filter",$TestFilter) } else { "" }
248253
}
249254

250-
task Test TestServer,TestE2E
255+
task Test SetupHelpForTests,TestServer,TestE2E
251256

252257
task TestServer TestServerWinPS,TestServerPS7,TestServerPS71
253258

src/PowerShellEditorServices/Services/Workspace/Handlers/ConfigurationHandler.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public async Task<Unit> Handle(DidChangeConfigurationParams request, Cancellatio
6565

6666
SendFeatureChangesTelemetry(incomingSettings);
6767

68-
bool oldLoadProfiles = _configurationService.CurrentSettings.EnableProfileLoading;
68+
bool profileLoadingPreviouslyEnabled = _configurationService.CurrentSettings.EnableProfileLoading;
6969
bool oldScriptAnalysisEnabled =
7070
_configurationService.CurrentSettings.ScriptAnalysis.Enable ?? false;
7171
string oldScriptAnalysisSettingsPath =
@@ -96,9 +96,12 @@ await _powerShellContextService.SetWorkingDirectoryAsync(
9696
this._cwdSet = true;
9797
}
9898

99-
if (!this._profilesLoaded &&
100-
_configurationService.CurrentSettings.EnableProfileLoading &&
101-
oldLoadProfiles != _configurationService.CurrentSettings.EnableProfileLoading)
99+
// We need to load the profiles if:
100+
// - Profile loading is configured, AND
101+
// - Profiles haven't been loaded before, OR
102+
// - The profile loading configuration just changed
103+
if (_configurationService.CurrentSettings.EnableProfileLoading
104+
&& (!this._profilesLoaded || !profileLoadingPreviouslyEnabled))
102105
{
103106
await _powerShellContextService.LoadHostProfilesAsync().ConfigureAwait(false);
104107
this._profilesLoaded = true;

src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal class LanguageServerSettings
1919
{
2020
private readonly object updateLock = new object();
2121

22-
public bool EnableProfileLoading { get; set; } = true;
22+
public bool EnableProfileLoading { get; set; } = false;
2323

2424
public bool PromptToUpdatePackageManagement { get; set; } = true;
2525

0 commit comments

Comments
 (0)