@@ -7,7 +7,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
77import * as nls from 'vs/nls' ;
88import { URI , UriComponents } from 'vs/base/common/uri' ;
99import { IEditorRegistry , EditorDescriptor , Extensions as EditorExtensions } from 'vs/workbench/browser/editor' ;
10- import { EditorInput , IEditorInputFactory , SideBySideEditorInput , IEditorInputFactoryRegistry , Extensions as EditorInputExtensions , TextCompareEditorActiveContext , EditorPinnedContext , EditorGroupEditorsCountContext , EditorStickyContext , ActiveEditorAvailableEditorIdsContext , MultipleEditorGroupsContext } from 'vs/workbench/common/editor' ;
10+ import { EditorInput , IEditorInputFactory , SideBySideEditorInput , IEditorInputFactoryRegistry , Extensions as EditorInputExtensions , TextCompareEditorActiveContext , ActiveEditorPinnedContext , EditorGroupEditorsCountContext , ActiveEditorStickyContext , ActiveEditorAvailableEditorIdsContext , MultipleEditorGroupsContext , ActiveEditorDirtyContext } from 'vs/workbench/common/editor' ;
1111import { TextResourceEditor } from 'vs/workbench/browser/parts/editor/textResourceEditor' ;
1212import { SideBySideEditor } from 'vs/workbench/browser/parts/editor/sideBySideEditor' ;
1313import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput' ;
@@ -447,9 +447,9 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCo
447447MenuRegistry . appendMenuItem ( MenuId . EditorTitleContext , { command : { id : editorCommands . CLOSE_SAVED_EDITORS_COMMAND_ID , title : nls . localize ( 'closeAllSaved' , "Close Saved" ) } , group : '1_close' , order : 40 } ) ;
448448MenuRegistry . appendMenuItem ( MenuId . EditorTitleContext , { command : { id : editorCommands . CLOSE_EDITORS_IN_GROUP_COMMAND_ID , title : nls . localize ( 'closeAll' , "Close All" ) } , group : '1_close' , order : 50 } ) ;
449449MenuRegistry . appendMenuItem ( MenuId . EditorTitleContext , { command : { id : ReopenResourcesAction . ID , title : ReopenResourcesAction . LABEL } , group : '1_open' , order : 10 , when : ActiveEditorAvailableEditorIdsContext } ) ;
450- MenuRegistry . appendMenuItem ( MenuId . EditorTitleContext , { command : { id : editorCommands . KEEP_EDITOR_COMMAND_ID , title : nls . localize ( 'keepOpen' , "Keep Open" ) , precondition : EditorPinnedContext . toNegated ( ) } , group : '3_preview' , order : 10 , when : ContextKeyExpr . has ( 'config.workbench.editor.enablePreview' ) } ) ;
451- MenuRegistry . appendMenuItem ( MenuId . EditorTitleContext , { command : { id : editorCommands . PIN_EDITOR_COMMAND_ID , title : nls . localize ( 'pin' , "Pin" ) } , group : '3_preview' , order : 20 , when : ContextKeyExpr . and ( EditorStickyContext . toNegated ( ) , ContextKeyExpr . has ( 'config.workbench.editor.showTabs' ) ) } ) ;
452- MenuRegistry . appendMenuItem ( MenuId . EditorTitleContext , { command : { id : editorCommands . UNPIN_EDITOR_COMMAND_ID , title : nls . localize ( 'unpin' , "Unpin" ) } , group : '3_preview' , order : 20 , when : ContextKeyExpr . and ( EditorStickyContext , ContextKeyExpr . has ( 'config.workbench.editor.showTabs' ) ) } ) ;
450+ MenuRegistry . appendMenuItem ( MenuId . EditorTitleContext , { command : { id : editorCommands . KEEP_EDITOR_COMMAND_ID , title : nls . localize ( 'keepOpen' , "Keep Open" ) , precondition : ActiveEditorPinnedContext . toNegated ( ) } , group : '3_preview' , order : 10 , when : ContextKeyExpr . has ( 'config.workbench.editor.enablePreview' ) } ) ;
451+ MenuRegistry . appendMenuItem ( MenuId . EditorTitleContext , { command : { id : editorCommands . PIN_EDITOR_COMMAND_ID , title : nls . localize ( 'pin' , "Pin" ) } , group : '3_preview' , order : 20 , when : ActiveEditorStickyContext . toNegated ( ) } ) ;
452+ MenuRegistry . appendMenuItem ( MenuId . EditorTitleContext , { command : { id : editorCommands . UNPIN_EDITOR_COMMAND_ID , title : nls . localize ( 'unpin' , "Unpin" ) } , group : '3_preview' , order : 20 , when : ActiveEditorStickyContext } ) ;
453453MenuRegistry . appendMenuItem ( MenuId . EditorTitleContext , { command : { id : editorCommands . SPLIT_EDITOR_UP , title : nls . localize ( 'splitUp' , "Split Up" ) } , group : '5_split' , order : 10 } ) ;
454454MenuRegistry . appendMenuItem ( MenuId . EditorTitleContext , { command : { id : editorCommands . SPLIT_EDITOR_DOWN , title : nls . localize ( 'splitDown' , "Split Down" ) } , group : '5_split' , order : 20 } ) ;
455455MenuRegistry . appendMenuItem ( MenuId . EditorTitleContext , { command : { id : editorCommands . SPLIT_EDITOR_LEFT , title : nls . localize ( 'splitLeft' , "Split Left" ) } , group : '5_split' , order : 30 } ) ;
@@ -518,14 +518,14 @@ appendEditorToolItem(
518518 }
519519) ;
520520
521- // Editor Title Menu: Close Group (tabs disabled)
521+ // Editor Title Menu: Close (tabs disabled, dirty editor )
522522appendEditorToolItem (
523523 {
524524 id : editorCommands . CLOSE_EDITOR_COMMAND_ID ,
525525 title : nls . localize ( 'close' , "Close" ) ,
526- icon : { id : 'codicon/close' }
526+ icon : { id : 'codicon/close-dirty ' }
527527 } ,
528- ContextKeyExpr . and ( ContextKeyExpr . not ( 'config.workbench.editor.showTabs' ) , ContextKeyExpr . not ( 'activeEditorIsDirty' ) ) ,
528+ ContextKeyExpr . and ( ContextKeyExpr . not ( 'config.workbench.editor.showTabs' ) , ActiveEditorDirtyContext ) ,
529529 1000000 , // towards the far end
530530 {
531531 id : editorCommands . CLOSE_EDITORS_IN_GROUP_COMMAND_ID ,
@@ -534,13 +534,30 @@ appendEditorToolItem(
534534 }
535535) ;
536536
537+ // Editor Title Menu: Close (tabs disabled, sticky editor)
537538appendEditorToolItem (
539+ {
540+ id : editorCommands . UNPIN_EDITOR_COMMAND_ID ,
541+ title : nls . localize ( 'unpin' , "Unpin" ) ,
542+ icon : { id : 'codicon/pinned' }
543+ } ,
544+ ContextKeyExpr . and ( ContextKeyExpr . not ( 'config.workbench.editor.showTabs' ) , ActiveEditorDirtyContext . toNegated ( ) , ActiveEditorStickyContext ) ,
545+ 1000000 , // towards the far end
538546 {
539547 id : editorCommands . CLOSE_EDITOR_COMMAND_ID ,
540548 title : nls . localize ( 'close' , "Close" ) ,
541- icon : { id : 'codicon/close-dirty' }
549+ icon : { id : 'codicon/close' }
550+ }
551+ ) ;
552+
553+ // Editor Title Menu: Unpin (tabs disabled, normal editor)
554+ appendEditorToolItem (
555+ {
556+ id : editorCommands . CLOSE_EDITOR_COMMAND_ID ,
557+ title : nls . localize ( 'close' , "Close" ) ,
558+ icon : { id : 'codicon/close' }
542559 } ,
543- ContextKeyExpr . and ( ContextKeyExpr . not ( 'config.workbench.editor.showTabs' ) , ContextKeyExpr . has ( 'activeEditorIsDirty' ) ) ,
560+ ContextKeyExpr . and ( ContextKeyExpr . not ( 'config.workbench.editor.showTabs' ) , ActiveEditorDirtyContext . toNegated ( ) , ActiveEditorStickyContext . toNegated ( ) ) ,
544561 1000000 , // towards the far end
545562 {
546563 id : editorCommands . CLOSE_EDITORS_IN_GROUP_COMMAND_ID ,
@@ -596,8 +613,10 @@ appendEditorToolItem(
596613// Editor Commands for Command Palette
597614const viewCategory = { value : nls . localize ( 'view' , "View" ) , original : 'View' } ;
598615MenuRegistry . appendMenuItem ( MenuId . CommandPalette , { command : { id : editorCommands . KEEP_EDITOR_COMMAND_ID , title : { value : nls . localize ( 'keepEditor' , "Keep Editor" ) , original : 'Keep Editor' } , category : viewCategory } , when : ContextKeyExpr . has ( 'config.workbench.editor.enablePreview' ) } ) ;
599- MenuRegistry . appendMenuItem ( MenuId . CommandPalette , { command : { id : editorCommands . PIN_EDITOR_COMMAND_ID , title : { value : nls . localize ( 'pinEditor' , "Pin Editor" ) , original : 'Pin Editor' } , category : viewCategory } , when : ContextKeyExpr . has ( 'config.workbench.editor.showTabs' ) } ) ;
600- MenuRegistry . appendMenuItem ( MenuId . CommandPalette , { command : { id : editorCommands . UNPIN_EDITOR_COMMAND_ID , title : { value : nls . localize ( 'unpinEditor' , "Unpin Editor" ) , original : 'Unpin Editor' } , category : viewCategory } , when : ContextKeyExpr . has ( 'config.workbench.editor.showTabs' ) } ) ;
616+ MenuRegistry . appendMenuItem ( MenuId . CommandPalette , { command : { id : editorCommands . PIN_EDITOR_COMMAND_ID , title : { value : nls . localize ( 'pinEditor' , "Pin Editor" ) , original : 'Pin Editor' } , category : viewCategory } } ) ;
617+ MenuRegistry . appendMenuItem ( MenuId . CommandPalette , { command : { id : editorCommands . UNPIN_EDITOR_COMMAND_ID , title : { value : nls . localize ( 'unpinEditor' , "Unpin Editor" ) , original : 'Unpin Editor' } , category : viewCategory } } ) ;
618+ MenuRegistry . appendMenuItem ( MenuId . CommandPalette , { command : { id : editorCommands . CLOSE_EDITOR_COMMAND_ID , title : { value : nls . localize ( 'closeEditor' , "Close Editor" ) , original : 'Close Editor' } , category : viewCategory } } ) ;
619+ MenuRegistry . appendMenuItem ( MenuId . CommandPalette , { command : { id : editorCommands . CLOSE_PINNED_EDITOR_COMMAND_ID , title : { value : nls . localize ( 'closePinnedEditor' , "Close Pinned Editor" ) , original : 'Close Pinned Editor' } , category : viewCategory } } ) ;
601620MenuRegistry . appendMenuItem ( MenuId . CommandPalette , { command : { id : editorCommands . CLOSE_EDITORS_IN_GROUP_COMMAND_ID , title : { value : nls . localize ( 'closeEditorsInGroup' , "Close All Editors in Group" ) , original : 'Close All Editors in Group' } , category : viewCategory } } ) ;
602621MenuRegistry . appendMenuItem ( MenuId . CommandPalette , { command : { id : editorCommands . CLOSE_SAVED_EDITORS_COMMAND_ID , title : { value : nls . localize ( 'closeSavedEditors' , "Close Saved Editors in Group" ) , original : 'Close Saved Editors in Group' } , category : viewCategory } } ) ;
603622MenuRegistry . appendMenuItem ( MenuId . CommandPalette , { command : { id : editorCommands . CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID , title : { value : nls . localize ( 'closeOtherEditors' , "Close Other Editors in Group" ) , original : 'Close Other Editors in Group' } , category : viewCategory } } ) ;
0 commit comments