Allow submenu items to be computed dynamically at menu-open time
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
I'm building an extension where users can save their own custom named items (like custom environments/connections) after installing it. I wanted to show these in a right-click submenu but found out menu titles have to be fixed strings in package.json, so there's no way to show the actual name the user typed in. Best I can do right now is show a placeholder like "Custom 1" or a count like "Custom environments (3)" and then open a QuickPick to show the real names, which works but it's an extra click and not great UX.
Turns out this has been asked for a bunch of times over the years and never really went anywhere:
#15235, #34048, #9827 (someone even proposed a decent design here with async + cancellation token), #146184, and #110218 which is still open in the backlog.
Also found another extension (nx-console) that ran into the same exact issue and just used a dropdown too, so it's not just us.
Would be nice to know if this is something that could actually get picked up, since the design already seems mostly figured out from #9827.
Contributor guide
Research direction
Start with the contributes.menus and contributes.submenus extension entry points, then read the concrete async-provider proposal in #9827 and the current tracking issue #110218. Compare this with the fixed-string package.json contribution model. Done means submenu contents can resolve at open or hover time with cancellation and a loading state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- desktop, developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100