@@ -49,6 +49,7 @@ export interface SuggestionInformation {
4949
5050export class ReviewCommentController extends CommentControllerBase implements CommentHandler , vscode . CommentingRangeProvider2 , CommentReactionHandler {
5151 private static readonly ID = 'ReviewCommentController' ;
52+ private static readonly PREFIX = 'github-review' ;
5253 private _commentHandlerId : string ;
5354
5455 // Note: marked as protected so that tests can verify caches have been updated correctly without breaking type safety
@@ -73,7 +74,7 @@ export class ReviewCommentController extends CommentControllerBase implements Co
7374 super ( folderRepoManager , telemetry ) ;
7475 this . _context = this . _folderRepoManager . context ;
7576 this . _commentController = this . _register ( vscode . comments . createCommentController (
76- `github-review -${ folderRepoManager . activePullRequest ?. remote . owner } -${ folderRepoManager . activePullRequest ?. remote . owner } -${ folderRepoManager . activePullRequest ! . number } ` ,
77+ `${ ReviewCommentController . PREFIX } -${ folderRepoManager . activePullRequest ?. remote . owner } -${ folderRepoManager . activePullRequest ?. remote . owner } -${ folderRepoManager . activePullRequest ! . number } ` ,
7778 vscode . l10n . t ( 'Pull Request ({0})' , folderRepoManager . activePullRequest ! . title ) ,
7879 ) ) ;
7980 this . _commentController . commentingRangeProvider = this as vscode . CommentingRangeProvider ;
@@ -345,7 +346,6 @@ export class ReviewCommentController extends CommentControllerBase implements Co
345346 this . updateResourcesWithCommentingRanges ( ) ;
346347 } ) ,
347348 ) ;
348- this . _register ( vscode . window . onDidChangeActiveTextEditor ( e => this . onDidChangeActiveTextEditor ( e ) ) ) ;
349349 }
350350
351351 private _findMatchingThread ( thread : IReviewThread ) : { threadMap : { [ key : string ] : GHPRCommentThread [ ] } , index : number } {
@@ -371,9 +371,19 @@ export class ReviewCommentController extends CommentControllerBase implements Co
371371 }
372372
373373 private _commentContentChangedListener : vscode . Disposable | undefined ;
374- private onDidChangeActiveTextEditor ( editor : vscode . TextEditor | undefined ) {
374+ protected onDidChangeActiveTextEditor ( editor : vscode . TextEditor | undefined ) {
375375 this . _commentContentChangedListener ?. dispose ( ) ;
376376 this . _commentContentChangedListener = undefined ;
377+
378+ const activeTab = vscode . window . tabGroups . activeTabGroup . activeTab ;
379+ const activeUri = activeTab ?. input instanceof vscode . TabInputText ? activeTab . input . uri : ( activeTab ?. input instanceof vscode . TabInputTextDiff ? activeTab . input . modified : undefined ) ;
380+
381+ if ( editor && activeUri && editor . document . uri . authority . startsWith ( ReviewCommentController . PREFIX ) && ( activeUri . scheme === Schemes . File ) ) {
382+ if ( this . _folderRepoManager . activePullRequest && activeUri . toString ( ) . startsWith ( this . _repository . rootUri . toString ( ) ) ) {
383+ this . tryAddCopilotMention ( editor , this . _folderRepoManager . activePullRequest ) ;
384+ }
385+ }
386+
377387 if ( editor ?. document . uri . scheme !== Schemes . Comment ) {
378388 return ;
379389 }
0 commit comments