Skip to content

Conversation

octref
Copy link
Contributor

@octref octref commented Sep 19, 2019

Fixes #55853

@@ -427,7 +429,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl

// Editor.IContentWidget.allowEditorOverflow
readonly allowEditorOverflow = true;
readonly suppressMouseDown = true;
readonly suppressMouseDown = false;
Copy link
Contributor Author

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;
Copy link
Contributor Author

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

@octref octref added this to the September 2019 milestone Sep 19, 2019
Copy link
Member

@joaomoreno joaomoreno left a 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 => {
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@octref
Copy link
Contributor Author

octref commented Sep 23, 2019

I realized this can be much simpler. I was using onDidBlurEditorText (as in the ) which would trigger on focusing details so I had the isDetailsFocused code. But onDidBlueEditorWidget doesn't.

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.

@joaomoreno
Copy link
Member

@octref Focus handling seems much better, and so do the keyboard events!

@octref
Copy link
Contributor Author

octref commented Sep 24, 2019

OK, shipping it 🚢

@octref octref merged commit 992f38c into master Sep 24, 2019
@octref octref deleted the pine/suggestFocus branch September 24, 2019 15:38
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow completion details to be selected
2 participants