microsoft/vscode

Tabs API does not allow to identify internal tabs

McSodbrenner opened this issue · 8 comments

Type: Bug

If you set a listener to vscode.window.tabGroups.onDidChangeTabs, you will only get an undefined for tab.input when switching to the "Settings" or the "Keyboard Shortcuts".

vscode.window.tabGroups.onDidChangeTabs((tabs) => {
    if (tabs.changed.length) {
        tabs.changed.forEach(tab => {
            console.log(tab.input);
        })
    }
});

Since the tab object does not contain any meaningful usable indication of what the user is actually looking at (except for the label, which is language dependent though), it is not possible to build a complete replacement for the "Open Editors" panel.
Here an internal uri object (with path: "vscode://settings") would be useful, so that one can open the tab via vscode.open as with all other tab items.

VS Code version: Code 1.70.2 (e4503b3, 2022-08-16T05:35:13.448Z)
OS version: Windows_NT x64 10.0.22000
Modes:
Remote OS version: Linux x64 5.10.16.3-microsoft-standard-WSL2

System Info
Item Value
CPUs Intel(R) Core(TM) i3-8130U CPU @ 2.20GHz (4 x 2208)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 7.91GB (0.49GB free)
Process Argv --crash-reporter-id f99464a5-8822-46d7-a621-d6395d9680b9 --crash-reporter-id f99464a5-8822-46d7-a621-d6395d9680b9
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu
OS Linux x64 5.10.16.3-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i3-8130U CPU @ 2.20GHz (4 x 2207)
Memory (System) 3.79GB (0.66GB free)
VM 0%

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

The same is true for the Markdown Preview. There tab.input only contains the corresponding viewType, but no information about which file the preview belongs to. So you cannot show the tab with vscode.open nor with vscode.window.showTextDocument.

This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Similar to

🙁 In the last 60 days, this feature request has received less than 20 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

It's at 19, which is close enough. I'll explore this item, but make no promises surrounding it's implementation as those internal tabs don't really have URIs so calling vscode.open is unlikely to work.

@lramos15
It may not even be necessary for the internal pages to have URLs. Maybe it is enough to have the possibility to switch to a tab, regardless of the content of the tab (reveal(), select()... whatever). At the moment there is only the possibility to close a tab (TabGroup.close()) or open it via vscode.open and vscode.diff.
A reveal() would give you the possibility to switch to the settings, for example, because the label is currently already included in its tab. On the other hand, it would be nice to have some more info about the internal tabs ("Keyboard shortcuts", "Settings" etc.), so that you can see without a doubt that it is the respective page and you can display the corresponding icons. The label is unfortunately language dependent and therefore not usable as a key.

Is there any progress on this issue?