Update tabs model to utilize the new API shape (#142668)

* Change shape of the tabs API

* Disable tab tests for now

* Add an onDidChangeTabGroup event

* Optimize for group activate

* Update events to no longer be an array

* Further tab optimization
This commit is contained in:
Logan Ramos
2022-02-10 15:09:11 -05:00
committed by GitHub
parent f3153f1466
commit ec9df1d972
12 changed files with 316 additions and 260 deletions

View File

@@ -953,14 +953,14 @@ export class ExtHostVariableResolverService extends AbstractVariableResolverServ
if (activeEditor) {
return activeEditor.document.uri;
}
const tabs = editorTabs.tabs.filter(tab => tab.isActive);
if (tabs.length > 0) {
const activeTab = editorTabs.tabGroups.all.find(group => group.isActive)?.activeTab;
if (activeTab !== undefined) {
// Resolve a resource from the tab
const asSideBySideResource = tabs[0].resource as { primary?: URI; secondary?: URI } | undefined;
const asSideBySideResource = activeTab.resource as { primary?: URI; secondary?: URI } | undefined;
if (asSideBySideResource && (asSideBySideResource.primary || asSideBySideResource.secondary)) {
return asSideBySideResource.primary ?? asSideBySideResource.secondary;
} else {
return tabs[0].resource as URI | undefined;
return activeTab.resource as URI | undefined;
}
}
}