@@ -199,10 +199,13 @@ export class ResultsProvider implements vscode.TreeDataProvider<ResultItem> {
199199 // Map severity to VS Code diagnostic severity
200200 const severity = this . mapToVSCodeSeverity ( result . severity ) ;
201201
202- // Create diagnostic with detailed message
203- const flowInfo = result . flowSteps && result . flowSteps . length > 0
204- ? ` (${ result . flowSteps . length } flow steps)`
205- : '' ;
202+ // Create diagnostic with detailed message including last flow step info
203+ let flowInfo = '' ;
204+ if ( result . flowSteps && result . flowSteps . length > 0 ) {
205+ const lastStep = result . flowSteps [ result . flowSteps . length - 1 ] ;
206+ const sinkFile = lastStep . file . split ( '/' ) . pop ( ) || 'unknown' ;
207+ flowInfo = ` (${ result . flowSteps . length } flow steps → ${ sinkFile } :${ lastStep . startLine } )` ;
208+ }
206209 const message = `[${ result . severity ?. toUpperCase ( ) } ] ${ result . ruleId } : ${ result . message } ${ flowInfo } ` ;
207210 const diagnostic = new vscode . Diagnostic ( range , message , severity ) ;
208211
@@ -212,18 +215,40 @@ export class ResultsProvider implements vscode.TreeDataProvider<ResultItem> {
212215
213216 // Add related information for flow steps
214217 if ( result . flowSteps && result . flowSteps . length > 0 ) {
215- diagnostic . relatedInformation = result . flowSteps . map ( ( step , index ) => {
218+ const relatedInfo : vscode . DiagnosticRelatedInformation [ ] = [ ] ;
219+
220+ // Add the sink (last step) first for visibility
221+ const lastStep = result . flowSteps [ result . flowSteps . length - 1 ] ;
222+ const sinkRange = new vscode . Range (
223+ Math . max ( 0 , lastStep . startLine - 1 ) ,
224+ Math . max ( 0 , lastStep . startColumn - 1 ) ,
225+ Math . max ( 0 , lastStep . endLine - 1 ) ,
226+ Math . max ( 0 , lastStep . endColumn - 1 )
227+ ) ;
228+ relatedInfo . push ( new vscode . DiagnosticRelatedInformation (
229+ new vscode . Location ( vscode . Uri . file ( lastStep . file ) , sinkRange ) ,
230+ `🎯 Sink (Step ${ result . flowSteps . length } )${ lastStep . message ? `: ${ lastStep . message } ` : '' } `
231+ ) ) ;
232+
233+ // Add all flow steps
234+ result . flowSteps . forEach ( ( step , index ) => {
216235 const stepRange = new vscode . Range (
217236 Math . max ( 0 , step . startLine - 1 ) ,
218237 Math . max ( 0 , step . startColumn - 1 ) ,
219238 Math . max ( 0 , step . endLine - 1 ) ,
220239 Math . max ( 0 , step . endColumn - 1 )
221240 ) ;
222- return new vscode . DiagnosticRelatedInformation (
241+ const isSource = index === 0 ;
242+ const isSink = index === result . flowSteps ! . length - 1 ;
243+ const stepLabel = isSource ? '🟢 Source' : isSink ? '🔴 Sink' : '🔵 Step' ;
244+
245+ relatedInfo . push ( new vscode . DiagnosticRelatedInformation (
223246 new vscode . Location ( vscode . Uri . file ( step . file ) , stepRange ) ,
224- `Flow step ${ index + 1 } ${ step . message ? `: ${ step . message } ` : '' } `
225- ) ;
247+ `${ stepLabel } ${ index + 1 } ${ step . message ? `: ${ step . message } ` : '' } `
248+ ) ) ;
226249 } ) ;
250+
251+ diagnostic . relatedInformation = relatedInfo ;
227252 }
228253
229254 // Get or create diagnostics array for this file
0 commit comments