mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 10:08:49 +01:00
Fix #15178 Finalize tabs API 🎉
This commit is contained in:
@@ -791,7 +791,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
return extHostUriOpeners.registerExternalUriOpener(extension.identifier, id, opener, metadata);
|
||||
},
|
||||
get tabGroups(): vscode.TabGroups {
|
||||
checkProposedApiEnabled(extension, 'tabs');
|
||||
return extHostEditorTabs.tabGroups;
|
||||
},
|
||||
getInlineCompletionItemController<T extends vscode.InlineCompletionItem>(provider: vscode.InlineCompletionItemProvider<T>): vscode.InlineCompletionController<T> {
|
||||
@@ -1345,13 +1344,13 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
LanguageStatusSeverity: extHostTypes.LanguageStatusSeverity,
|
||||
QuickPickItemKind: extHostTypes.QuickPickItemKind,
|
||||
InputBoxValidationSeverity: extHostTypes.InputBoxValidationSeverity,
|
||||
TabKindText: extHostTypes.TextTabInput,
|
||||
TabKindTextDiff: extHostTypes.TextDiffTabInput,
|
||||
TabKindCustom: extHostTypes.CustomEditorTabInput,
|
||||
TabKindNotebook: extHostTypes.NotebookEditorTabInput,
|
||||
TabKindNotebookDiff: extHostTypes.NotebookDiffEditorTabInput,
|
||||
TabKindWebview: extHostTypes.WebviewEditorTabInput,
|
||||
TabKindTerminal: extHostTypes.TerminalEditorTabInput
|
||||
TabInputText: extHostTypes.TextTabInput,
|
||||
TabInputTextDiff: extHostTypes.TextDiffTabInput,
|
||||
TabInputCustom: extHostTypes.CustomEditorTabInput,
|
||||
TabInputNotebook: extHostTypes.NotebookEditorTabInput,
|
||||
TabInputNotebookDiff: extHostTypes.NotebookDiffEditorTabInput,
|
||||
TabInputWebview: extHostTypes.WebviewEditorTabInput,
|
||||
TabInputTerminal: extHostTypes.TerminalEditorTabInput
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { IEditorTabDto, IEditorTabGroupDto, IExtHostEditorTabsShape, MainContext
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { CustomEditorTabInput, NotebookDiffEditorTabInput, NotebookEditorTabInput, TerminalEditorTabInput, TextDiffTabInput, TextTabInput, ViewColumn, WebviewEditorTabInput } from 'vs/workbench/api/common/extHostTypes';
|
||||
import { CustomEditorTabInput, NotebookDiffEditorTabInput, NotebookEditorTabInput, TerminalEditorTabInput, TextDiffTabInput, TextTabInput, WebviewEditorTabInput } from 'vs/workbench/api/common/extHostTypes';
|
||||
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
import { assertIsDefined } from 'vs/base/common/types';
|
||||
import { diffSets } from 'vs/base/common/collections';
|
||||
@@ -48,7 +48,7 @@ class ExtHostEditorTab {
|
||||
get label() {
|
||||
return that._dto.label;
|
||||
},
|
||||
get kind() {
|
||||
get input() {
|
||||
return that._input;
|
||||
},
|
||||
get isDirty() {
|
||||
@@ -256,14 +256,14 @@ export class ExtHostEditorTabs implements IExtHostEditorTabs {
|
||||
return this._closeTabs(tabsOrTabGroups as vscode.Tab[], preserveFocus);
|
||||
}
|
||||
},
|
||||
move: async (tab: vscode.Tab, viewColumn: ViewColumn, index: number, preservceFocus?: boolean) => {
|
||||
const extHostTab = this._findExtHostTabFromApi(tab);
|
||||
if (!extHostTab) {
|
||||
throw new Error('Invalid tab');
|
||||
}
|
||||
this._proxy.$moveTab(extHostTab.tabId, index, typeConverters.ViewColumn.from(viewColumn), preservceFocus);
|
||||
return;
|
||||
}
|
||||
// move: async (tab: vscode.Tab, viewColumn: ViewColumn, index: number, preservceFocus?: boolean) => {
|
||||
// const extHostTab = this._findExtHostTabFromApi(tab);
|
||||
// if (!extHostTab) {
|
||||
// throw new Error('Invalid tab');
|
||||
// }
|
||||
// this._proxy.$moveTab(extHostTab.tabId, index, typeConverters.ViewColumn.from(viewColumn), preservceFocus);
|
||||
// return;
|
||||
// }
|
||||
};
|
||||
this._apiObject = Object.freeze(obj);
|
||||
}
|
||||
|
||||
@@ -50,10 +50,10 @@ class ExtHostVariableResolverService extends AbstractVariableResolverService {
|
||||
const activeTab = editorTabs.tabGroups.all.find(group => group.isActive)?.activeTab;
|
||||
if (activeTab !== undefined) {
|
||||
// Resolve a resource from the tab
|
||||
if (activeTab.kind instanceof TextDiffTabInput || activeTab.kind instanceof NotebookDiffEditorTabInput) {
|
||||
return activeTab.kind.modified;
|
||||
} else if (activeTab.kind instanceof TextTabInput || activeTab.kind instanceof NotebookEditorTabInput || activeTab.kind instanceof CustomEditorTabInput) {
|
||||
return activeTab.kind.uri;
|
||||
if (activeTab.input instanceof TextDiffTabInput || activeTab.input instanceof NotebookDiffEditorTabInput) {
|
||||
return activeTab.input.modified;
|
||||
} else if (activeTab.input instanceof TextTabInput || activeTab.input instanceof NotebookEditorTabInput || activeTab.input instanceof CustomEditorTabInput) {
|
||||
return activeTab.input.uri;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user