File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,22 @@ export function webviewUriToFileUri(webviewUri: string): Uri {
8686 return Uri . file ( path ) ;
8787}
8888
89+ function sortInterpretedResults ( results : Sarif . Result [ ] , sortState : InterpretedResultsSortState ) : void {
90+ switch ( sortState . sortBy ) {
91+ case 'alert-message' :
92+ results . sort ( ( a , b ) =>
93+ a . message . text === undefined ? 0 :
94+ b . message . text === undefined ? 0 :
95+ a . message . text ?. localeCompare ( b . message . text ) ) ;
96+ break ;
97+ case 'file-position' :
98+ // default to the order found in the sarif file
99+ break ;
100+ default :
101+ assertNever ( sortState . sortBy ) ;
102+ }
103+ }
104+
89105export class InterfaceManager extends DisposableObject {
90106 private _displayedQuery ?: CompletedQuery ;
91107 private _panel : vscode . WebviewPanel | undefined ;
@@ -287,9 +303,11 @@ export class InterfaceManager extends DisposableObject {
287303 // or throw an error if we are in aggregate trying to send
288304 // massively too much data, as it can make the extension
289305 // unresponsive.
306+
290307 let numTruncatedResults = 0 ;
291308 sarif . runs . forEach ( run => {
292309 if ( run . results !== undefined ) {
310+ sortInterpretedResults ( run . results , sortState ) ;
293311 if ( run . results . length > INTERPRETED_RESULTS_PER_RUN_LIMIT ) {
294312 numTruncatedResults += run . results . length - INTERPRETED_RESULTS_PER_RUN_LIMIT ;
295313 run . results = run . results . slice ( 0 , INTERPRETED_RESULTS_PER_RUN_LIMIT ) ;
You can’t perform that action at this time.
0 commit comments