Skip to content

Fix configuration processing to ensure that profiles are loaded #1415

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 4 commits into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
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
9 changes: 7 additions & 2 deletions PowerShellEditorServices.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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,{
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public async Task<Unit> 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 =
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down