@@ -43,6 +43,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
4343import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService' ;
4444import { IEnvironmentService } from 'vs/platform/environment/common/environment' ;
4545import { UNTITLED_WORKSPACE_NAME } from 'vs/platform/workspaces/common/workspaces' ;
46+ import { withUndefinedAsNull } from 'vs/base/common/types' ;
4647
4748// Commands
4849
@@ -349,7 +350,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
349350 }
350351} ) ;
351352
352- let globalResourceToCompare : URI | null ;
353+ let globalResourceToCompare : URI | undefined ;
353354let resourceSelectedForCompareContext : IContextKey < boolean > ;
354355CommandsRegistry . registerCommand ( {
355356 id : SELECT_FOR_COMPARE_COMMAND_ID ,
@@ -524,9 +525,9 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
524525 const editorService = accessor . get ( IEditorService ) ;
525526 let resource : URI | null = null ;
526527 if ( resourceOrObject && 'from' in resourceOrObject && resourceOrObject . from === 'menu' ) {
527- resource = toResource ( editorService . activeEditor ) ;
528+ resource = withUndefinedAsNull ( toResource ( editorService . activeEditor ) ) ;
528529 } else {
529- resource = getResourceForCommand ( resourceOrObject , accessor . get ( IListService ) , editorService ) ;
530+ resource = withUndefinedAsNull ( getResourceForCommand ( resourceOrObject , accessor . get ( IListService ) , editorService ) ) ;
530531 }
531532
532533 return save ( resource , true , undefined , editorService , accessor . get ( IFileService ) , accessor . get ( IUntitledEditorService ) , accessor . get ( ITextFileService ) , accessor . get ( IEditorGroupsService ) , accessor . get ( IWorkbenchEnvironmentService ) ) ;
0 commit comments