Skip to content

Commit 5cdfd8a

Browse files
Apply suggestions from code review
Co-authored-by: Robert Holt <[email protected]>
1 parent 8d0aec3 commit 5cdfd8a

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

src/PowerShellEditorServices/Services/Analysis/AnalysisService.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,8 @@ public async Task<string> GetCommentHelpText(string functionText, string helpLoc
225225
/// <returns>A threadsafe readonly dictionary of the code actions of the particular file.</returns>
226226
public async Task<IReadOnlyDictionary<string, MarkerCorrection>> GetMostRecentCodeActionsForFileAsync(DocumentUri uri)
227227
{
228-
ScriptFile file = null;
229-
if (!_workspaceService.TryGetFile(uri, out file))
230-
{
231-
return null;
232-
}
233-
234-
if (!_mostRecentCorrectionsByFile.TryGetValue(file, out CorrectionTableEntry corrections))
228+
if (!_workspaceService.TryGetFile(uri, out ScriptFile file)
229+
|| !_mostRecentCorrectionsByFile.TryGetValue(file, out CorrectionTableEntry corrections))
235230
{
236231
return null;
237232
}

src/PowerShellEditorServices/Services/TextDocument/Handlers/CodeActionHandler.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ public override async Task<CommandOrCodeActionContainer> Handle(CodeActionParams
5757
return Array.Empty<CommandOrCodeAction>();
5858
}
5959

60-
IReadOnlyDictionary<string, MarkerCorrection> corrections = await
61-
_analysisService.GetMostRecentCodeActionsForFileAsync(request.TextDocument.Uri).ConfigureAwait(false);
60+
IReadOnlyDictionary<string, MarkerCorrection> corrections = await _analysisService.GetMostRecentCodeActionsForFileAsync(
61+
request.TextDocument.Uri)
62+
.ConfigureAwait(false);
6263

6364
if (corrections == null)
6465
{

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,13 @@ await _powerShellContextService.SetWorkingDirectoryAsync(
156156

157157
private void SendFeatureChangesTelemetry(LanguageServerSettingsWrapper incomingSettings)
158158
{
159-
var configChanges = new Dictionary<string, bool>();
160-
if (incomingSettings == null)
159+
if (incomingSettings is null)
161160
{
162161
this._logger.LogTrace("Incoming settings were null");
163162
return;
164163
}
165164

165+
var configChanges = new Dictionary<string, bool>();
166166
// Send telemetry if the user opted-out of ScriptAnalysis
167167
if (incomingSettings.Powershell.ScriptAnalysis.Enable == false &&
168168
_configurationService.CurrentSettings.ScriptAnalysis.Enable != incomingSettings.Powershell.ScriptAnalysis.Enable)

0 commit comments

Comments
 (0)