vscode 快速输入服务需要丑陋的casts才能正常工作,

qxgroojn  于 6个月前  发布在  Vscode
关注(0)|答案(2)|浏览(75)

See this code where I cannot workaround the fact that I have to use ... as ... :
vscode/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts
Line 315 in 81604a0
| | picker.selectedItems=picker.items.filter(item=>(itemasINotificationSourceFilter).filter===NotificationsFilter.OFF)as(IQuickPickItem&INotificationSourceFilter)[]; |
vscode/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts
Line 320 in 81604a0
| | for(constitemofpicker.itemsas(IQuickPickItem&INotificationSourceFilter)[]){ |
The returned type seems to include IQuickPickSeparator and hence the casts are needed.

wfsdck30

wfsdck301#

这已经是这样了...我们在API中做的一件事是将分隔符与项目合并,并使用kind来区分:
vscode/src/vscode-dts/vscode.d.ts
ed220ef的第1857行
| | kind?: QuickPickItemKind; |
也许值得这样做...特别是考虑到分隔符正变得越来越像“项目”的功能,比如按钮。

k5ifujac

k5ifujac2#

我本以为可以在选项中启用分隔符,除非我不这么做,否则不会返回分隔符类型。我假设在大多数情况下,简单选择器中不使用分隔符。

相关问题