diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts index ea521f1e66b..91efbf70974 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts @@ -383,9 +383,8 @@ suite('vscode API - window', () => { assert.strictEqual(tabs[1].resource?.toString(), notebookDoc.uri.toString()); assert.strictEqual(tabs[2].resource?.toString(), docB.uri.toString()); assert.strictEqual(tabs[3].resource?.toString(), docC.uri.toString()); - const diffResource = tabs[4].resource as { primary?: Uri, secondary?: Uri } | undefined; - assert.strictEqual(diffResource?.secondary?.toString(), leftDiff.toString()); - assert.strictEqual(diffResource?.primary?.toString(), rightDiff.toString()); + // Diff editor and side by side editor report the right side as the resource + assert.strictEqual(tabs[4].resource?.toString(), rightDiff.toString()); assert.strictEqual(tabs[0].viewColumn, ViewColumn.One); assert.strictEqual(tabs[1].viewColumn, ViewColumn.One); diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index a58df8f7577..0562934cc9d 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -2320,17 +2320,15 @@ declare module 'vscode' { /** * The resource represented by the tab if availble. - * If the tab contains more than one resource then primary will represent the right resource, and secondary the left one. - * Note: Not all editor types have a resource associated with them + * Note: Not all tabs have a resource associated with them. */ - readonly resource?: Uri | { primary?: Uri, secondary?: Uri }; + readonly resource?: Uri; /** * The identifier of the editor which the tab should contain, because * not all tabs represent editors this may be undefined. * This is equivalent to `viewType` for custom editors and notebooks. * The built-in text editor has an id of 'default' for all configurations. - * Note: Tabs are not guaranteed to contain editors but this id represents what editor the tab will resolve if available */ readonly editorId?: string; diff --git a/src/vs/workbench/api/browser/mainThreadEditorTabs.ts b/src/vs/workbench/api/browser/mainThreadEditorTabs.ts index 677d19a1730..8a263c5ecc6 100644 --- a/src/vs/workbench/api/browser/mainThreadEditorTabs.ts +++ b/src/vs/workbench/api/browser/mainThreadEditorTabs.ts @@ -45,7 +45,7 @@ export class MainThreadEditorTabs { tabs.push({ viewColumn: editorGroupToColumn(this._editorGroupsService, group), label: editor.getName(), - resource: editor instanceof SideBySideEditorInput ? EditorResourceAccessor.getCanonicalUri(editor, { supportSideBySide: SideBySideEditor.BOTH }) : EditorResourceAccessor.getCanonicalUri(editor), + resource: editor instanceof SideBySideEditorInput ? EditorResourceAccessor.getCanonicalUri(editor, { supportSideBySide: SideBySideEditor.PRIMARY }) : EditorResourceAccessor.getCanonicalUri(editor), editorId: editor.editorId, isActive: (this._editorGroupsService.activeGroup === group) && group.isActive(editor) }); diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index ebd05448324..d8fe3a603ed 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -642,7 +642,7 @@ export interface MainThreadEditorTabsShape extends IDisposable { export interface IEditorTabDto { viewColumn: EditorGroupColumn; label: string; - resource?: UriComponents | { primary?: UriComponents, secondary?: UriComponents }; + resource?: UriComponents; editorId?: string; isActive: boolean; } diff --git a/src/vs/workbench/api/common/extHostEditorTabs.ts b/src/vs/workbench/api/common/extHostEditorTabs.ts index 879dc99e4ff..e4e61af8543 100644 --- a/src/vs/workbench/api/common/extHostEditorTabs.ts +++ b/src/vs/workbench/api/common/extHostEditorTabs.ts @@ -6,7 +6,7 @@ import type * as vscode from 'vscode'; import * as typeConverters from 'vs/workbench/api/common/extHostTypeConverters'; import { IEditorTabDto, IExtHostEditorTabsShape } from 'vs/workbench/api/common/extHost.protocol'; -import { URI, UriComponents } from 'vs/base/common/uri'; +import { URI } from 'vs/base/common/uri'; import { Emitter, Event } from 'vs/base/common/event'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { ViewColumn } from 'vs/workbench/api/common/extHostTypes'; @@ -14,7 +14,7 @@ import { ViewColumn } from 'vs/workbench/api/common/extHostTypes'; export interface IEditorTab { label: string; viewColumn: ViewColumn; - resource?: vscode.Uri | { primary?: vscode.Uri, secondary?: vscode.Uri }; + resource?: vscode.Uri; editorId?: string; isActive: boolean; } @@ -55,23 +55,10 @@ export class ExtHostEditorTabs implements IExtHostEditorTabs { if (dto.isActive) { activeIndex = index; } - // Resolve resource into the right shape for either normal or side by side - let resource = undefined; - if (dto.resource) { - const resourceAsSidebySide = dto.resource as ({ primary?: UriComponents, secondary?: UriComponents }); - if (resourceAsSidebySide.primary || resourceAsSidebySide.secondary) { - resource = { - primary: URI.revive(resourceAsSidebySide.primary), - secondary: URI.revive(resourceAsSidebySide.secondary) - }; - } else { - resource = URI.revive(dto.resource as UriComponents | undefined); - } - } return Object.freeze({ label: dto.label, viewColumn: typeConverters.ViewColumn.to(dto.viewColumn), - resource, + resource: URI.revive(dto.resource), editorId: dto.editorId, isActive: dto.isActive });