@@ -12,7 +12,7 @@ import { CommentReply, findActiveHandler, resolveCommentHandler } from './commen
12
12
import { COPILOT_LOGINS } from './common/copilot' ;
13
13
import { commands } from './common/executeCommands' ;
14
14
import Logger from './common/logger' ;
15
- import { FILE_LIST_LAYOUT , PR_SETTINGS_NAMESPACE } from './common/settingKeys' ;
15
+ import { CLOSE_ON_MARK_FILE_AS_VIEWED , FILE_LIST_LAYOUT , PR_SETTINGS_NAMESPACE } from './common/settingKeys' ;
16
16
import { editQuery } from './common/settingsUtils' ;
17
17
import { ITelemetry } from './common/telemetry' ;
18
18
import { asTempStorageURI , fromPRUri , fromReviewUri , Schemes , toPRUri } from './common/uri' ;
@@ -1366,18 +1366,23 @@ ${contents}
1366
1366
if ( treeNode instanceof FileChangeNode ) {
1367
1367
await treeNode . markFileAsViewed ( false ) ;
1368
1368
} else if ( treeNode ) {
1369
- // When the argument is a uri it came from the editor menu and we should also close the file
1370
- // Do the close first to improve perceived performance of marking as viewed.
1371
- const tab = vscode . window . tabGroups . activeTabGroup . activeTab ;
1372
- if ( tab ) {
1373
- let compareUri : vscode . Uri | undefined = undefined ;
1374
- if ( tab . input instanceof vscode . TabInputTextDiff ) {
1375
- compareUri = tab . input . modified ;
1376
- } else if ( tab . input instanceof vscode . TabInputText ) {
1377
- compareUri = tab . input . uri ;
1378
- }
1379
- if ( compareUri && treeNode . toString ( ) === compareUri . toString ( ) ) {
1380
- vscode . window . tabGroups . close ( tab ) ;
1369
+ // When the argument is a uri it came from the editor menu. By default we close the editor
1370
+ // after marking the file as viewed, but this can be controlled by a setting.
1371
+ const shouldCloseEditor = vscode . workspace . getConfiguration ( PR_SETTINGS_NAMESPACE )
1372
+ . get < boolean > ( CLOSE_ON_MARK_FILE_AS_VIEWED , true ) ;
1373
+ if ( shouldCloseEditor ) {
1374
+ // Do the close first to improve perceived performance of marking as viewed.
1375
+ const tab = vscode . window . tabGroups . activeTabGroup . activeTab ;
1376
+ if ( tab ) {
1377
+ let compareUri : vscode . Uri | undefined = undefined ;
1378
+ if ( tab . input instanceof vscode . TabInputTextDiff ) {
1379
+ compareUri = tab . input . modified ;
1380
+ } else if ( tab . input instanceof vscode . TabInputText ) {
1381
+ compareUri = tab . input . uri ;
1382
+ }
1383
+ if ( compareUri && treeNode . toString ( ) === compareUri . toString ( ) ) {
1384
+ vscode . window . tabGroups . close ( tab ) ;
1385
+ }
1381
1386
}
1382
1387
}
1383
1388
0 commit comments