-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support view type for creating new untitled file. #100034
Conversation
src/vs/workbench/contrib/files/browser/fileActions.contribution.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/files/browser/fileActions.contribution.ts
Outdated
Show resolved
Hide resolved
registry.registerWorkbenchAction(SyncActionDescriptor.from(CompareWithClipboardAction, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_C) }), 'File: Compare Active File with Clipboard', category.value); | ||
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleAutoSaveAction), 'File: Toggle Auto Save', category.value); | ||
registry.registerWorkbenchAction(SyncActionDescriptor.from(ShowOpenedFileInNewWindow, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_O) }), 'File: Open Active File in New Window', category.value); | ||
|
||
MenuRegistry.addCommand({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit confusing to me, shouldn't this move to the // Commands
section and be CommandsRegistry.registerCommand
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand, isn't this command already registered via KeybindingsRegistry.registerCommandAndKeybindingRule
…n.ts Co-authored-by: Benjamin Pasero <benjpas@microsoft.com>
@@ -61,6 +60,11 @@ if (isMacintosh) { | |||
// Commands | |||
CommandsRegistry.registerCommand('_files.windowOpen', openWindowCommand); | |||
CommandsRegistry.registerCommand('_files.newWindow', newWindowCommand); | |||
MenuRegistry.addCommand({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I registered this command to MenuRegistry as it's part of registerWorkbenchAction
, which consists of
CommandsRegistry.registerCommand
KeybindingsRegistry.registerKeybindingRule
MenuRegistry.addCommand
MenuRegistry.appendMenuItem
I'm not 100% sure of the intention of holding a cache of commands in the MenuRegistry and MenuRegistry.getCommand
is used in quite a few places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove the call to MenuRegistry.addCommand
as I do not understand it. I also think that Jo has a way to contribute actions all in one go.
export function registerAction2(ctor: { new(): Action2 }): IDisposable { |
The PR makes opening an untitled custom/notebook editor possible. It includes two sets of changes
GlobalNewUntitledFileAction
to commandNEW_UNTITLED_FILE_COMMAND_ID
registerWorkbenchAction
is replaced byMenuRegistry.addCommand
,MenuRegistry.appendMenuItem
andappendToCommandPalette
. @bpasero can you confirm if it's all I need to do?viewType
for the command. This one is straightforward and doesn't affect existingCtrl/Cmd+N
experience.