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
Adopt list commands for editor's "Find References" peek UI #41275
Conversation
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50), | ||
primary: KeyMod.CtrlCmd | KeyCode.Enter, | ||
mac: { | ||
primary: KeyMod.WinCtrl | KeyCode.Enter |
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.
Why isn't this CtrlCmd
?
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.
} | ||
|
||
KeybindingsRegistry.registerCommandAndKeybindingRule({ | ||
id: 'closeReferenceSearch', | ||
weight: KeybindingsRegistry.WEIGHT.editorContrib(50), | ||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50), |
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.
Why workbench and not editor? This feature is also available in the monaco editor....
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 the workbench is also registering ESC for trees and lists here: https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/electron-browser/commands.ts#L344. This is needed to preserve the behaviour of ESC closing the references widget. It is a bit ugly, I agree. The alternative would be to register this command also from the workbench maybe.
} | ||
})); | ||
this._disposables.push(controller.onDidOpenToSide((element: any) => { | ||
this._tree = this._instantiationService.createInstance(WorkbenchTree, div.getHTMLElement(), config, options); |
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.
Somewhere the 'cmd+click to open to side' feature is being lost here
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.
Also looks like double click was broken for mouse (fixed via 6ebd589). And it looked like each mouse click was triggering the goto definitition twice. Fix is to only react to focus and selection on the tree from keyboard events. |
Btw neither in stable nor in insiders does "open to side" using keyboard work for me currently from the find references tree. |
// listen on selection and focus | ||
this._disposables.push(controller.onDidFocus((element) => { | ||
var onEvent = (element: any, kind: 'show' | 'goto' | 'side') => { |
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.
var
😱
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 that is consistent with other usages of var
in _fillBody
, I did not want to change that style. There are more vars
throughout the file, you can clean that up afterwards if you want.
weight: KeybindingsRegistry.WEIGHT.editorContrib(), | ||
primary: KeyMod.CtrlCmd | KeyCode.Enter, | ||
mac: { | ||
primary: KeyMod.WinCtrl | KeyCode.Enter |
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.
Why not cmd
on macs? We use that in the explorer and elsewhere
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 you must have changed the keybindings then, the default is Ctrl+Enter
on mac for Explorer, Search and Problems view:
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.
true story...
@jrieken mouse works for me, but keyboard does not. |
Yeah, keyboard doesn't work today. |
fixes #21692
This adopts the
WorkbenchTree
for the references widget (one of the last that was still using the plain tree). The benefit is that all navigation within the tree, expand/collapse and opening are then configurable via keybindings (list.*
commands) and consistent with all keybindings in other trees/lists.Notable changes:
openReferenceToSide
is added to specifically handle the case of opening a reference to the side (this requires a new context keyreferenceSearchTreeFocused
)focus
andselection
events from the tree to open references