-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
Make WorkbenchActionRegistry just a forwarder #35528
Conversation
} | ||
*/ | ||
this.telemetryService.publicLog('workbenchActionExecuted', { id: action.id, from: 'status bar' }); | ||
(action.run() || TPromise.as(null)).done(() => { |
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.
@bpasero What's up with this workbenchActionExecuted
-event? Is its purpose really to only report workbench-actions? So, no editor commands, no extension commands, no other commands?
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.
@jrieken I would think that this telemetry event is logged for a) workbench actions, b) editor actions and c) contributed actions. The name is probably old and we never changed it but the data should be that.
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.
Great. In that case this was a bug.
|
||
return; | ||
} | ||
|
||
// Maintain old behaviour of always focusing the editor here | ||
const activeEditor = this.editorService.getActiveEditor(); | ||
const codeEditor = getCodeEditor(activeEditor); | ||
if (codeEditor) { | ||
codeEditor.focus(); |
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.
Not sure why we have it... Maybe because the command palette does that and because enablement of commands often depends on editor focus...
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.
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.
Well, the problem is that selecting something from the status bar takes/steels focus and that this means you cannot have things like 'comment line' in there. Not sure if they should find and focus an editor when executed...
|
||
return entries; | ||
} | ||
|
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 wanna get rid of these things
src/vs/workbench/common/actions.ts
Outdated
return null; | ||
} else { | ||
return title.original; | ||
} | ||
} |
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 believe these two methods should be somewhere else
src/vs/workbench/common/actions.ts
Outdated
if (descriptor.label) { | ||
// slightly weird if-check required because of | ||
// https://github.com/Microsoft/vscode/blob/d28ace31aa147596e35adf101a27768a048c79ec/src/vs/workbench/parts/files/browser/fileActions.contribution.ts#L194 | ||
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { |
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.
That one save-action needs clarification...
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.
@@ -87,7 +87,7 @@ export interface IMenuRegistry { | |||
getMenuItems(loc: MenuId): IMenuItem[]; | |||
} | |||
|
|||
export const MenuRegistry: IMenuRegistry = new class { | |||
export const MenuRegistry: IMenuRegistry = new class implements IMenuRegistry { |
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.
Cool, didn't know that is possible...
Thanks @bpasero. I did push two more changes that move the generic error logging out of |
@jrieken with latest I am getting a NPE in I think we are changing a little bit the semantic of the Lastly, there are more uses of workbench actions that do not provide a label beyond the save action from me: here in search land. |
Yes, but are we saying that todays behaviour is correct or is it in-correct? Today we only send the event for a (random?) sub-set of commands and I don't believe that's on purpose... cc @seanmcbreen Also, the fact that we default to "triggered by keyboard" is bogus. If an extension executes a (workbench) command (via execucteCommand, as code action, or as post completion command) we will report it as triggered by keyboard which isn't correct
@roblourens What does an action without label do? Also, same question to you @bpasero? Should this just be a command? |
Ops, this was actually missing a commit... |
@jrieken yes I was not saying to not report telemetry on everything, just wanted to raise that this will mean more data is collected for every time a command is triggered via keybinding. I have changed the action to be included in command palette under the name "Save All Files", this is good to use when someone wants to save all dirty files but not any untitled files. |
@sandy081 Please check the changes I made in the keybindings land |
@jrieken LGTM. |
I guess this is so the user can set a keybinding, but it doesn't show up in the command palette. I don't think they are useful there but if this is a problem, I can add a label. |
There are better ways to achieve that. You can simply register a command (even with a label for better keybindings UI but without having it show in any menu). |
The goal about this is to remove
IWorkbenchActionRegistry
because we have commands, keybindings, and menu registries which are more flexible. However, there is weird code in places which needs to be checked first. At the end duplications like https://github.com/Microsoft/vscode/pull/35528/files#diff-b90278b8812101a32d844114fa0dc752L501 shouldn't be in our code anymore.