@@ -16,13 +16,12 @@ public class TableDataSource : ITableDataSource
1616 /// <summary>
1717 /// Creates a new instance
1818 /// </summary>
19- /// <param name="identifier">A unique string. It's often the name of the extension itself.</param>
20- /// <param name="displayName">A unique string. It's often the name of the extension itself.</param>
21- public TableDataSource ( string identifier , string displayName )
19+ /// <param name="name">A unique string. It's often the name of the extension itself.</param>
20+ public TableDataSource ( string name )
2221 {
2322 ThreadHelper . ThrowIfNotOnUIThread ( ) ;
24- Identifier = identifier ;
25- DisplayName = displayName ;
23+ Identifier = name ;
24+ DisplayName = name ;
2625 Initialize ( ) ;
2726 }
2827
@@ -41,17 +40,17 @@ public TableDataSource(string identifier, string displayName)
4140 /// </summary>
4241 public virtual IReadOnlyCollection < string > Columns { get ; } = new [ ]
4342 {
44- StandardTableColumnDefinitions . DetailsExpander ,
45- StandardTableColumnDefinitions . ErrorCategory ,
46- StandardTableColumnDefinitions . ErrorSeverity ,
47- StandardTableColumnDefinitions . ErrorCode ,
48- StandardTableColumnDefinitions . ErrorSource ,
49- StandardTableColumnDefinitions . BuildTool ,
50- StandardTableColumnDefinitions . Text ,
51- StandardTableColumnDefinitions . DocumentName ,
52- StandardTableColumnDefinitions . Line ,
53- StandardTableColumnDefinitions . Column
54- } ;
43+ StandardTableColumnDefinitions . DetailsExpander ,
44+ StandardTableColumnDefinitions . ErrorCategory ,
45+ StandardTableColumnDefinitions . ErrorSeverity ,
46+ StandardTableColumnDefinitions . ErrorCode ,
47+ StandardTableColumnDefinitions . ErrorSource ,
48+ StandardTableColumnDefinitions . BuildTool ,
49+ StandardTableColumnDefinitions . Text ,
50+ StandardTableColumnDefinitions . DocumentName ,
51+ StandardTableColumnDefinitions . Line ,
52+ StandardTableColumnDefinitions . Column
53+ } ;
5554
5655 /// <inheritdoc/>
5756 public string SourceTypeIdentifier => StandardTableDataSources . ErrorTableDataSource ;
@@ -127,24 +126,32 @@ private void UpdateAllSinks()
127126 /// <summary>
128127 /// Adds errors to the applicable snapshots.
129128 /// </summary>
130- /// <param name="projectName"></param>
131- /// <param name="errors"></param>
132- public void AddErrors ( string projectName , IEnumerable < ErrorListItem > errors )
129+ public void AddErrors ( IEnumerable < ErrorListItem > errors )
133130 {
134131 if ( errors == null || ! errors . Any ( ) )
135132 {
136133 return ;
137134 }
138135
136+ string ? projectName = errors . FirstOrDefault ( e => ! string . IsNullOrEmpty ( e . ProjectName ) ) ? . ProjectName ?? "" ;
137+
139138 IEnumerable < ErrorListItem > cleanErrors = errors . Where ( e => e != null && ! string . IsNullOrEmpty ( e . FileName ) ) ;
140139
141140 lock ( _snapshots )
142141 {
143- foreach ( IGrouping < string ? , ErrorListItem > ? error in cleanErrors . GroupBy ( e => e . FileName ) )
142+ foreach ( IGrouping < string ? , ErrorListItem > ? fileErrorMap in cleanErrors . GroupBy ( e => e . FileName ) )
144143 {
145- if ( error . Key != null )
144+ if ( fileErrorMap . Key != null )
146145 {
147- _snapshots [ error . Key ] = new TableEntriesSnapshot ( projectName , error . Key , error ) ;
146+ if ( _snapshots . ContainsKey ( fileErrorMap . Key ) )
147+ {
148+ IEnumerable < ErrorListItem > values = cleanErrors . Where ( e => e . FileName == fileErrorMap . Key ) ;
149+ _snapshots [ fileErrorMap . Key ] . Update ( values ) ;
150+ }
151+ else
152+ {
153+ _snapshots [ fileErrorMap . Key ] = new TableEntriesSnapshot ( projectName , fileErrorMap . Key , fileErrorMap ) ;
154+ }
148155 }
149156 }
150157 }
0 commit comments