eclipse-theia/theia

Support `CustomEditorInput` and correct `viewColumn` in Tabs API (`vscode.window.tabGroups`)

已关闭

#17,793 创建于 2026年7月17日

 (1 条评论) (0 个反应) (0 位负责人)TypeScript (2,478 个派生)batch import
custom-editorenhancementhelp wantedvscode

仓库指标

星标
 (18,676 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Feature Description:

The TabsMainImpl implementation of the VS Code Tabs API (packages/plugin-ext/src/main/browser/tabs/tabs-main.ts) currently has two gaps compared to the upstream VS Code API:

  1. viewColumn is hard-coded to 0. createTabGroupDto() always returns viewColumn: 0 for every tab group, regardless of which editor column/tab bar it belongs to. This breaks any extension that relies on tabGroup.viewColumn to distinguish between multiple open editor groups (e.g. split editors).

  2. Custom editors are reported as UnknownInput. evaluateTabDtoInput() does not recognize CustomEditorWidget (used for webview-based custom editors registered via vscode.window.registerCustomEditorProvider). As a result, vscode.Tab.input for such tabs resolves to undefined instead of a TabInputCustom instance, making it impossible for extensions to identify custom editor tabs through the Tabs API.

Proposed change

  • Compute viewColumn from the position of the tab's TabBar within applicationShell.mainAreaTabBars instead of hard-coding 0.
  • In evaluateTabDtoInput(), add a branch that detects widget instanceof CustomEditorWidget and returns a TabInputKind.CustomEditorInput DTO with the widget's viewType and resource URI, mirroring how TextInput, NotebookInput, and other kinds are already handled.

Additional context

This aligns Theia's Tabs API implementation more closely with VS Code's behavior, where Tab.input for a custom editor tab is a TabInputCustom object exposing viewType and uri, and TabGroup.viewColumn reflects the actual editor column.

I'd be happy to contribute a PR.

贡献者指南