1
1
import { commands , TabInputTextDiff , TextEditor , Uri , window } from 'vscode' ;
2
- import { CommandContext , setCommandContext } from './constants' ;
2
+ import { CommandContext } from './constants' ;
3
+ import { Container } from './container' ;
3
4
4
5
interface CodeNormalizer {
5
6
isRelevant : ( u : Uri ) => boolean ;
@@ -8,6 +9,10 @@ interface CodeNormalizer {
8
9
9
10
const normalizers : CodeNormalizer [ ] = [ ] ;
10
11
12
+ function setCommandContext ( key : CommandContext | string , value : any ) {
13
+ return commands . executeCommand ( 'setContext' , key , value ) ;
14
+ }
15
+
11
16
const registerCodeNormalizer = ( normalizer : CodeNormalizer ) => {
12
17
if ( normalizers . indexOf ( normalizer ) < 0 ) {
13
18
normalizers . push ( normalizer ) ;
@@ -43,7 +48,12 @@ export const toggleDiffNormalize = () => {
43
48
const tab = window . tabGroups . activeTabGroup . activeTab ;
44
49
if ( tab ?. input instanceof TabInputTextDiff ) {
45
50
const { original, modified } = tab . input ;
46
- return commands . executeCommand < void > ( 'vscode.diff' , toggleNorm ( original ) , toggleNorm ( modified ) , tab . label ) ;
51
+ const controller = Container . bitbucketContext . prCommentController ;
52
+ const origN = toggleNorm ( original ) ;
53
+ const modifN = toggleNorm ( modified ) ;
54
+ controller . provideComments ( origN ) ;
55
+ controller . provideComments ( modifN ) ;
56
+ return commands . executeCommand < void > ( 'vscode.diff' , origN , modifN , tab . label ) ;
47
57
}
48
58
} catch ( error ) { }
49
59
return ;
0 commit comments