@@ -1768,20 +1768,30 @@ ${contents}
17681768 }
17691769 } ) ) ;
17701770 context . subscriptions . push (
1771- vscode . commands . registerCommand ( 'pr.applySuggestionWithCopilot' , async ( comment : GHPRComment ) => {
1771+ vscode . commands . registerCommand ( 'pr.applySuggestionWithCopilot' , async ( comment : GHPRComment | GHPRCommentThread ) => {
17721772 /* __GDPR__
17731773 "pr.applySuggestionWithCopilot" : {}
17741774 */
17751775 telemetry . sendTelemetryEvent ( 'pr.applySuggestionWithCopilot' ) ;
17761776
1777- const commentThread = comment . parent ;
1777+ const isThread = GHPRCommentThread . is ( comment ) ;
1778+ const commentThread = isThread ? comment : comment . parent ;
1779+ const commentBody = isThread ? comment . comments [ 0 ] . body : comment . body ;
17781780 commentThread . collapsibleState = vscode . CommentThreadCollapsibleState . Collapsed ;
1779- const message = comment . body instanceof vscode . MarkdownString ? comment . body . value : comment . body ;
1780- await vscode . commands . executeCommand ( 'vscode.editorChat.start' , {
1781- initialRange : commentThread . range ,
1782- message : message ,
1783- autoSend : true ,
1784- } ) ;
1781+ const message = commentBody instanceof vscode . MarkdownString ? commentBody . value : commentBody ;
1782+
1783+ if ( isThread ) {
1784+ // For threads, open the Chat view instead of inline chat
1785+ await vscode . commands . executeCommand ( commands . NEW_CHAT , { inputValue : message , isPartialQuery : true , agentMode : true } ) ;
1786+
1787+ } else {
1788+ // For single comments, use inline chat
1789+ await vscode . commands . executeCommand ( 'vscode.editorChat.start' , {
1790+ initialRange : commentThread . range ,
1791+ message : message ,
1792+ autoSend : true ,
1793+ } ) ;
1794+ }
17851795 } )
17861796 ) ;
17871797 context . subscriptions . push (
0 commit comments