@@ -116,19 +116,26 @@ export class DisplayIssuesTool extends ToolBase<DisplayIssuesParameters> {
116116 } ) . join ( ' | ' ) } |`;
117117 }
118118
119+ private foundIssuesCount ( params : DisplayIssuesParameters ) : number {
120+ return params . totalIssues !== undefined ? params . totalIssues : params . arrayOfIssues . length ;
121+ }
122+
119123 async prepareInvocation ( options : vscode . LanguageModelToolInvocationPrepareOptions < DisplayIssuesParameters > ) : Promise < vscode . PreparedToolInvocation > {
124+ const maxDisplay = 10 ;
125+ const foundIssuesCount = this . foundIssuesCount ( options . parameters ) ;
126+ const actualDisplay = Math . min ( maxDisplay , foundIssuesCount ) ;
120127 return {
121- invocationMessage : vscode . l10n . t ( 'Found {0} issues. Generating a markdown table of the first 10 ' , options . parameters . totalIssues )
128+ invocationMessage : vscode . l10n . t ( 'Found {0} issues. Generating a markdown table of the first {1} ' , foundIssuesCount , actualDisplay )
122129 } ;
123130 }
124131
125132 async invoke ( options : vscode . LanguageModelToolInvocationOptions < DisplayIssuesParameters > , token : vscode . CancellationToken ) : Promise < vscode . LanguageModelToolResult | undefined > {
126- let issueItemsInfo : vscode . LanguageModelTextPart | undefined = this . chatParticipantState . firstUserMessage ;
133+ const issueItemsInfo : vscode . LanguageModelTextPart | undefined = this . chatParticipantState . firstUserMessage ;
127134 const issueItems : IssueSearchResultItem [ ] = options . parameters . arrayOfIssues ;
128135 if ( issueItems . length === 0 ) {
129136 return new vscode . LanguageModelToolResult ( [ new vscode . LanguageModelTextPart ( vscode . l10n . t ( 'No issues found. Please try another query.' ) ) ] ) ;
130137 }
131- Logger . debug ( `Displaying ${ issueItems . length } issues, first issue ${ issueItems [ 0 ] . number } ` , DisplayIssuesTool . ID ) ;
138+ Logger . debug ( `Displaying ${ this . foundIssuesCount ( options . parameters ) } issues, first issue ${ issueItems [ 0 ] . number } ` , DisplayIssuesTool . ID ) ;
132139 const importantColumns = await this . getImportantColumns ( issueItemsInfo , issueItems , token ) ;
133140
134141 const titleRow = `| ${ importantColumns . join ( ' | ' ) } |` ;
0 commit comments