如何将所有选项卡在视觉工作室代码窗口中以作为文件名的数组?
我目前正在寻找可以让我查看Visual Studio代码编辑器(1.TXT,2.TXT,3.TXT)中的所有选项卡的呼叫,例如,在数组中返回。
I am currently looking to find the call that will allow me to see all the tabs in a Visual Studio Code editor (1.txt, 2.txt, 3.txt) being returned back in an array for example.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
将返回一组编辑组。然后,在每个编辑器组(或“ TabGroup”)中,您可以使用其选项卡数组:
因此,您必须通过
tabgroups.all
进行循环以获取所有文件名。这样做的一个示例:为了使此键入更友好,请尝试以下操作:
在这里,我将
input
narry缩小到vscode.tabinputtext
,因为某些tab.input
为编辑人员甚至没有uri
成员。如果您对其他tab.input
s感兴趣,则可以为它们范围缩小,也可以制作联合类型来简化它。will return an array of editor groups. And then within each editor group (or "tabGroup") you can get an array of its tabs with:
So you will have to do a loop through the
tabGroups.all
to get all the fileNames. One example of doing so:To make this more typescript-friendly, try this:
Here I narrowed the
input
tovscode.TabInputText
because some of theTab.input
's for editors don't even have auri
member. If you are interested in otherTab.input
's you can narrow for those or possibly make a union type to simplify it.