Skip to content

Commit 5d5d7bc

Browse files
committed
Use Array.Empty instead of new []
1 parent b6571a5 commit 5d5d7bc

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ internal class DebugService
2828

2929
private const string PsesGlobalVariableNamePrefix = "__psEditorServices_";
3030
private const string TemporaryScriptFileName = "Script Listing.ps1";
31-
private readonly BreakpointDetails[] s_emptyBreakpointDetailsArray = new BreakpointDetails[0];
3231

3332
private readonly ILogger logger;
3433
private readonly PowerShellContextService powerShellContext;
@@ -150,7 +149,7 @@ public async Task<BreakpointDetails[]> SetLineBreakpointsAsync(
150149
this.logger.LogTrace(
151150
$"Could not set breakpoints for local path '{scriptPath}' in a remote session.");
152151

153-
return s_emptyBreakpointDetailsArray;
152+
return Array.Empty<BreakpointDetails>();
154153
}
155154

156155
string mappedPath =
@@ -167,7 +166,7 @@ public async Task<BreakpointDetails[]> SetLineBreakpointsAsync(
167166
this.logger.LogTrace(
168167
$"Could not set breakpoint on temporary script listing path '{scriptPath}'.");
169168

170-
return s_emptyBreakpointDetailsArray;
169+
return Array.Empty<BreakpointDetails>();
171170
}
172171

173172
// Fix for issue #123 - file paths that contain wildcard chars [ and ] need to
@@ -216,7 +215,7 @@ await _breakpointService.RemoveBreakpointsAsync(
216215
resultBreakpointDetails = (await _breakpointService.SetCommandBreakpoints(breakpoints).ConfigureAwait(false)).ToArray();
217216
}
218217

219-
return resultBreakpointDetails ?? new CommandBreakpointDetails[0];
218+
return resultBreakpointDetails ?? Array.Empty<CommandBreakpointDetails>();
220219
}
221220

222221
/// <summary>

test/PowerShellEditorServices.Test/Session/WorkspaceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ internal static WorkspaceService FixturesWorkspace()
5353

5454
// These are the default values for the EnumeratePSFiles() method
5555
// in Microsoft.PowerShell.EditorServices.Workspace class
56-
private static string[] s_defaultExcludeGlobs = new string[0];
56+
private static string[] s_defaultExcludeGlobs = Array.Empty<string>();
5757
private static string[] s_defaultIncludeGlobs = new [] { "**/*" };
5858
private static int s_defaultMaxDepth = 64;
5959
private static bool s_defaultIgnoreReparsePoints = false;

0 commit comments

Comments
 (0)