-
Notifications
You must be signed in to change notification settings - Fork 34.8k
Allow selection on completion detail. Fix #55853 #81198
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
Conversation
@@ -427,7 +429,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl | |||
|
|||
// Editor.IContentWidget.allowEditorOverflow | |||
readonly allowEditorOverflow = true; | |||
readonly suppressMouseDown = true; | |||
readonly suppressMouseDown = false; |
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 makes sure details
widget get onclick events (otherwise textInputArea
gets it).
@@ -337,6 +337,8 @@ class SuggestionDetails { | |||
} | |||
|
|||
this.el.style.height = this.header.offsetHeight + this.docs.offsetHeight + (this.borderWidth * 2) + 'px'; | |||
this.el.style.userSelect = 'text'; | |||
this.el.tabIndex = -1; |
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.
userSelect
-> make selectable
tabIndex
-> otherwise element.focus()
has no effect
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.
Seems to work pretty well. A few comments:
- One can focus the details view and then focus something else in the workbench and the widget will stay open;
- Not a blocker, but I've found that the view doesn't automatically scroll if I click+drag up and down to the edges of the view, when there's enough content to show a scroll bar.
this._model.cancel(); | ||
this._model.clear(); | ||
} | ||
})); | ||
|
||
this._toDispose.add(this._widget.getValue().onDetailsKeyDown(e => { |
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.
Should we maybe simply forward the event to the regular keydown handler instead of duplicating the handling 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.
@joaomoreno I can't do that, as those events only trigger proper action when editor is being focused. For this to work, details element has to be in focus when selection happens.
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 take that back. I should find a way to do that, otherwise many keyboards shortcuts won't work while details is in focus.
I realized this can be much simpler. I was using Also simplified the event handling, now it's simple: all keypress that's not merely ctrl/shift/alt/meta are handled through editor, and ctrl/cmd + c trigger browser default action and do not propagate. |
@octref Focus handling seems much better, and so do the keyboard events! |
OK, shipping it 🚢 |
Fixes #55853