Skip to content

Commit

Permalink
Set EnableProfileLoading default to true (#1802)
Browse files Browse the repository at this point in the history
So it can be turned off if needed, but otherwise has a sane default.

We need to turn it off during E2E testing for CI.
  • Loading branch information
andyleejordan authored May 17, 2022
1 parent d198694 commit 50f0105
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/PowerShellEditorServices/Server/PsesLanguageServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,17 @@ public async Task StartAsync()
JObject initializationOptions = initializeParams.InitializationOptions as JObject;
HostStartOptions hostStartOptions = new()
{
LoadProfiles = initializationOptions?.GetValue("EnableProfileLoading")?.Value<bool>() ?? false,
// TODO: We need to synchronize our "default" settings as specified
// in the VS Code extension's package.json with the actual default
// values in this project. For now, this is going to be the most
// annoying setting, so we're defaulting this to true.
//
// NOTE: The keys start with a lowercase because OmniSharp's client
// (used for testing) forces it to be that way.
LoadProfiles = initializationOptions?.GetValue("enableProfileLoading")?.Value<bool>() ?? true,
// TODO: Consider deprecating the setting which sets this and
// instead use WorkspacePath exclusively.
InitialWorkingDirectory = initializationOptions?.GetValue("InitialWorkingDirectory")?.Value<string>() ?? workspaceService.WorkspacePath
InitialWorkingDirectory = initializationOptions?.GetValue("initialWorkingDirectory")?.Value<string>() ?? workspaceService.WorkspacePath
};

_psesHost = languageServer.Services.GetService<PsesInternalHost>();
Expand Down
3 changes: 2 additions & 1 deletion test/PowerShellEditorServices.Test.E2E/LSPTestsFixures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public async Task InitializeAsync()
options
.WithInput(_psesProcess.OutputStream)
.WithOutput(_psesProcess.InputStream)
.WithRootUri(DocumentUri.FromFileSystemPath(testdir.FullName))
.WithWorkspaceFolder(DocumentUri.FromFileSystemPath(testdir.FullName), "testdir")
.WithInitializationOptions(new { EnableProfileLoading = false })
.OnPublishDiagnostics(diagnosticParams => Diagnostics.AddRange(diagnosticParams.Diagnostics.Where(d => d != null)))
.OnLogMessage(logMessageParams => Output?.WriteLine($"{logMessageParams.Type}: {logMessageParams.Message}"))
.OnTelemetryEvent(telemetryEventParams => TelemetryEvents.Add(
Expand Down

0 comments on commit 50f0105

Please sign in to comment.