Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public async Task<IReadOnlyDictionary<string, IEnumerable<MarkerCorrection>>> Ge
/// </summary>
/// <param name="file">The file to clear markers in.</param>
/// <returns>A task that ends when all markers in the file have been cleared.</returns>
public void ClearMarkers(ScriptFile file) => PublishScriptDiagnostics(file, Array.Empty<ScriptFileMarker>());
public void ClearMarkers(ScriptFile file) => PublishScriptDiagnostics(file, new List<ScriptFileMarker>());

/// <summary>
/// Event subscription method to be run when PSES configuration has been updated.
Expand Down Expand Up @@ -384,8 +384,11 @@ internal async Task DelayThenInvokeDiagnosticsAsync(ScriptFile[] filesToAnalyze,

private void PublishScriptDiagnostics(ScriptFile scriptFile) => PublishScriptDiagnostics(scriptFile, scriptFile.DiagnosticMarkers);

private void PublishScriptDiagnostics(ScriptFile scriptFile, IReadOnlyList<ScriptFileMarker> markers)
private void PublishScriptDiagnostics(ScriptFile scriptFile, List<ScriptFileMarker> markers)
{
// NOTE: Sometimes we have null markers for reasons we don't yet know, but we need to
// remove them.
_ = markers.RemoveAll(m => m is null);
Diagnostic[] diagnostics = new Diagnostic[markers.Count];

CorrectionTableEntry fileCorrections = _mostRecentCorrectionsByFile.GetOrAdd(
Expand Down