Skip to content

Commit 14352c5

Browse files
committed
Add more logging to ConfigurationHandler.cs
1 parent 43f5e1b commit 14352c5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ public PsesConfigurationHandler(
5050
public override async Task<Unit> Handle(DidChangeConfigurationParams request, CancellationToken cancellationToken)
5151
{
5252
LanguageServerSettingsWrapper incomingSettings = request.Settings.ToObject<LanguageServerSettingsWrapper>();
53-
if(incomingSettings == null)
53+
this._logger.LogTrace("Handling DidChangeConfiguration");
54+
if (incomingSettings == null)
5455
{
56+
this._logger.LogTrace("Incoming settings were null");
5557
return await Unit.Task.ConfigureAwait(false);
5658
}
5759

@@ -73,16 +75,20 @@ public override async Task<Unit> Handle(DidChangeConfigurationParams request, Ca
7375
if (!string.IsNullOrEmpty(_configurationService.CurrentSettings.Cwd)
7476
&& Directory.Exists(_configurationService.CurrentSettings.Cwd))
7577
{
78+
this._logger.LogTrace($"Setting CWD (from config) to {_configurationService.CurrentSettings.Cwd}");
7679
await _powerShellContextService.SetWorkingDirectoryAsync(
7780
_configurationService.CurrentSettings.Cwd,
7881
isPathAlreadyEscaped: false).ConfigureAwait(false);
7982

8083
} else if (_workspaceService.WorkspacePath != null
8184
&& Directory.Exists(_workspaceService.WorkspacePath))
8285
{
86+
this._logger.LogTrace($"Setting CWD (from workspace) to {_workspaceService.WorkspacePath}");
8387
await _powerShellContextService.SetWorkingDirectoryAsync(
8488
_workspaceService.WorkspacePath,
8589
isPathAlreadyEscaped: false).ConfigureAwait(false);
90+
} else {
91+
this._logger.LogTrace("Tried to set CWD but in bad state");
8692
}
8793

8894
this._cwdSet = true;
@@ -95,20 +101,24 @@ await _powerShellContextService.SetWorkingDirectoryAsync(
95101
if (_configurationService.CurrentSettings.EnableProfileLoading
96102
&& (!this._profilesLoaded || !profileLoadingPreviouslyEnabled))
97103
{
104+
this._logger.LogTrace("Loading profiles...");
98105
await _powerShellContextService.LoadHostProfilesAsync().ConfigureAwait(false);
99106
this._profilesLoaded = true;
107+
this._logger.LogTrace("Loaded!");
100108
}
101109

102110
// Wait until after profiles are loaded (or not, if that's the
103111
// case) before starting the interactive console.
104112
if (!this._consoleReplStarted)
105113
{
106114
// Start the interactive terminal
115+
this._logger.LogTrace("Starting command loop");
107116
_powerShellContextService.ConsoleReader.StartCommandLoop();
108117
this._consoleReplStarted = true;
109118
}
110119

111120
// Run any events subscribed to configuration updates
121+
this._logger.LogTrace("Running configuration update event handlers");
112122
ConfigurationUpdated(this, _configurationService.CurrentSettings);
113123

114124
// Convert the editor file glob patterns into an array for the Workspace

0 commit comments

Comments
 (0)