Skip to content

Enum descriptions in new settings editor via Suggest widget#56511

Closed
JacksonKearl wants to merge 18 commits intomicrosoft:masterfrom
JacksonKearl:exploratory-suggestable-enums
Closed

Enum descriptions in new settings editor via Suggest widget#56511
JacksonKearl wants to merge 18 commits intomicrosoft:masterfrom
JacksonKearl:exploratory-suggestable-enums

Conversation

@JacksonKearl
Copy link
Contributor

@JacksonKearl JacksonKearl commented Aug 15, 2018

Closes #55796

This is a somewhat quick and dirty initial implementation. It seems pretty slow on Code - OSS but when I made a full minified build I didn't notice anything particularly slow. It also isn't properly keyboard navigable.

If we decide to go with this idea we'd remove the input box all-together and probably replace it with a button that triggers the dropdown, or just a div and wire up the onspace, onclick, onenter, tab stopping, etc. manually.

It probably looks bad on Mac, as the rounded corners may not hide the input sufficiently, but I don't have anything with me to test.

moredetailed

@JacksonKearl
Copy link
Contributor Author

I don't know of a good way to get markdown links to work as we don't have access to the markdown actionProvider for the suggest detail view. Other markdown is fine though.

@JacksonKearl
Copy link
Contributor Author

Notes from sitdown:

  • Look into if the description view should be always enabled
  • Add i markers for items with a description view
  • Scrolling is broken

@roblourens
Copy link
Member

And

  • What will it take to show the description on hover?

I think this and the scrolling issue are blockers.

@JacksonKearl
Copy link
Contributor Author

It wouldn't be difficult to add hover text to the items, but then you lose markdown. Alternatively it could show the full details panel of the hovered item instead of the selected item, but that feels wrong to me, or at least in need of more discussion over how focus and hover interact

@roblourens
Copy link
Member

"select an element when I hover it" is what I think would feel natural for mouse interaction.

@JacksonKearl
Copy link
Contributor Author

Okay, so same sort of thing as menus. I wonder if that should be added to Suggests as a whole.

@roblourens
Copy link
Member

It's possible, although in normal usage I think people shouldn't be using the mouse.

@JacksonKearl
Copy link
Contributor Author

For me the question is whether I sublclass the suggester for this or implement it for everywhere

@roblourens
Copy link
Member

I think either subclass or put it behind an option in the control itself, whatever is most natural. I could see turning it on in the editor, since otherwise there is no way to see an enumDescription with only the mouse.

@roblourens
Copy link
Member

Maybe @ramya-rao-a has an opinion since she has worked on the suggest widget.

@JacksonKearl
Copy link
Contributor Author

JacksonKearl commented Aug 17, 2018

Turns out native behavior on Mac and Win is to remove the dropdown on scroll so this might actually be the expected behavior.

editor.onDidLayoutChange(() => this.onEditorLayoutChange()),
this.list.onSelectionChange(e => this.onListSelection(e)),
this.list.onFocusChange(e => this.onListFocus(e)),
this.list.onMouseOver(e => this.list.setFocus([e.index])),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ramya-rao-a this adds focus on mouseover to all suggest widgets. This makes sense to me but what do you think? I could put it behind a flag somewhere.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Setting an item on focus then makes the docs/details part to be populated. The only concern here is that the details from certain completion providers is got by making an additional call to the provider. cc @joaomoreno @jrieken

}
}

private forceRedrawHack = 0; // the actual width is fixed, toggle this in order to force redraws for the suggest dropdown to properly flow
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roblourens this is one hack needed to get the suggest to properly move when you resize the window. The call to layout is ignored if the new config is the same, so I add and remove a pixel each time. Alternative suggestions welcome.

@JacksonKearl JacksonKearl changed the title Exploratory suggestable enums Suggestable enums Aug 20, 2018
@JacksonKearl JacksonKearl changed the title Suggestable enums Enum descriptions in new settings editor via Suggest widget Aug 20, 2018
@joaomoreno joaomoreno added this to the August 2018 milestone Aug 21, 2018
@joaomoreno joaomoreno added suggest IntelliSense, Auto Complete settings-editor VS Code settings editor issues labels Aug 21, 2018
@JacksonKearl
Copy link
Contributor Author

Opting for the alternative implementation in #57050.

@roblourens roblourens removed this from the August 2018 milestone Aug 25, 2018
@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

settings-editor VS Code settings editor issues suggest IntelliSense, Auto Complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show setting enumDescriptions inside new dropdown control

4 participants