@@ -8,11 +8,11 @@ import { URI, UriComponents } from 'vs/base/common/uri';
88import { localize } from 'vs/nls' ;
99import { Action2 , MenuId } from 'vs/platform/actions/common/actions' ;
1010import { ICommandService } from 'vs/platform/commands/common/commands' ;
11- import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey' ;
1211import { IInstantiationService , ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
1312import { API_OPEN_DIFF_EDITOR_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands' ;
1413import { MergeEditorInput , MergeEditorInputData } from 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInput' ;
15- import { ctxIsMergeEditor , ctxMergeEditorLayout , MergeEditor } from 'vs/workbench/contrib/mergeEditor/browser/view/mergeEditor' ;
14+ import { MergeEditor } from 'vs/workbench/contrib/mergeEditor/browser/view/mergeEditor' ;
15+ import { ctxMergeEditorLayout , ctxIsMergeEditor } from 'vs/workbench/contrib/mergeEditor/common/mergeEditor' ;
1616import { IEditorService } from 'vs/workbench/services/editor/common/editorService' ;
1717
1818export class OpenMergeEditor extends Action2 {
@@ -112,13 +112,14 @@ export class SetMixedLayout extends Action2 {
112112 super ( {
113113 id : 'merge.mixedLayout' ,
114114 title : localize ( 'layout.mixed' , "Mixed Layout" ) ,
115- toggled : ContextKeyExpr . equals ( ctxMergeEditorLayout . key , 'mixed' ) ,
115+ toggled : ctxMergeEditorLayout . isEqualTo ( 'mixed' ) ,
116116 menu : [ {
117117 id : MenuId . EditorTitle ,
118118 when : ctxIsMergeEditor ,
119119 group : '1_merge' ,
120120 order : 9 ,
121- } ]
121+ } ] ,
122+ precondition : ctxIsMergeEditor ,
122123 } ) ;
123124 }
124125
@@ -135,13 +136,14 @@ export class SetColumnLayout extends Action2 {
135136 super ( {
136137 id : 'merge.columnLayout' ,
137138 title : localize ( 'layout.column' , "Column Layout" ) ,
138- toggled : ContextKeyExpr . equals ( ctxMergeEditorLayout . key , 'columns' ) ,
139+ toggled : ctxMergeEditorLayout . isEqualTo ( 'columns' ) ,
139140 menu : [ {
140141 id : MenuId . EditorTitle ,
141142 when : ctxIsMergeEditor ,
142143 group : '1_merge' ,
143144 order : 10 ,
144- } ]
145+ } ] ,
146+ precondition : ctxIsMergeEditor ,
145147 } ) ;
146148 }
147149
@@ -166,6 +168,7 @@ export class GoToNextConflict extends Action2 {
166168 group : 'navigation' ,
167169 } ] ,
168170 f1 : true ,
171+ precondition : ctxIsMergeEditor ,
169172 } ) ;
170173 }
171174
@@ -190,6 +193,7 @@ export class GoToPreviousConflict extends Action2 {
190193 group : 'navigation' ,
191194 } ] ,
192195 f1 : true ,
196+ precondition : ctxIsMergeEditor ,
193197 } ) ;
194198 }
195199
@@ -208,6 +212,7 @@ export class ToggleActiveConflictInput1 extends Action2 {
208212 category : localize ( 'mergeEditor' , "Merge Editor" ) ,
209213 title : localize ( 'merge.toggleActiveConflictInput1' , "Toggle Active Conflict In Input 1" ) ,
210214 f1 : true ,
215+ precondition : ctxIsMergeEditor ,
211216 } ) ;
212217 }
213218
@@ -230,6 +235,7 @@ export class ToggleActiveConflictInput2 extends Action2 {
230235 category : localize ( 'mergeEditor' , "Merge Editor" ) ,
231236 title : localize ( 'merge.toggleActiveConflictInput2' , "Toggle Active Conflict In Input 2" ) ,
232237 f1 : true ,
238+ precondition : ctxIsMergeEditor ,
233239 } ) ;
234240 }
235241
@@ -252,6 +258,7 @@ export class CompareInput1WithBaseCommand extends Action2 {
252258 category : localize ( 'mergeEditor' , "Merge Editor" ) ,
253259 title : localize ( 'mergeEditor.compareInput1WithBase' , "Compare Input 1 With Base" ) ,
254260 f1 : true ,
261+ precondition : ctxIsMergeEditor ,
255262 } ) ;
256263 }
257264 run ( accessor : ServicesAccessor , ...args : unknown [ ] ) : void {
@@ -268,6 +275,7 @@ export class CompareInput2WithBaseCommand extends Action2 {
268275 category : localize ( 'mergeEditor' , "Merge Editor" ) ,
269276 title : localize ( 'mergeEditor.compareInput2WithBase' , "Compare Input 2 With Base" ) ,
270277 f1 : true ,
278+ precondition : ctxIsMergeEditor ,
271279 } ) ;
272280 }
273281 run ( accessor : ServicesAccessor , ...args : unknown [ ] ) : void {
0 commit comments