Merge from vscode 4636be2b71c87bfb0bfe3c94278b447a5efcc1f1 (#8722)

* Merge from vscode 4636be2b71c87bfb0bfe3c94278b447a5efcc1f1

* remove tests that aren't working
This commit is contained in:
Anthony Dresser
2019-12-18 00:14:28 -08:00
committed by GitHub
parent 0fd870d156
commit 30d9e9c141
289 changed files with 5537 additions and 3039 deletions

View File

@@ -383,7 +383,7 @@ export function fillResourceDataTransfers(accessor: ServicesAccessor, resources:
const model = textFileService.models.get(file.resource);
if (model) {
encoding = model.getEncoding();
mode = model.textEditorModel?.getModeId();
mode = model.getMode();
}
}

View File

@@ -9,6 +9,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { IConstructorSignature0, IInstantiationService, BrandedService } from 'vs/platform/instantiation/common/instantiation';
import { find } from 'vs/base/common/arrays';
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
export interface IEditorDescriptor {
instantiate(instantiationService: IInstantiationService): BaseEditor;
@@ -30,7 +31,7 @@ export interface IEditorRegistry {
* @param inputDescriptors A set of constructor functions that return an instance of EditorInput for which the
* registered editor should be used for.
*/
registerEditor(descriptor: IEditorDescriptor, inputDescriptors: readonly SyncDescriptor<EditorInput>[]): void;
registerEditor(descriptor: IEditorDescriptor, inputDescriptors: readonly SyncDescriptor<EditorInput>[]): IDisposable;
/**
* Returns the editor descriptor for the given input or `undefined` if none.
@@ -54,7 +55,7 @@ export interface IEditorRegistry {
*/
export class EditorDescriptor implements IEditorDescriptor {
public static create<Services extends BrandedService[]>(
static create<Services extends BrandedService[]>(
ctor: { new(...services: Services): BaseEditor },
id: string,
name: string
@@ -87,14 +88,22 @@ export class EditorDescriptor implements IEditorDescriptor {
class EditorRegistry implements IEditorRegistry {
private editors: EditorDescriptor[] = [];
private readonly editors: EditorDescriptor[] = [];
private readonly mapEditorToInputs = new Map<EditorDescriptor, readonly SyncDescriptor<EditorInput>[]>();
registerEditor(descriptor: EditorDescriptor, inputDescriptors: readonly SyncDescriptor<EditorInput>[]): void {
// Register (Support multiple Editors per Input)
registerEditor(descriptor: EditorDescriptor, inputDescriptors: readonly SyncDescriptor<EditorInput>[]): IDisposable {
this.mapEditorToInputs.set(descriptor, inputDescriptors);
this.editors.push(descriptor);
return toDisposable(() => {
this.mapEditorToInputs.delete(descriptor);
const index = this.editors.indexOf(descriptor);
if (index !== -1) {
this.editors.splice(index, 1);
}
});
}
getEditor(input: EditorInput): EditorDescriptor | undefined {
@@ -156,10 +165,6 @@ class EditorRegistry implements IEditorRegistry {
return this.editors.slice(0);
}
setEditors(editorsToSet: EditorDescriptor[]): void {
this.editors = editorsToSet;
}
getEditorInputs(): SyncDescriptor<EditorInput>[] {
const inputClasses: SyncDescriptor<EditorInput>[] = [];
for (const editor of this.editors) {

View File

@@ -178,7 +178,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
position: Position.BOTTOM,
lastNonMaximizedWidth: 300,
lastNonMaximizedHeight: 300,
panelToRestore: undefined as string | undefined
panelToRestore: undefined as string | undefined,
restored: false
},
statusBar: {
@@ -570,9 +571,10 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
private updatePanelPosition() {
const defaultPanelPosition = this.configurationService.getValue<string>(Settings.PANEL_POSITION);
const panelPosition = this.storageService.get(Storage.PANEL_POSITION, StorageScope.WORKSPACE, defaultPanelPosition);
const panelPosition = this.storageService.get(Storage.PANEL_POSITION, StorageScope.WORKSPACE, undefined);
this.state.panel.position = (panelPosition === 'right') ? Position.RIGHT : Position.BOTTOM;
this.state.panel.restored = panelPosition !== undefined;
this.state.panel.position = ((panelPosition || defaultPanelPosition) === 'right') ? Position.RIGHT : Position.BOTTOM;
}
registerPart(part: Part): void {
@@ -1279,7 +1281,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
const height = this.storageService.getNumber(Storage.GRID_HEIGHT, StorageScope.GLOBAL, workbenchDimensions.height);
// At some point, we will not fall back to old keys from legacy layout, but for now, let's migrate the keys
const sideBarSize = this.storageService.getNumber(Storage.SIDEBAR_SIZE, StorageScope.GLOBAL, this.storageService.getNumber('workbench.sidebar.width', StorageScope.GLOBAL, Math.min(workbenchDimensions.width / 4, 300)));
const panelSize = this.storageService.getNumber(Storage.PANEL_SIZE, StorageScope.GLOBAL, this.storageService.getNumber(this.state.panel.position === Position.BOTTOM ? 'workbench.panel.height' : 'workbench.panel.width', StorageScope.GLOBAL, workbenchDimensions.height / 3));
const panelSize = this.state.panel.restored ? this.storageService.getNumber(Storage.PANEL_SIZE, StorageScope.GLOBAL, this.storageService.getNumber(this.state.panel.position === Position.BOTTOM ? 'workbench.panel.height' : 'workbench.panel.width', StorageScope.GLOBAL, workbenchDimensions.height / 3)) : workbenchDimensions.height / 3;
const titleBarHeight = this.titleBarPartView.minimumHeight;
const statusBarHeight = this.statusBarPartView.minimumHeight;

View File

@@ -82,4 +82,8 @@ export class PaneComposite extends Composite implements IPaneComposite {
saveState(): void {
super.saveState();
}
focus(): void {
this.viewPaneContainer.focus();
}
}

View File

@@ -12,9 +12,12 @@ import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/bro
import { IConstructorSignature0, BrandedService } from 'vs/platform/instantiation/common/instantiation';
import { isAncestor } from 'vs/base/browser/dom';
import { assertIsDefined } from 'vs/base/common/types';
import { PaneComposite } from 'vs/workbench/browser/panecomposite';
export abstract class Panel extends Composite implements IPanel { }
export abstract class PaneCompositePanel extends PaneComposite implements IPanel { }
/**
* A panel descriptor is a leightweight descriptor of a panel in the workbench.
*/

View File

@@ -9,7 +9,7 @@ import * as glob from 'vs/base/common/glob';
import { IDisposable } from 'vs/base/common/lifecycle';
import { localize } from 'vs/nls';
import { IConfigurationOverrides, IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
import { Extensions, IConfigurationRegistry, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { Registry } from 'vs/platform/registry/common/platform';
@@ -150,7 +150,7 @@ Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfigurat
description: localize('symbolSortOrder', "Controls how symbols are sorted in the breadcrumbs outline view."),
type: 'string',
default: 'position',
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
enum: ['position', 'name', 'type'],
enumDescriptions: [
localize('symbolSortOrder.position', "Show symbol outline in file position order."),
@@ -166,157 +166,157 @@ Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfigurat
'breadcrumbs.showFiles': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.file', "When enabled breadcrumbs show `file`-symbols.")
},
'breadcrumbs.showModules': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.module', "When enabled breadcrumbs show `module`-symbols.")
},
'breadcrumbs.showNamespaces': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.namespace', "When enabled breadcrumbs show `namespace`-symbols.")
},
'breadcrumbs.showPackages': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.package', "When enabled breadcrumbs show `package`-symbols.")
},
'breadcrumbs.showClasses': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.class', "When enabled breadcrumbs show `class`-symbols.")
},
'breadcrumbs.showMethods': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.method', "When enabled breadcrumbs show `method`-symbols.")
},
'breadcrumbs.showProperties': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.property', "When enabled breadcrumbs show `property`-symbols.")
},
'breadcrumbs.showFields': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.field', "When enabled breadcrumbs show `field`-symbols.")
},
'breadcrumbs.showConstructors': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.constructor', "When enabled breadcrumbs show `constructor`-symbols.")
},
'breadcrumbs.showEnums': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.enum', "When enabled breadcrumbs show `enum`-symbols.")
},
'breadcrumbs.showInterfaces': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.interface', "When enabled breadcrumbs show `interface`-symbols.")
},
'breadcrumbs.showFunctions': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.function', "When enabled breadcrumbs show `function`-symbols.")
},
'breadcrumbs.showVariables': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.variable', "When enabled breadcrumbs show `variable`-symbols.")
},
'breadcrumbs.showConstants': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.constant', "When enabled breadcrumbs show `constant`-symbols.")
},
'breadcrumbs.showStrings': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.string', "When enabled breadcrumbs show `string`-symbols.")
},
'breadcrumbs.showNumbers': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.number', "When enabled breadcrumbs show `number`-symbols.")
},
'breadcrumbs.showBooleans': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.boolean', "When enabled breadcrumbs show `boolean`-symbols.")
},
'breadcrumbs.showArrays': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.array', "When enabled breadcrumbs show `array`-symbols.")
},
'breadcrumbs.showObjects': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.object', "When enabled breadcrumbs show `object`-symbols.")
},
'breadcrumbs.showKeys': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.key', "When enabled breadcrumbs show `key`-symbols.")
},
'breadcrumbs.showNull': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.null', "When enabled breadcrumbs show `null`-symbols.")
},
'breadcrumbs.showEnumMembers': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.enumMember', "When enabled breadcrumbs show `enumMember`-symbols.")
},
'breadcrumbs.showStructs': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.struct', "When enabled breadcrumbs show `struct`-symbols.")
},
'breadcrumbs.showEvents': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.event', "When enabled breadcrumbs show `event`-symbols.")
},
'breadcrumbs.showOperators': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.operator', "When enabled breadcrumbs show `operator`-symbols.")
},
'breadcrumbs.showTypeParameters': {
type: 'boolean',
default: true,
overridable: true,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
markdownDescription: localize('filteredTypes.typeParameter', "When enabled breadcrumbs show `typeParameter`-symbols.")
}
}

View File

@@ -47,7 +47,7 @@ import { IEditorGroupView } from 'vs/workbench/browser/parts/editor/editor';
import { onDidChangeZoomLevel } from 'vs/base/browser/browser';
import { withNullAsUndefined, withUndefinedAsNull } from 'vs/base/common/types';
import { ILabelService } from 'vs/platform/label/common/label';
import { IResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
class Item extends BreadcrumbsItem {
@@ -169,7 +169,7 @@ export class BreadcrumbsControl {
@IThemeService private readonly _themeService: IThemeService,
@IQuickOpenService private readonly _quickOpenService: IQuickOpenService,
@IConfigurationService private readonly _configurationService: IConfigurationService,
@IResourceConfigurationService private readonly _textResourceConfigurationService: IResourceConfigurationService,
@ITextResourceConfigurationService private readonly _textResourceConfigurationService: ITextResourceConfigurationService,
@IFileService private readonly _fileService: IFileService,
@ITelemetryService private readonly _telemetryService: ITelemetryService,
@ILabelService private readonly _labelService: ILabelService,

View File

@@ -24,7 +24,7 @@ import { FileKind } from 'vs/platform/files/common/files';
import { withNullAsUndefined } from 'vs/base/common/types';
import { OutlineFilter } from 'vs/editor/contrib/documentSymbols/outlineTree';
import { ITextModel } from 'vs/editor/common/model';
import { IResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
export class FileElement {
constructor(
@@ -55,7 +55,7 @@ export class EditorBreadcrumbsModel {
private readonly _uri: URI,
private readonly _editor: ICodeEditor | undefined,
@IConfigurationService private readonly _configurationService: IConfigurationService,
@IResourceConfigurationService private readonly _textResourceConfigurationService: IResourceConfigurationService,
@ITextResourceConfigurationService private readonly _textResourceConfigurationService: ITextResourceConfigurationService,
@IWorkspaceContextService workspaceService: IWorkspaceContextService,
) {
this._cfgFilePath = BreadcrumbsConfig.FilePath.bindTo(_configurationService);

View File

@@ -29,14 +29,14 @@ import {
CloseEditorsInOtherGroupsAction, CloseAllEditorsAction, MoveGroupLeftAction, MoveGroupRightAction, SplitEditorAction, JoinTwoGroupsAction, OpenToSideFromQuickOpenAction, RevertAndCloseEditorAction,
NavigateBetweenGroupsAction, FocusActiveGroupAction, FocusFirstGroupAction, ResetGroupSizesAction, MaximizeGroupAction, MinimizeOtherGroupsAction, FocusPreviousGroup, FocusNextGroup,
toEditorQuickOpenEntry, CloseLeftEditorsInGroupAction, OpenNextEditor, OpenPreviousEditor, NavigateBackwardsAction, NavigateForwardAction, NavigateLastAction, ReopenClosedEditorAction,
OpenPreviousRecentlyUsedEditorInGroupAction, OpenPreviousEditorFromHistoryAction, ShowAllEditorsAction, ClearEditorHistoryAction, MoveEditorRightInGroupAction, OpenNextEditorInGroup,
OpenPreviousEditorInGroup, OpenNextRecentlyUsedEditorAction, OpenPreviousRecentlyUsedEditorAction, OpenNextRecentlyUsedEditorInGroupAction, MoveEditorToPreviousGroupAction,
QuickOpenPreviousRecentlyUsedEditorInGroupAction, QuickOpenPreviousEditorFromHistoryAction, ShowAllEditorsByAppearanceAction, ClearEditorHistoryAction, MoveEditorRightInGroupAction, OpenNextEditorInGroup,
OpenPreviousEditorInGroup, OpenNextRecentlyUsedEditorAction, OpenPreviousRecentlyUsedEditorAction, QuickOpenNextRecentlyUsedEditorInGroupAction, MoveEditorToPreviousGroupAction,
MoveEditorToNextGroupAction, MoveEditorToFirstGroupAction, MoveEditorLeftInGroupAction, ClearRecentFilesAction, OpenLastEditorInGroup,
ShowEditorsInActiveGroupAction, MoveEditorToLastGroupAction, OpenFirstEditorInGroup, MoveGroupUpAction, MoveGroupDownAction, FocusLastGroupAction, SplitEditorLeftAction, SplitEditorRightAction,
ShowEditorsInActiveGroupByMostRecentlyUsedAction, MoveEditorToLastGroupAction, OpenFirstEditorInGroup, MoveGroupUpAction, MoveGroupDownAction, FocusLastGroupAction, SplitEditorLeftAction, SplitEditorRightAction,
SplitEditorUpAction, SplitEditorDownAction, MoveEditorToLeftGroupAction, MoveEditorToRightGroupAction, MoveEditorToAboveGroupAction, MoveEditorToBelowGroupAction, CloseAllEditorGroupsAction,
JoinAllGroupsAction, FocusLeftGroup, FocusAboveGroup, FocusRightGroup, FocusBelowGroup, EditorLayoutSingleAction, EditorLayoutTwoColumnsAction, EditorLayoutThreeColumnsAction, EditorLayoutTwoByTwoGridAction,
EditorLayoutTwoRowsAction, EditorLayoutThreeRowsAction, EditorLayoutTwoColumnsBottomAction, EditorLayoutTwoRowsRightAction, NewEditorGroupLeftAction, NewEditorGroupRightAction,
NewEditorGroupAboveAction, NewEditorGroupBelowAction, SplitEditorOrthogonalAction, CloseEditorInAllGroupsAction, NavigateToLastEditLocationAction, ToggleGroupSizesAction
NewEditorGroupAboveAction, NewEditorGroupBelowAction, SplitEditorOrthogonalAction, CloseEditorInAllGroupsAction, NavigateToLastEditLocationAction, ToggleGroupSizesAction, ShowAllEditorsByMostRecentlyUsedAction, QuickOpenNextRecentlyUsedEditorAction, QuickOpenPreviousRecentlyUsedEditorAction, OpenPreviousRecentlyUsedEditorInGroupAction, OpenNextRecentlyUsedEditorInGroupAction
} from 'vs/workbench/browser/parts/editor/editorActions';
import * as editorCommands from 'vs/workbench/browser/parts/editor/editorCommands';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
@@ -44,7 +44,7 @@ import { getQuickNavigateHandler, inQuickOpenContext } from 'vs/workbench/browse
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { isMacintosh } from 'vs/base/common/platform';
import { AllEditorsPicker, ActiveEditorGroupPicker } from 'vs/workbench/browser/parts/editor/editorPicker';
import { AllEditorsByAppearancePicker, ActiveGroupEditorsByMostRecentlyUsedPicker, AllEditorsByMostRecentlyUsedPicker } from 'vs/workbench/browser/parts/editor/editorPicker';
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { OpenWorkspaceButtonContribution } from 'vs/workbench/browser/parts/editor/editorWidgets';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
@@ -119,6 +119,10 @@ class UntitledTextEditorInputFactory implements IEditorInputFactory {
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService
) { }
canSerialize(editorInput: EditorInput): boolean {
return this.filesConfigurationService.isHotExitEnabled;
}
serialize(editorInput: EditorInput): string | undefined {
if (!this.filesConfigurationService.isHotExitEnabled) {
return undefined; // never restore untitled unless hot exit is enabled
@@ -169,6 +173,20 @@ interface ISerializedSideBySideEditorInput {
// Register Side by Side Editor Input Factory
class SideBySideEditorInputFactory implements IEditorInputFactory {
canSerialize(editorInput: EditorInput): boolean {
const input = <SideBySideEditorInput>editorInput;
if (input.details && input.master) {
const registry = Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories);
const detailsInputFactory = registry.getEditorInputFactory(input.details.getTypeId());
const masterInputFactory = registry.getEditorInputFactory(input.master.getTypeId());
return !!(detailsInputFactory?.canSerialize(input.details) && masterInputFactory?.canSerialize(input.master));
}
return false;
}
serialize(editorInput: EditorInput): string | undefined {
const input = <SideBySideEditorInput>editorInput;
@@ -284,15 +302,15 @@ const editorPickerContext = ContextKeyExpr.and(inQuickOpenContext, ContextKeyExp
Registry.as<IQuickOpenRegistry>(QuickOpenExtensions.Quickopen).registerQuickOpenHandler(
QuickOpenHandlerDescriptor.create(
ActiveEditorGroupPicker,
ActiveEditorGroupPicker.ID,
editorCommands.NAVIGATE_IN_ACTIVE_GROUP_PREFIX,
ActiveGroupEditorsByMostRecentlyUsedPicker,
ActiveGroupEditorsByMostRecentlyUsedPicker.ID,
editorCommands.NAVIGATE_IN_ACTIVE_GROUP_BY_MOST_RECENTLY_USED_PREFIX,
editorPickerContextKey,
[
{
prefix: editorCommands.NAVIGATE_IN_ACTIVE_GROUP_PREFIX,
prefix: editorCommands.NAVIGATE_IN_ACTIVE_GROUP_BY_MOST_RECENTLY_USED_PREFIX,
needsEditor: false,
description: nls.localize('groupOnePicker', "Show Editors in Active Group")
description: nls.localize('groupOnePicker', "Show Editors in Active Group By Most Recently Used")
}
]
)
@@ -300,15 +318,31 @@ Registry.as<IQuickOpenRegistry>(QuickOpenExtensions.Quickopen).registerQuickOpen
Registry.as<IQuickOpenRegistry>(QuickOpenExtensions.Quickopen).registerQuickOpenHandler(
QuickOpenHandlerDescriptor.create(
AllEditorsPicker,
AllEditorsPicker.ID,
editorCommands.NAVIGATE_ALL_EDITORS_GROUP_PREFIX,
AllEditorsByAppearancePicker,
AllEditorsByAppearancePicker.ID,
editorCommands.NAVIGATE_ALL_EDITORS_BY_APPEARANCE_PREFIX,
editorPickerContextKey,
[
{
prefix: editorCommands.NAVIGATE_ALL_EDITORS_GROUP_PREFIX,
prefix: editorCommands.NAVIGATE_ALL_EDITORS_BY_APPEARANCE_PREFIX,
needsEditor: false,
description: nls.localize('allEditorsPicker', "Show All Opened Editors")
description: nls.localize('allEditorsPicker', "Show All Opened Editors By Appearance")
}
]
)
);
Registry.as<IQuickOpenRegistry>(QuickOpenExtensions.Quickopen).registerQuickOpenHandler(
QuickOpenHandlerDescriptor.create(
AllEditorsByMostRecentlyUsedPicker,
AllEditorsByMostRecentlyUsedPicker.ID,
editorCommands.NAVIGATE_ALL_EDITORS_BY_MOST_RECENTLY_USED_PREFIX,
editorPickerContextKey,
[
{
prefix: editorCommands.NAVIGATE_ALL_EDITORS_BY_MOST_RECENTLY_USED_PREFIX,
needsEditor: false,
description: nls.localize('allEditorsPickerByMostRecentlyUsed', "Show All Opened Editors By Most Recently Used")
}
]
)
@@ -316,17 +350,20 @@ Registry.as<IQuickOpenRegistry>(QuickOpenExtensions.Quickopen).registerQuickOpen
// Register Editor Actions
const category = nls.localize('view', "View");
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenNextEditorInGroup, OpenNextEditorInGroup.ID, OpenNextEditorInGroup.LABEL), 'View: Open Next Editor in Group', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenPreviousEditorInGroup, OpenPreviousEditorInGroup.ID, OpenPreviousEditorInGroup.LABEL), 'View: Open Previous Editor in Group', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenLastEditorInGroup, OpenLastEditorInGroup.ID, OpenLastEditorInGroup.LABEL, { primary: KeyMod.Alt | KeyCode.KEY_0, secondary: [KeyMod.CtrlCmd | KeyCode.KEY_9], mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_0, secondary: [KeyMod.CtrlCmd | KeyCode.KEY_9] } }), 'View: Open Last Editor in Group', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenFirstEditorInGroup, OpenFirstEditorInGroup.ID, OpenFirstEditorInGroup.LABEL), 'View: Open First Editor in Group', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenNextRecentlyUsedEditorAction, OpenNextRecentlyUsedEditorAction.ID, OpenNextRecentlyUsedEditorAction.LABEL), 'View: Open Next Recently Used Editor', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenPreviousRecentlyUsedEditorAction, OpenPreviousRecentlyUsedEditorAction.ID, OpenPreviousRecentlyUsedEditorAction.LABEL), 'View: Open Previous Recently Used Editor', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(ShowAllEditorsAction, ShowAllEditorsAction.ID, ShowAllEditorsAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_P), mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Tab } }), 'View: Show All Editors', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(ShowEditorsInActiveGroupAction, ShowEditorsInActiveGroupAction.ID, ShowEditorsInActiveGroupAction.LABEL), 'View: Show Editors in Active Group', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenNextEditor, OpenNextEditor.ID, OpenNextEditor.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.PageDown, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.RightArrow, secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_CLOSE_SQUARE_BRACKET] } }), 'View: Open Next Editor', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenPreviousEditor, OpenPreviousEditor.ID, OpenPreviousEditor.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.PageUp, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.LeftArrow, secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_OPEN_SQUARE_BRACKET] } }), 'View: Open Previous Editor', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenNextEditorInGroup, OpenNextEditorInGroup.ID, OpenNextEditorInGroup.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.PageDown), mac: { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.RightArrow) } }), 'View: Open Next Editor in Group', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenPreviousEditorInGroup, OpenPreviousEditorInGroup.ID, OpenPreviousEditorInGroup.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.PageUp), mac: { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.LeftArrow) } }), 'View: Open Previous Editor in Group', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenNextRecentlyUsedEditorAction, OpenNextRecentlyUsedEditorAction.ID, OpenNextRecentlyUsedEditorAction.LABEL), 'View: Open Next Recently Used Editor', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenPreviousRecentlyUsedEditorAction, OpenPreviousRecentlyUsedEditorAction.ID, OpenPreviousRecentlyUsedEditorAction.LABEL), 'View: Open Previous Recently Used Editor', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenNextRecentlyUsedEditorInGroupAction, OpenNextRecentlyUsedEditorInGroupAction.ID, OpenNextRecentlyUsedEditorInGroupAction.LABEL), 'View: Open Next Recently Used Editor In Group', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenPreviousRecentlyUsedEditorInGroupAction, OpenPreviousRecentlyUsedEditorInGroupAction.ID, OpenPreviousRecentlyUsedEditorInGroupAction.LABEL), 'View: Open Previous Recently Used Editor In Group', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenFirstEditorInGroup, OpenFirstEditorInGroup.ID, OpenFirstEditorInGroup.LABEL), 'View: Open First Editor in Group', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenLastEditorInGroup, OpenLastEditorInGroup.ID, OpenLastEditorInGroup.LABEL, { primary: KeyMod.Alt | KeyCode.KEY_0, secondary: [KeyMod.CtrlCmd | KeyCode.KEY_9], mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_0, secondary: [KeyMod.CtrlCmd | KeyCode.KEY_9] } }), 'View: Open Last Editor in Group', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(ReopenClosedEditorAction, ReopenClosedEditorAction.ID, ReopenClosedEditorAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_T }), 'View: Reopen Closed Editor', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(ShowAllEditorsByAppearanceAction, ShowAllEditorsByAppearanceAction.ID, ShowAllEditorsByAppearanceAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_P), mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Tab } }), 'View: Show All Editors By Appearance', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(ShowAllEditorsByMostRecentlyUsedAction, ShowAllEditorsByMostRecentlyUsedAction.ID, ShowAllEditorsByMostRecentlyUsedAction.LABEL), 'View: Show All Editors By Most Recently Used', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(ShowEditorsInActiveGroupByMostRecentlyUsedAction, ShowEditorsInActiveGroupByMostRecentlyUsedAction.ID, ShowEditorsInActiveGroupByMostRecentlyUsedAction.LABEL), 'View: Show Editors in Active Group By Most Recently Used', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(ClearRecentFilesAction, ClearRecentFilesAction.ID, ClearRecentFilesAction.LABEL), 'File: Clear Recently Opened', nls.localize('file', "File"));
registry.registerWorkbenchAction(SyncActionDescriptor.create(CloseAllEditorsAction, CloseAllEditorsAction.ID, CloseAllEditorsAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_W) }), 'View: Close All Editors', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(CloseAllEditorGroupsAction, CloseAllEditorGroupsAction.ID, CloseAllEditorGroupsAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_W) }), 'View: Close All Editor Groups', category);
@@ -377,7 +414,6 @@ registry.registerWorkbenchAction(SyncActionDescriptor.create(NavigateForwardActi
registry.registerWorkbenchAction(SyncActionDescriptor.create(NavigateBackwardsAction, NavigateBackwardsAction.ID, NavigateBackwardsAction.LABEL, { primary: 0, win: { primary: KeyMod.Alt | KeyCode.LeftArrow }, mac: { primary: KeyMod.WinCtrl | KeyCode.US_MINUS }, linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_MINUS } }), 'Go Back');
registry.registerWorkbenchAction(SyncActionDescriptor.create(NavigateToLastEditLocationAction, NavigateToLastEditLocationAction.ID, NavigateToLastEditLocationAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_Q) }), 'Go to Last Edit Location');
registry.registerWorkbenchAction(SyncActionDescriptor.create(NavigateLastAction, NavigateLastAction.ID, NavigateLastAction.LABEL), 'Go Last');
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenPreviousEditorFromHistoryAction, OpenPreviousEditorFromHistoryAction.ID, OpenPreviousEditorFromHistoryAction.LABEL), 'Open Previous Editor from History');
registry.registerWorkbenchAction(SyncActionDescriptor.create(ClearEditorHistoryAction, ClearEditorHistoryAction.ID, ClearEditorHistoryAction.LABEL), 'Clear Editor History');
registry.registerWorkbenchAction(SyncActionDescriptor.create(RevertAndCloseEditorAction, RevertAndCloseEditorAction.ID, RevertAndCloseEditorAction.LABEL), 'View: Revert and Close Editor', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(EditorLayoutSingleAction, EditorLayoutSingleAction.ID, EditorLayoutSingleAction.LABEL), 'View: Single Column Editor Layout', category);
@@ -389,11 +425,14 @@ registry.registerWorkbenchAction(SyncActionDescriptor.create(EditorLayoutTwoByTw
registry.registerWorkbenchAction(SyncActionDescriptor.create(EditorLayoutTwoRowsRightAction, EditorLayoutTwoRowsRightAction.ID, EditorLayoutTwoRowsRightAction.LABEL), 'View: Two Rows Right Editor Layout', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(EditorLayoutTwoColumnsBottomAction, EditorLayoutTwoColumnsBottomAction.ID, EditorLayoutTwoColumnsBottomAction.LABEL), 'View: Two Columns Bottom Editor Layout', category);
// Register Editor Picker Actions including quick navigate support
const openNextEditorKeybinding = { primary: KeyMod.CtrlCmd | KeyCode.Tab, mac: { primary: KeyMod.WinCtrl | KeyCode.Tab } };
const openPreviousEditorKeybinding = { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Tab, mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.Tab } };
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenNextRecentlyUsedEditorInGroupAction, OpenNextRecentlyUsedEditorInGroupAction.ID, OpenNextRecentlyUsedEditorInGroupAction.LABEL, openNextEditorKeybinding), 'View: Open Next Recently Used Editor in Group', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenPreviousRecentlyUsedEditorInGroupAction, OpenPreviousRecentlyUsedEditorInGroupAction.ID, OpenPreviousRecentlyUsedEditorInGroupAction.LABEL, openPreviousEditorKeybinding), 'View: Open Previous Recently Used Editor in Group', category);
// Register Quick Editor Actions including built in quick navigate support for some
const quickOpenNextRecentlyUsedEditorInGroupKeybinding = { primary: KeyMod.CtrlCmd | KeyCode.Tab, mac: { primary: KeyMod.WinCtrl | KeyCode.Tab } };
const quickOpenPreviousRecentlyUsedEditorInGroupKeybinding = { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Tab, mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.Tab } };
registry.registerWorkbenchAction(SyncActionDescriptor.create(QuickOpenNextRecentlyUsedEditorAction, QuickOpenNextRecentlyUsedEditorAction.ID, QuickOpenNextRecentlyUsedEditorAction.LABEL), 'View: Quick Open Next Recently Used Editor', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(QuickOpenPreviousRecentlyUsedEditorAction, QuickOpenPreviousRecentlyUsedEditorAction.ID, QuickOpenPreviousRecentlyUsedEditorAction.LABEL), 'View: Quick Open Previous Recently Used Editor', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(QuickOpenNextRecentlyUsedEditorInGroupAction, QuickOpenNextRecentlyUsedEditorInGroupAction.ID, QuickOpenNextRecentlyUsedEditorInGroupAction.LABEL, quickOpenNextRecentlyUsedEditorInGroupKeybinding), 'View: Quick Open Next Recently Used Editor in Group', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(QuickOpenPreviousRecentlyUsedEditorInGroupAction, QuickOpenPreviousRecentlyUsedEditorInGroupAction.ID, QuickOpenPreviousRecentlyUsedEditorInGroupAction.LABEL, quickOpenPreviousRecentlyUsedEditorInGroupKeybinding), 'View: Quick Open Previous Recently Used Editor in Group', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(QuickOpenPreviousEditorFromHistoryAction, QuickOpenPreviousEditorFromHistoryAction.ID, QuickOpenPreviousEditorFromHistoryAction.LABEL), 'Quick Open Previous Editor from History');
const quickOpenNavigateNextInEditorPickerId = 'workbench.action.quickOpenNavigateNextInEditorPicker';
KeybindingsRegistry.registerCommandAndKeybindingRule({
@@ -401,8 +440,8 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
weight: KeybindingWeight.WorkbenchContrib + 50,
handler: getQuickNavigateHandler(quickOpenNavigateNextInEditorPickerId, true),
when: editorPickerContext,
primary: openNextEditorKeybinding.primary,
mac: openNextEditorKeybinding.mac
primary: quickOpenNextRecentlyUsedEditorInGroupKeybinding.primary,
mac: quickOpenNextRecentlyUsedEditorInGroupKeybinding.mac
});
const quickOpenNavigatePreviousInEditorPickerId = 'workbench.action.quickOpenNavigatePreviousInEditorPicker';
@@ -411,8 +450,8 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
weight: KeybindingWeight.WorkbenchContrib + 50,
handler: getQuickNavigateHandler(quickOpenNavigatePreviousInEditorPickerId, false),
when: editorPickerContext,
primary: openPreviousEditorKeybinding.primary,
mac: openPreviousEditorKeybinding.mac
primary: quickOpenPreviousRecentlyUsedEditorInGroupKeybinding.primary,
mac: quickOpenPreviousRecentlyUsedEditorInGroupKeybinding.mac
});
// Editor Commands
@@ -603,7 +642,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarRecentMenu, {
group: '1_editor',
command: {
id: ReopenClosedEditorAction.ID,
title: nls.localize({ key: 'miReopenClosedEditor', comment: ['&& denotes a mnemonic'] }, "&&Reopen Closed Editor")
title: nls.localize({ key: 'miReopenClosedEditor', comment: ['&& denotes a mnemonic'] }, "&&Reopen Closed Editor"),
precondition: ContextKeyExpr.has('canReopenClosedEditor')
},
order: 1
});
@@ -786,19 +826,55 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
});
MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
group: '2_used',
group: '2_any_used',
command: {
id: 'workbench.action.openNextRecentlyUsedEditorInGroup',
title: nls.localize({ key: 'miNextEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Used Editor in Group")
id: 'workbench.action.openNextRecentlyUsedEditor',
title: nls.localize({ key: 'miNextRecentlyUsedEditor', comment: ['&& denotes a mnemonic'] }, "&&Next Used Editor")
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
group: '2_used',
group: '2_any_used',
command: {
id: 'workbench.action.openPreviousRecentlyUsedEditor',
title: nls.localize({ key: 'miPreviousRecentlyUsedEditor', comment: ['&& denotes a mnemonic'] }, "&&Previous Used Editor")
},
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
group: '3_group',
command: {
id: 'workbench.action.nextEditorInGroup',
title: nls.localize({ key: 'miNextEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Editor in Group")
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
group: '3_group',
command: {
id: 'workbench.action.previousEditorInGroup',
title: nls.localize({ key: 'miPreviousEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Editor in Group")
},
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
group: '4_group_used',
command: {
id: 'workbench.action.openNextRecentlyUsedEditorInGroup',
title: nls.localize({ key: 'miNextUsedEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Used Editor in Group")
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
group: '4_group_used',
command: {
id: 'workbench.action.openPreviousRecentlyUsedEditorInGroup',
title: nls.localize({ key: 'miPreviousEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Used Editor in Group")
title: nls.localize({ key: 'miPreviousUsedEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Used Editor in Group")
},
order: 2
});
@@ -833,7 +909,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '1_focus_index',
command: {
id: 'workbench.action.focusThirdEditorGroup',
title: nls.localize({ key: 'miFocusThirdGroup', comment: ['&& denotes a mnemonic'] }, "Group &&3")
title: nls.localize({ key: 'miFocusThirdGroup', comment: ['&& denotes a mnemonic'] }, "Group &&3"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 3
});
@@ -842,7 +919,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '1_focus_index',
command: {
id: 'workbench.action.focusFourthEditorGroup',
title: nls.localize({ key: 'miFocusFourthGroup', comment: ['&& denotes a mnemonic'] }, "Group &&4")
title: nls.localize({ key: 'miFocusFourthGroup', comment: ['&& denotes a mnemonic'] }, "Group &&4"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 4
});
@@ -851,7 +929,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '1_focus_index',
command: {
id: 'workbench.action.focusFifthEditorGroup',
title: nls.localize({ key: 'miFocusFifthGroup', comment: ['&& denotes a mnemonic'] }, "Group &&5")
title: nls.localize({ key: 'miFocusFifthGroup', comment: ['&& denotes a mnemonic'] }, "Group &&5"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 5
});
@@ -860,7 +939,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '2_next_prev',
command: {
id: 'workbench.action.focusNextGroup',
title: nls.localize({ key: 'miNextGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Group")
title: nls.localize({ key: 'miNextGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Group"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 1
});
@@ -869,7 +949,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '2_next_prev',
command: {
id: 'workbench.action.focusPreviousGroup',
title: nls.localize({ key: 'miPreviousGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Group")
title: nls.localize({ key: 'miPreviousGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Group"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 2
});
@@ -878,7 +959,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '3_directional',
command: {
id: 'workbench.action.focusLeftGroup',
title: nls.localize({ key: 'miFocusLeftGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Left")
title: nls.localize({ key: 'miFocusLeftGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Left"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 1
});
@@ -887,7 +969,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '3_directional',
command: {
id: 'workbench.action.focusRightGroup',
title: nls.localize({ key: 'miFocusRightGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Right")
title: nls.localize({ key: 'miFocusRightGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Right"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 2
});
@@ -896,7 +979,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '3_directional',
command: {
id: 'workbench.action.focusAboveGroup',
title: nls.localize({ key: 'miFocusAboveGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Above")
title: nls.localize({ key: 'miFocusAboveGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Above"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 3
});
@@ -905,7 +989,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '3_directional',
command: {
id: 'workbench.action.focusBelowGroup',
title: nls.localize({ key: 'miFocusBelowGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Below")
title: nls.localize({ key: 'miFocusBelowGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Below"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 4
});

View File

@@ -15,7 +15,7 @@ import { IResourceInput } from 'vs/platform/editor/common/editor';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { CLOSE_EDITOR_COMMAND_ID, NAVIGATE_ALL_EDITORS_GROUP_PREFIX, MOVE_ACTIVE_EDITOR_COMMAND_ID, NAVIGATE_IN_ACTIVE_GROUP_PREFIX, ActiveEditorMoveArguments, SPLIT_EDITOR_LEFT, SPLIT_EDITOR_RIGHT, SPLIT_EDITOR_UP, SPLIT_EDITOR_DOWN, splitEditor, LAYOUT_EDITOR_GROUPS_COMMAND_ID, mergeAllGroups } from 'vs/workbench/browser/parts/editor/editorCommands';
import { CLOSE_EDITOR_COMMAND_ID, NAVIGATE_ALL_EDITORS_BY_APPEARANCE_PREFIX, MOVE_ACTIVE_EDITOR_COMMAND_ID, NAVIGATE_IN_ACTIVE_GROUP_BY_MOST_RECENTLY_USED_PREFIX, ActiveEditorMoveArguments, SPLIT_EDITOR_LEFT, SPLIT_EDITOR_RIGHT, SPLIT_EDITOR_UP, SPLIT_EDITOR_DOWN, splitEditor, LAYOUT_EDITOR_GROUPS_COMMAND_ID, mergeAllGroups, NAVIGATE_ALL_EDITORS_BY_MOST_RECENTLY_USED_PREFIX } from 'vs/workbench/browser/parts/editor/editorCommands';
import { IEditorGroupsService, IEditorGroup, GroupsArrangement, EditorsOrder, GroupLocation, GroupDirection, preferredSideBySideGroupDirection, IFindGroupScope, GroupOrientation, EditorGroupLayout, GroupsOrder } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@@ -1258,35 +1258,54 @@ export class ClearRecentFilesAction extends Action {
}
}
export class ShowEditorsInActiveGroupAction extends QuickOpenAction {
export class ShowEditorsInActiveGroupByMostRecentlyUsedAction extends QuickOpenAction {
static readonly ID = 'workbench.action.showEditorsInActiveGroup';
static readonly LABEL = nls.localize('showEditorsInActiveGroup', "Show Editors in Active Group");
static readonly LABEL = nls.localize('showEditorsInActiveGroup', "Show Editors in Active Group By Most Recently Used");
constructor(
actionId: string,
actionLabel: string,
@IQuickOpenService quickOpenService: IQuickOpenService
) {
super(actionId, actionLabel, NAVIGATE_IN_ACTIVE_GROUP_PREFIX, quickOpenService);
super(actionId, actionLabel, NAVIGATE_IN_ACTIVE_GROUP_BY_MOST_RECENTLY_USED_PREFIX, quickOpenService);
}
}
export class ShowAllEditorsAction extends QuickOpenAction {
export class ShowAllEditorsByAppearanceAction extends QuickOpenAction {
static readonly ID = 'workbench.action.showAllEditors';
static readonly LABEL = nls.localize('showAllEditors', "Show All Editors");
static readonly LABEL = nls.localize('showAllEditors', "Show All Editors By Appearance");
constructor(actionId: string, actionLabel: string, @IQuickOpenService quickOpenService: IQuickOpenService) {
super(actionId, actionLabel, NAVIGATE_ALL_EDITORS_GROUP_PREFIX, quickOpenService);
constructor(
actionId: string,
actionLabel: string,
@IQuickOpenService quickOpenService: IQuickOpenService
) {
super(actionId, actionLabel, NAVIGATE_ALL_EDITORS_BY_APPEARANCE_PREFIX, quickOpenService);
}
}
export class BaseQuickOpenEditorInGroupAction extends Action {
export class ShowAllEditorsByMostRecentlyUsedAction extends QuickOpenAction {
static readonly ID = 'workbench.action.showAllEditorsByMostRecentlyUsed';
static readonly LABEL = nls.localize('showAllEditorsByMostRecentlyUsed', "Show All Editors By Most Recently Used");
constructor(
actionId: string,
actionLabel: string,
@IQuickOpenService quickOpenService: IQuickOpenService
) {
super(actionId, actionLabel, NAVIGATE_ALL_EDITORS_BY_MOST_RECENTLY_USED_PREFIX, quickOpenService);
}
}
export class BaseQuickOpenEditorAction extends Action {
constructor(
id: string,
label: string,
private prefix: string,
@IQuickOpenService private readonly quickOpenService: IQuickOpenService,
@IKeybindingService private readonly keybindingService: IKeybindingService
) {
@@ -1294,18 +1313,18 @@ export class BaseQuickOpenEditorInGroupAction extends Action {
}
run(): Promise<any> {
const keys = this.keybindingService.lookupKeybindings(this.id);
const keybindings = this.keybindingService.lookupKeybindings(this.id);
this.quickOpenService.show(NAVIGATE_IN_ACTIVE_GROUP_PREFIX, { quickNavigateConfiguration: { keybindings: keys } });
this.quickOpenService.show(this.prefix, { quickNavigateConfiguration: { keybindings } });
return Promise.resolve(true);
}
}
export class OpenPreviousRecentlyUsedEditorInGroupAction extends BaseQuickOpenEditorInGroupAction {
export class QuickOpenPreviousRecentlyUsedEditorAction extends BaseQuickOpenEditorAction {
static readonly ID = 'workbench.action.openPreviousRecentlyUsedEditorInGroup';
static readonly LABEL = nls.localize('openPreviousRecentlyUsedEditorInGroup', "Open Previous Recently Used Editor in Group");
static readonly ID = 'workbench.action.quickOpenPreviousRecentlyUsedEditor';
static readonly LABEL = nls.localize('quickOpenPreviousRecentlyUsedEditor', "Quick Open Previous Recently Used Editor");
constructor(
id: string,
@@ -1313,14 +1332,14 @@ export class OpenPreviousRecentlyUsedEditorInGroupAction extends BaseQuickOpenEd
@IQuickOpenService quickOpenService: IQuickOpenService,
@IKeybindingService keybindingService: IKeybindingService
) {
super(id, label, quickOpenService, keybindingService);
super(id, label, NAVIGATE_ALL_EDITORS_BY_MOST_RECENTLY_USED_PREFIX, quickOpenService, keybindingService);
}
}
export class OpenNextRecentlyUsedEditorInGroupAction extends BaseQuickOpenEditorInGroupAction {
export class QuickOpenNextRecentlyUsedEditorAction extends BaseQuickOpenEditorAction {
static readonly ID = 'workbench.action.openNextRecentlyUsedEditorInGroup';
static readonly LABEL = nls.localize('openNextRecentlyUsedEditorInGroup', "Open Next Recently Used Editor in Group");
static readonly ID = 'workbench.action.quickOpenNextRecentlyUsedEditor';
static readonly LABEL = nls.localize('quickOpenNextRecentlyUsedEditor', "Quick Open Next Recently Used Editor");
constructor(
id: string,
@@ -1328,14 +1347,44 @@ export class OpenNextRecentlyUsedEditorInGroupAction extends BaseQuickOpenEditor
@IQuickOpenService quickOpenService: IQuickOpenService,
@IKeybindingService keybindingService: IKeybindingService
) {
super(id, label, quickOpenService, keybindingService);
super(id, label, NAVIGATE_ALL_EDITORS_BY_MOST_RECENTLY_USED_PREFIX, quickOpenService, keybindingService);
}
}
export class OpenPreviousEditorFromHistoryAction extends Action {
export class QuickOpenPreviousRecentlyUsedEditorInGroupAction extends BaseQuickOpenEditorAction {
static readonly ID = 'workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup';
static readonly LABEL = nls.localize('quickOpenPreviousRecentlyUsedEditorInGroup', "Quick Open Previous Recently Used Editor in Group");
constructor(
id: string,
label: string,
@IQuickOpenService quickOpenService: IQuickOpenService,
@IKeybindingService keybindingService: IKeybindingService
) {
super(id, label, NAVIGATE_IN_ACTIVE_GROUP_BY_MOST_RECENTLY_USED_PREFIX, quickOpenService, keybindingService);
}
}
export class QuickOpenNextRecentlyUsedEditorInGroupAction extends BaseQuickOpenEditorAction {
static readonly ID = 'workbench.action.quickOpenNextRecentlyUsedEditorInGroup';
static readonly LABEL = nls.localize('quickOpenNextRecentlyUsedEditorInGroup', "Quick Open Next Recently Used Editor in Group");
constructor(
id: string,
label: string,
@IQuickOpenService quickOpenService: IQuickOpenService,
@IKeybindingService keybindingService: IKeybindingService
) {
super(id, label, NAVIGATE_IN_ACTIVE_GROUP_BY_MOST_RECENTLY_USED_PREFIX, quickOpenService, keybindingService);
}
}
export class QuickOpenPreviousEditorFromHistoryAction extends Action {
static readonly ID = 'workbench.action.openPreviousEditorFromHistory';
static readonly LABEL = nls.localize('navigateEditorHistoryByInput', "Open Previous Editor from History");
static readonly LABEL = nls.localize('navigateEditorHistoryByInput', "Quick Open Previous Editor from History");
constructor(
id: string,
@@ -1347,9 +1396,9 @@ export class OpenPreviousEditorFromHistoryAction extends Action {
}
run(): Promise<any> {
const keys = this.keybindingService.lookupKeybindings(this.id);
const keybindings = this.keybindingService.lookupKeybindings(this.id);
this.quickOpenService.show(undefined, { quickNavigateConfiguration: { keybindings: keys } });
this.quickOpenService.show(undefined, { quickNavigateConfiguration: { keybindings } });
return Promise.resolve(true);
}
@@ -1360,12 +1409,16 @@ export class OpenNextRecentlyUsedEditorAction extends Action {
static readonly ID = 'workbench.action.openNextRecentlyUsedEditor';
static readonly LABEL = nls.localize('openNextRecentlyUsedEditor', "Open Next Recently Used Editor");
constructor(id: string, label: string, @IHistoryService private readonly historyService: IHistoryService) {
constructor(
id: string,
label: string,
@IHistoryService private readonly historyService: IHistoryService
) {
super(id, label);
}
run(): Promise<any> {
this.historyService.forward(true);
this.historyService.openNextRecentlyUsedEditor();
return Promise.resolve();
}
@@ -1376,12 +1429,58 @@ export class OpenPreviousRecentlyUsedEditorAction extends Action {
static readonly ID = 'workbench.action.openPreviousRecentlyUsedEditor';
static readonly LABEL = nls.localize('openPreviousRecentlyUsedEditor', "Open Previous Recently Used Editor");
constructor(id: string, label: string, @IHistoryService private readonly historyService: IHistoryService) {
constructor(
id: string,
label: string,
@IHistoryService private readonly historyService: IHistoryService
) {
super(id, label);
}
run(): Promise<any> {
this.historyService.back(true);
this.historyService.openPreviouslyUsedEditor();
return Promise.resolve();
}
}
export class OpenNextRecentlyUsedEditorInGroupAction extends Action {
static readonly ID = 'workbench.action.openNextRecentlyUsedEditorInGroup';
static readonly LABEL = nls.localize('openNextRecentlyUsedEditorInGroup', "Open Next Recently Used Editor In Group");
constructor(
id: string,
label: string,
@IHistoryService private readonly historyService: IHistoryService,
@IEditorGroupsService private readonly editorGroupsService: IEditorGroupsService
) {
super(id, label);
}
run(): Promise<any> {
this.historyService.openNextRecentlyUsedEditor(this.editorGroupsService.activeGroup.id);
return Promise.resolve();
}
}
export class OpenPreviousRecentlyUsedEditorInGroupAction extends Action {
static readonly ID = 'workbench.action.openPreviousRecentlyUsedEditorInGroup';
static readonly LABEL = nls.localize('openPreviousRecentlyUsedEditorInGroup', "Open Previous Recently Used Editor In Group");
constructor(
id: string,
label: string,
@IHistoryService private readonly historyService: IHistoryService,
@IEditorGroupsService private readonly editorGroupsService: IEditorGroupsService
) {
super(id, label);
}
run(): Promise<any> {
this.historyService.openPreviouslyUsedEditor(this.editorGroupsService.activeGroup.id);
return Promise.resolve();
}

View File

@@ -46,8 +46,9 @@ export const SPLIT_EDITOR_DOWN = 'workbench.action.splitEditorDown';
export const SPLIT_EDITOR_LEFT = 'workbench.action.splitEditorLeft';
export const SPLIT_EDITOR_RIGHT = 'workbench.action.splitEditorRight';
export const NAVIGATE_ALL_EDITORS_GROUP_PREFIX = 'edt ';
export const NAVIGATE_IN_ACTIVE_GROUP_PREFIX = 'edt active ';
export const NAVIGATE_ALL_EDITORS_BY_APPEARANCE_PREFIX = 'edt ';
export const NAVIGATE_ALL_EDITORS_BY_MOST_RECENTLY_USED_PREFIX = 'edt mru ';
export const NAVIGATE_IN_ACTIVE_GROUP_BY_MOST_RECENTLY_USED_PREFIX = 'edt active ';
export const OPEN_EDITOR_AT_INDEX_COMMAND_ID = 'workbench.action.openEditorAtIndex';
@@ -665,10 +666,6 @@ function registerCloseEditorCommands() {
const editorGroupService = accessor.get(IEditorGroupsService);
const quickOpenService = accessor.get(IQuickOpenService);
if (editorGroupService.count <= 1) {
return quickOpenService.show(NAVIGATE_ALL_EDITORS_GROUP_PREFIX);
}
const commandsContext = getCommandsContext(resourceOrContext, context);
if (commandsContext && typeof commandsContext.groupId === 'number') {
const group = editorGroupService.getGroup(commandsContext.groupId);
@@ -677,7 +674,7 @@ function registerCloseEditorCommands() {
}
}
return quickOpenService.show(NAVIGATE_IN_ACTIVE_GROUP_PREFIX);
return quickOpenService.show(NAVIGATE_IN_ACTIVE_GROUP_BY_MOST_RECENTLY_USED_PREFIX);
}
});

View File

@@ -18,6 +18,11 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { RunOnceScheduler } from 'vs/base/common/async';
import { find } from 'vs/base/common/arrays';
import { DataTransfers } from 'vs/base/browser/dnd';
import { IUntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService';
import { VSBuffer } from 'vs/base/common/buffer';
import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs';
import { URI } from 'vs/base/common/uri';
import { joinPath } from 'vs/base/common/resources';
interface IDropOperation {
splitDirection?: GroupDirection;
@@ -41,8 +46,10 @@ class DropOverlay extends Themable {
constructor(
private accessor: IEditorGroupsAccessor,
private groupView: IEditorGroupView,
themeService: IThemeService,
private instantiationService: IInstantiationService
@IThemeService themeService: IThemeService,
@IInstantiationService private instantiationService: IInstantiationService,
@IUntitledTextEditorService private untitledTextEditorService: IUntitledTextEditorService,
@IFileDialogService private readonly fileDialogService: IFileDialogService
) {
super(themeService);
@@ -100,10 +107,6 @@ class DropOverlay extends Themable {
this._register(new DragAndDropObserver(this.container, {
onDragEnter: e => undefined,
onDragOver: e => {
if (isWeb && containsDragType(e, DataTransfers.FILES)) {
return; // dropping files into editor is unsupported on web
}
const isDraggingGroup = this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype);
const isDraggingEditor = this.editorTransfer.hasData(DraggedEditorIdentifier.prototype);
@@ -281,6 +284,45 @@ class DropOverlay extends Themable {
}
}
// Web: check for file transfer
else if (isWeb && containsDragType(event, DataTransfers.FILES)) {
let targetGroup: IEditorGroupView | undefined = undefined;
const files = event.dataTransfer?.files;
if (files) {
for (let i = 0; i < files.length; i++) {
const file = files.item(i);
if (file) {
const reader = new FileReader();
reader.readAsArrayBuffer(file);
reader.onload = async event => {
const name = file.name;
if (typeof name === 'string' && event.target?.result instanceof ArrayBuffer) {
// Try to come up with a good file path for the untitled
// editor by asking the file dialog service for the default
let proposedFilePath: URI | undefined = undefined;
const defaultFilePath = this.fileDialogService.defaultFilePath();
if (defaultFilePath) {
proposedFilePath = joinPath(defaultFilePath, name);
}
// Open as untitled file with the provided contents
const contents = VSBuffer.wrap(new Uint8Array(event.target.result)).toString();
const untitledEditor = this.untitledTextEditorService.createOrGet(proposedFilePath, undefined, contents);
if (!targetGroup) {
targetGroup = ensureTargetGroup();
}
await targetGroup.openEditor(untitledEditor);
}
};
}
}
}
}
// Check for URI transfer
else {
const dropHandler = this.instantiationService.createInstance(ResourcesDropHandler, { allowWorkspaceOpen: true /* open workspace instead of file if dropped */ });
@@ -532,7 +574,7 @@ export class EditorDropTarget extends Themable {
if (!this.overlay) {
const targetGroupView = this.findTargetGroupView(target);
if (targetGroupView) {
this._overlay = new DropOverlay(this.accessor, targetGroupView, this.themeService, this.instantiationService);
this._overlay = this.instantiationService.createInstance(DropOverlay, this.accessor, targetGroupView);
}
}
}

View File

@@ -49,7 +49,7 @@ import { hash } from 'vs/base/common/hash';
import { guessMimeTypes } from 'vs/base/common/mime';
import { extname } from 'vs/base/common/resources';
import { Schemas } from 'vs/base/common/network';
import { EditorActivation, EditorOpenContext } from 'vs/platform/editor/common/editor';
import { EditorActivation, EditorOpenContext, IResourceInput } from 'vs/platform/editor/common/editor';
import { IDialogService, IFileDialogService, ConfirmResult } from 'vs/platform/dialogs/common/dialogs';
import { ILogService } from 'vs/platform/log/common/log';
@@ -768,7 +768,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
return this._group.indexOf(editor);
}
isOpened(editor: EditorInput): boolean {
isOpened(editor: EditorInput | IResourceInput): boolean {
return this._group.contains(editor);
}
@@ -785,14 +785,16 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
this._onDidFocus.fire();
}
pinEditor(editor: EditorInput | undefined = this.activeEditor || undefined): void {
if (editor && !this._group.isPinned(editor)) {
pinEditor(candidate: EditorInput | undefined = this.activeEditor || undefined): void {
if (candidate && !this._group.isPinned(candidate)) {
// Update model
this._group.pin(editor);
const editor = this._group.pin(candidate);
// Forward to title control
this.titleAreaControl.pinEditor(editor);
if (editor) {
this.titleAreaControl.pinEditor(editor);
}
}
}
@@ -880,11 +882,13 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
}
}
// Update model
this._group.openEditor(editor, openEditorOptions);
// Update model and make sure to continue to use the editor we get from
// the model. It is possible that the editor was already opened and we
// want to ensure that we use the existing instance in that case.
const openedEditor = this._group.openEditor(editor, openEditorOptions);
// Show editor
return this.doShowEditor(editor, !!openEditorOptions.active, options);
return this.doShowEditor(openedEditor, !!openEditorOptions.active, options);
}
private async doShowEditor(editor: EditorInput, active: boolean, options?: EditorOptions): Promise<IEditor | undefined> {
@@ -1053,17 +1057,22 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
}
}
private doMoveEditorInsideGroup(editor: EditorInput, moveOptions?: IMoveEditorOptions): void {
private doMoveEditorInsideGroup(candidate: EditorInput, moveOptions?: IMoveEditorOptions): void {
const moveToIndex = moveOptions ? moveOptions.index : undefined;
if (typeof moveToIndex !== 'number') {
return; // do nothing if we move into same group without index
}
const currentIndex = this._group.indexOf(editor);
if (currentIndex === moveToIndex) {
return; // do nothing if editor is already at the given index
const currentIndex = this._group.indexOf(candidate);
if (currentIndex === -1 || currentIndex === moveToIndex) {
return; // do nothing if editor unknown in model or is already at the given index
}
// Update model and make sure to continue to use the editor we get from
// the model. It is possible that the editor was already opened and we
// want to ensure that we use the existing instance in that case.
const editor = this.group.getEditorByIndex(currentIndex)!;
// Update model
this._group.moveEditor(editor, moveToIndex);
this._group.pin(editor);

View File

@@ -240,7 +240,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
const mostRecentActive = coalesce(this.mostRecentActiveGroups.map(groupId => this.getGroup(groupId)));
// there can be groups that got never active, even though they exist. in this case
// make sure to ust append them at the end so that all groups are returned properly
// make sure to just append them at the end so that all groups are returned properly
return distinct([...mostRecentActive, ...this.groups]);
case GroupsOrder.GRID_APPEARANCE:
@@ -544,7 +544,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
this.groupViews.set(groupView.id, groupView);
// Track focus
let groupDisposables = new DisposableStore();
const groupDisposables = new DisposableStore();
groupDisposables.add(groupView.onDidFocus(() => {
this.doSetGroupActive(groupView);
}));

View File

@@ -18,6 +18,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { toResource, SideBySideEditor, IEditorInput } from 'vs/workbench/common/editor';
import { compareItemsByScore, scoreItem, ScorerCache, prepareQuery } from 'vs/base/parts/quickopen/common/quickOpenScorer';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
export class EditorPickerEntry extends QuickOpenEntryGroup {
@@ -144,28 +145,9 @@ export abstract class BaseEditorPicker extends QuickOpenHandler {
this.scorerCache = Object.create(null);
}
protected abstract count(): number;
protected abstract getEditorEntries(): EditorPickerEntry[];
}
export class ActiveEditorGroupPicker extends BaseEditorPicker {
static readonly ID = 'workbench.picker.activeEditors';
protected getEditorEntries(): EditorPickerEntry[] {
return this.group.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE).map((editor, index) => this.instantiationService.createInstance(EditorPickerEntry, editor, this.group));
}
private get group(): IEditorGroup {
return this.editorGroupService.activeGroup;
}
getEmptyLabel(searchString: string): string {
if (searchString) {
return nls.localize('noResultsFoundInGroup', "No matching opened editor found in group");
}
return nls.localize('noOpenedEditors', "List of opened editors is currently empty in group");
}
getAutoFocus(searchValue: string, context: { model: IModel<QuickOpenEntry>, quickNavigateConfiguration?: IQuickNavigateConfiguration }): IAutoFocus {
if (searchValue || !context.quickNavigateConfiguration) {
@@ -189,7 +171,7 @@ export class ActiveEditorGroupPicker extends BaseEditorPicker {
};
}
const editors = this.group.count;
const editors = this.count();
return {
autoFocusFirstEntry: editors === 1,
autoFocusSecondEntry: editors > 1
@@ -197,20 +179,44 @@ export class ActiveEditorGroupPicker extends BaseEditorPicker {
}
}
export class AllEditorsPicker extends BaseEditorPicker {
export class ActiveGroupEditorsByMostRecentlyUsedPicker extends BaseEditorPicker {
static readonly ID = 'workbench.picker.editors';
static readonly ID = 'workbench.picker.activeGroupEditorsByMostRecentlyUsed';
protected count(): number {
return this.group.count;
}
protected getEditorEntries(): EditorPickerEntry[] {
const entries: EditorPickerEntry[] = [];
return this.group.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE).map(editor => this.instantiationService.createInstance(EditorPickerEntry, editor, this.group));
}
this.editorGroupService.getGroups(GroupsOrder.GRID_APPEARANCE).forEach(group => {
group.editors.forEach(editor => {
entries.push(this.instantiationService.createInstance(EditorPickerEntry, editor, group));
});
});
private get group(): IEditorGroup {
return this.editorGroupService.activeGroup;
}
return entries;
getEmptyLabel(searchString: string): string {
if (searchString) {
return nls.localize('noResultsFoundInGroup', "No matching opened editor found in active editor group");
}
return nls.localize('noOpenedEditors', "List of opened editors is currently empty in active editor group");
}
}
export abstract class BaseAllEditorsPicker extends BaseEditorPicker {
constructor(
@IInstantiationService instantiationService: IInstantiationService,
@IEditorService editorService: IEditorService,
@IEditorGroupsService editorGroupService: IEditorGroupsService,
@IHistoryService protected historyService: IHistoryService
) {
super(instantiationService, editorService, editorGroupService);
}
protected count(): number {
return this.historyService.getMostRecentlyUsedOpenEditors().length;
}
getEmptyLabel(searchString: string): string {
@@ -231,3 +237,35 @@ export class AllEditorsPicker extends BaseEditorPicker {
return super.getAutoFocus(searchValue, context);
}
}
export class AllEditorsByAppearancePicker extends BaseAllEditorsPicker {
static readonly ID = 'workbench.picker.editorsByAppearance';
protected getEditorEntries(): EditorPickerEntry[] {
const entries: EditorPickerEntry[] = [];
for (const group of this.editorGroupService.getGroups(GroupsOrder.GRID_APPEARANCE)) {
for (const editor of group.getEditors(EditorsOrder.SEQUENTIAL)) {
entries.push(this.instantiationService.createInstance(EditorPickerEntry, editor, group));
}
}
return entries;
}
}
export class AllEditorsByMostRecentlyUsedPicker extends BaseAllEditorsPicker {
static readonly ID = 'workbench.picker.editorsByMostRecentlyUsed';
protected getEditorEntries(): EditorPickerEntry[] {
const entries: EditorPickerEntry[] = [];
for (const { editor, groupId } of this.historyService.getMostRecentlyUsedOpenEditors()) {
entries.push(this.instantiationService.createInstance(EditorPickerEntry, editor, this.editorGroupService.getGroup(groupId)!));
}
return entries;
}
}

View File

@@ -36,7 +36,7 @@ import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common
import { ITextFileService, SUPPORTED_ENCODINGS } from 'vs/workbench/services/textfile/common/textfiles';
import { ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
import { ConfigurationChangedEvent, IEditorOptions, EditorOption } from 'vs/editor/common/config/editorOptions';
import { IResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { deepClone } from 'vs/base/common/objects';
import { ICodeEditor, getCodeEditor } from 'vs/editor/browser/editorBrowser';
@@ -1161,12 +1161,12 @@ export class ChangeModeAction extends Action {
// If the association is already being made in the workspace, make sure to target workspace settings
let target = ConfigurationTarget.USER;
if (fileAssociationsConfig.workspace && !!(fileAssociationsConfig.workspace as any)[associationKey]) {
if (fileAssociationsConfig.workspaceValue && !!(fileAssociationsConfig.workspaceValue as any)[associationKey]) {
target = ConfigurationTarget.WORKSPACE;
}
// Make sure to write into the value of the target and not the merged value from USER and WORKSPACE config
const currentAssociations = deepClone((target === ConfigurationTarget.WORKSPACE) ? fileAssociationsConfig.workspace : fileAssociationsConfig.user) || Object.create(null);
const currentAssociations = deepClone((target === ConfigurationTarget.WORKSPACE) ? fileAssociationsConfig.workspaceValue : fileAssociationsConfig.userValue) || Object.create(null);
currentAssociations[associationKey] = language.id;
this.configurationService.updateValue(FILES_ASSOCIATIONS_CONFIG, currentAssociations, target);
@@ -1249,7 +1249,7 @@ export class ChangeEncodingAction extends Action {
actionLabel: string,
@IEditorService private readonly editorService: IEditorService,
@IQuickInputService private readonly quickInputService: IQuickInputService,
@IResourceConfigurationService private readonly textResourceConfigurationService: IResourceConfigurationService,
@ITextResourceConfigurationService private readonly textResourceConfigurationService: ITextResourceConfigurationService,
@IFileService private readonly fileService: IFileService,
@ITextFileService private readonly textFileService: ITextFileService
) {

View File

@@ -16,7 +16,7 @@ import { DiffEditorWidget } from 'vs/editor/browser/widget/diffEditorWidget';
import { TextDiffEditorModel } from 'vs/workbench/common/editor/textDiffEditorModel';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { TextFileOperationError, TextFileOperationResult } from 'vs/workbench/services/textfile/common/textfiles';
@@ -48,7 +48,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
@ITelemetryService telemetryService: ITelemetryService,
@IInstantiationService instantiationService: IInstantiationService,
@IStorageService storageService: IStorageService,
@IResourceConfigurationService configurationService: IResourceConfigurationService,
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,
@IEditorService editorService: IEditorService,
@IThemeService themeService: IThemeService,
@IEditorGroupsService editorGroupService: IEditorGroupsService,

View File

@@ -16,15 +16,13 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
import { isCodeEditor, getCodeEditor } from 'vs/editor/browser/editorBrowser';
import { IEditorGroupsService, IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
const TEXT_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'textEditorViewState';
export interface IEditorConfiguration {
editor: object;
diffEditor: object;
@@ -35,6 +33,9 @@ export interface IEditorConfiguration {
* be subclassed and not instantiated.
*/
export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
static readonly TEXT_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'textEditorViewState';
private editorControl: IEditor | undefined;
private editorContainer: HTMLElement | undefined;
private hasPendingConfigurationChange: boolean | undefined;
@@ -46,14 +47,14 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
@ITelemetryService telemetryService: ITelemetryService,
@IInstantiationService private readonly _instantiationService: IInstantiationService,
@IStorageService storageService: IStorageService,
@IResourceConfigurationService private readonly _configurationService: IResourceConfigurationService,
@ITextResourceConfigurationService private readonly _configurationService: ITextResourceConfigurationService,
@IThemeService protected themeService: IThemeService,
@IEditorService protected editorService: IEditorService,
@IEditorGroupsService protected editorGroupService: IEditorGroupsService
) {
super(id, telemetryService, themeService, storageService);
this.editorMemento = this.getEditorMemento<IEditorViewState>(editorGroupService, TEXT_EDITOR_VIEW_STATE_PREFERENCE_KEY, 100);
this.editorMemento = this.getEditorMemento<IEditorViewState>(editorGroupService, BaseTextEditor.TEXT_EDITOR_VIEW_STATE_PREFERENCE_KEY, 100);
this._register(this.configurationService.onDidChangeConfiguration(e => {
const resource = this.getResource();
@@ -66,7 +67,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
return this._instantiationService;
}
protected get configurationService(): IResourceConfigurationService {
protected get configurationService(): ITextResourceConfigurationService {
return this._configurationService;
}

View File

@@ -13,7 +13,7 @@ import { UntitledTextEditorInput } from 'vs/workbench/common/editor/untitledText
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { Event } from 'vs/base/common/event';
@@ -33,7 +33,7 @@ export class AbstractTextResourceEditor extends BaseTextEditor {
@ITelemetryService telemetryService: ITelemetryService,
@IInstantiationService instantiationService: IInstantiationService,
@IStorageService storageService: IStorageService,
@IResourceConfigurationService configurationService: IResourceConfigurationService,
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,
@IThemeService themeService: IThemeService,
@IEditorGroupsService editorGroupService: IEditorGroupsService,
@IEditorService editorService: IEditorService
@@ -184,7 +184,7 @@ export class TextResourceEditor extends AbstractTextResourceEditor {
@ITelemetryService telemetryService: ITelemetryService,
@IInstantiationService instantiationService: IInstantiationService,
@IStorageService storageService: IStorageService,
@IResourceConfigurationService configurationService: IResourceConfigurationService,
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,
@IThemeService themeService: IThemeService,
@IEditorService editorService: IEditorService,
@IEditorGroupsService editorGroupService: IEditorGroupsService

View File

@@ -16,7 +16,7 @@ import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
import { CancellationToken } from 'vs/base/common/cancellation';
import { QuickInputList } from './quickInputList';
import { QuickInputBox } from './quickInputBox';
import { KeyCode } from 'vs/base/common/keyCodes';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { localize } from 'vs/nls';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@@ -1396,7 +1396,7 @@ export class QuickInputService extends Component implements IQuickInputService {
this.setComboboxAccessibility(false);
ui.inputBox.removeAttribute('aria-label');
const keybinding = this.keybindingService.lookupKeybinding(BackAction.ID);
const keybinding = this.keybindingService.lookupKeybinding(QuickPickBack.id);
backButton.tooltip = keybinding ? localize('quickInput.backWithKeybinding', "Back ({0})", keybinding.getLabel()) : localize('quickInput.back', "Back");
this.inQuickOpen('quickInput', true);
@@ -1566,19 +1566,18 @@ export const QuickPickManyToggle: ICommandAndKeybindingRule = {
}
};
export class BackAction extends Action {
public static readonly ID = 'workbench.action.quickInputBack';
public static readonly LABEL = localize('back', "Back");
constructor(id: string, label: string, @IQuickInputService private readonly quickInputService: IQuickInputService) {
super(id, label);
export const QuickPickBack: ICommandAndKeybindingRule = {
id: 'workbench.action.quickInputBack',
weight: KeybindingWeight.WorkbenchContrib + 50,
when: inQuickOpenContext,
primary: 0,
win: { primary: KeyMod.Alt | KeyCode.LeftArrow },
mac: { primary: KeyMod.WinCtrl | KeyCode.US_MINUS },
linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_MINUS },
handler: accessor => {
const quickInputService = accessor.get(IQuickInputService);
quickInputService.back();
}
public run(): Promise<any> {
this.quickInputService.back();
return Promise.resolve();
}
}
};
registerSingleton(IQuickInputService, QuickInputService, true);

View File

@@ -3,15 +3,8 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { QuickPickManyToggle, BackAction } from 'vs/workbench/browser/parts/quickinput/quickInput';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { inQuickOpenContext } from 'vs/workbench/browser/parts/quickopen/quickopen';
import { QuickPickManyToggle, QuickPickBack } from 'vs/workbench/browser/parts/quickinput/quickInput';
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
KeybindingsRegistry.registerCommandAndKeybindingRule(QuickPickManyToggle);
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
registry.registerWorkbenchAction(SyncActionDescriptor.create(BackAction, BackAction.ID, BackAction.LABEL, { primary: 0, win: { primary: KeyMod.Alt | KeyCode.LeftArrow }, mac: { primary: KeyMod.WinCtrl | KeyCode.US_MINUS }, linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_MINUS } }, inQuickOpenContext, KeybindingWeight.WorkbenchContrib + 50), 'Back');
KeybindingsRegistry.registerCommandAndKeybindingRule(QuickPickBack);

View File

@@ -28,7 +28,7 @@ import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { Action } from 'vs/base/common/actions';
import { getIconClass } from 'vs/workbench/browser/parts/quickinput/quickInputUtils';
import { withNullAsUndefined } from 'vs/base/common/types';
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
import { QUICK_INPUT_BACKGROUND } from 'vs/workbench/common/theme';
const $ = dom.$;
@@ -254,7 +254,7 @@ export class QuickInputList {
multipleSelectionSupport: false,
horizontalScrolling: false,
overrideStyles: {
listBackground: SIDE_BAR_BACKGROUND
listBackground: QUICK_INPUT_BACKGROUND
}
} as IWorkbenchListOptions<ListElement>);
this.list.getHTMLElement().id = id;

View File

@@ -146,3 +146,7 @@
background-position: 50% 50%;
background-repeat: no-repeat;
}
.customview-tree .monaco-list .custom-view-tree-node-item .actions .action-label.codicon::before {
vertical-align: middle;
}

View File

@@ -36,7 +36,8 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IViewPaneContainer } from 'vs/workbench/common/viewPaneContainer';
import { Component } from 'vs/workbench/common/component';
import { Extensions, ViewletRegistry } from 'vs/workbench/browser/viewlet';
import { Extensions as ViewletExtensions, ViewletRegistry } from 'vs/workbench/browser/viewlet';
import { Extensions as PanelExtensions, PanelRegistry } from 'vs/workbench/browser/panel';
export interface IPaneColors extends IColorMapping {
dropBackground?: ColorIdentifier;
@@ -344,7 +345,8 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
}
getTitle(): string {
let title = Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlet(this.getId()).name;
const composite = Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets).getViewlet(this.getId()) || Registry.as<PanelRegistry>(PanelExtensions.Panels).getPanel(this.getId());
let title = composite.name;
if (this.isSingleView()) {
const paneItemTitle = this.paneItems[0].pane.title;

View File

@@ -44,6 +44,7 @@ import { WorkbenchContextKeysHandler } from 'vs/workbench/browser/contextkeys';
import { coalesce } from 'vs/base/common/arrays';
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
import { Layout } from 'vs/workbench/browser/layout';
import { IHostService } from 'vs/workbench/services/host/browser/host';
export class Workbench extends Layout {
@@ -140,6 +141,7 @@ export class Workbench extends Layout {
const lifecycleService = accessor.get(ILifecycleService);
const storageService = accessor.get(IStorageService);
const configurationService = accessor.get(IConfigurationService);
const hostService = accessor.get(IHostService);
// Layout
this.initLayout(accessor);
@@ -151,7 +153,7 @@ export class Workbench extends Layout {
this._register(instantiationService.createInstance(WorkbenchContextKeysHandler));
// Register Listeners
this.registerListeners(lifecycleService, storageService, configurationService);
this.registerListeners(lifecycleService, storageService, configurationService, hostService);
// Render Workbench
this.renderWorkbench(instantiationService, accessor.get(INotificationService) as NotificationService, storageService, configurationService);
@@ -224,7 +226,8 @@ export class Workbench extends Layout {
private registerListeners(
lifecycleService: ILifecycleService,
storageService: IStorageService,
configurationService: IConfigurationService
configurationService: IConfigurationService,
hostService: IHostService
): void {
// Configuration changes
@@ -248,6 +251,13 @@ export class Workbench extends Layout {
this._onShutdown.fire();
this.dispose();
}));
// In some environments we do not get enough time to persist state on shutdown.
// In other cases, VSCode might crash, so we periodically save state to reduce
// the chance of loosing any state.
// The window loosing focus is a good indication that the user has stopped working
// in that window so we pick that at a time to collect state.
this._register(hostService.onDidChangeFocus(focus => { if (!focus) { storageService.flush(); } }));
}
private fontAliasing: 'default' | 'antialiased' | 'none' | 'auto' | undefined;