Initial VS Code 1.19 source merge (#571)
* Initial 1.19 xcopy * Fix yarn build * Fix numerous build breaks * Next batch of build break fixes * More build break fixes * Runtime breaks * Additional post merge fixes * Fix windows setup file * Fix test failures. * Update license header blocks to refer to source eula
@@ -15,10 +15,10 @@ import { IPartService, Parts } from 'vs/workbench/services/part/common/partServi
|
||||
|
||||
export class ToggleActivityBarVisibilityAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.toggleActivityBarVisibility';
|
||||
public static LABEL = nls.localize('toggleActivityBar', "Toggle Activity Bar Visibility");
|
||||
public static readonly ID = 'workbench.action.toggleActivityBarVisibility';
|
||||
public static readonly LABEL = nls.localize('toggleActivityBar', "Toggle Activity Bar Visibility");
|
||||
|
||||
private static activityBarVisibleKey = 'workbench.activityBar.visible';
|
||||
private static readonly activityBarVisibleKey = 'workbench.activityBar.visible';
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
|
||||
@@ -19,8 +19,8 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
|
||||
|
||||
export class ToggleEditorLayoutAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.toggleEditorGroupLayout';
|
||||
public static LABEL = nls.localize('toggleEditorGroupLayout', "Toggle Editor Group Vertical/Horizontal Layout");
|
||||
public static readonly ID = 'workbench.action.toggleEditorGroupLayout';
|
||||
public static readonly LABEL = nls.localize('toggleEditorGroupLayout', "Toggle Editor Group Vertical/Horizontal Layout");
|
||||
|
||||
private toDispose: IDisposable[];
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configur
|
||||
|
||||
export class ToggleSidebarPositionAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.toggleSidebarPosition';
|
||||
public static LABEL = nls.localize('toggleLocation', "Toggle Side Bar Location");
|
||||
public static readonly ID = 'workbench.action.toggleSidebarPosition';
|
||||
public static readonly LABEL = nls.localize('toggleLocation', "Toggle Side Bar Location");
|
||||
|
||||
private static sidebarPositionConfigurationKey = 'workbench.sideBar.location';
|
||||
private static readonly sidebarPositionConfigurationKey = 'workbench.sideBar.location';
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
|
||||
@@ -15,8 +15,8 @@ import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
|
||||
export class ToggleSidebarVisibilityAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.toggleSidebarVisibility';
|
||||
public static LABEL = nls.localize('toggleSidebar', "Toggle Side Bar Visibility");
|
||||
public static readonly ID = 'workbench.action.toggleSidebarVisibility';
|
||||
public static readonly LABEL = nls.localize('toggleSidebar', "Toggle Side Bar Visibility");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
|
||||
@@ -15,10 +15,10 @@ import { IPartService, Parts } from 'vs/workbench/services/part/common/partServi
|
||||
|
||||
export class ToggleStatusbarVisibilityAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.toggleStatusbarVisibility';
|
||||
public static LABEL = nls.localize('toggleStatusbar', "Toggle Status Bar Visibility");
|
||||
public static readonly ID = 'workbench.action.toggleStatusbarVisibility';
|
||||
public static readonly LABEL = nls.localize('toggleStatusbar', "Toggle Status Bar Visibility");
|
||||
|
||||
private static statusbarVisibleKey = 'workbench.statusBar.visible';
|
||||
private static readonly statusbarVisibleKey = 'workbench.statusBar.visible';
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
|
||||
40
src/vs/workbench/browser/actions/toggleTabsVisibility.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import nls = require('vs/nls');
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
|
||||
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
|
||||
export class ToggleTabsVisibilityAction extends Action {
|
||||
|
||||
public static readonly ID = 'workbench.action.toggleTabsVisibility';
|
||||
public static readonly LABEL = nls.localize('toggleTabs', "Toggle Tab Visibility");
|
||||
|
||||
private static readonly tabsVisibleKey = 'workbench.editor.showTabs';
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IConfigurationService private configurationService: IConfigurationService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public run(): TPromise<any> {
|
||||
const visibility = this.configurationService.getValue<string>(ToggleTabsVisibilityAction.tabsVisibleKey);
|
||||
const newVisibilityValue = !visibility;
|
||||
|
||||
return this.configurationService.updateValue(ToggleTabsVisibilityAction.tabsVisibleKey, newVisibilityValue);
|
||||
}
|
||||
}
|
||||
|
||||
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleTabsVisibilityAction, ToggleTabsVisibilityAction.ID, ToggleTabsVisibilityAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.KEY_W }), 'View: Toggle Tab Visibility', nls.localize('view', "View"));
|
||||
@@ -14,8 +14,8 @@ import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
|
||||
class ToggleZenMode extends Action {
|
||||
|
||||
public static ID = 'workbench.action.toggleZenMode';
|
||||
public static LABEL = nls.localize('toggleZenMode', "Toggle Zen Mode");
|
||||
public static readonly ID = 'workbench.action.toggleZenMode';
|
||||
public static readonly LABEL = nls.localize('toggleZenMode', "Toggle Zen Mode");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
|
||||
@@ -14,7 +14,7 @@ import { IWorkspaceContextService, WorkbenchState, IWorkspaceFolder } from 'vs/p
|
||||
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { WORKSPACE_FILTER, IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { isLinux } from 'vs/base/common/platform';
|
||||
@@ -204,7 +204,6 @@ export class AddRootFolderAction extends BaseWorkspacesAction {
|
||||
@IWindowService windowService: IWindowService,
|
||||
@IWorkspaceContextService contextService: IWorkspaceContextService,
|
||||
@IEnvironmentService environmentService: IEnvironmentService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@IWorkspaceEditingService private workspaceEditingService: IWorkspaceEditingService,
|
||||
@IViewletService private viewletService: IViewletService,
|
||||
@IHistoryService historyService: IHistoryService
|
||||
@@ -367,8 +366,8 @@ export class OpenWorkspaceAction extends Action {
|
||||
|
||||
export class OpenWorkspaceConfigFileAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.openWorkspaceConfigFile';
|
||||
public static LABEL = nls.localize('openWorkspaceConfigFile', "Open Workspace Configuration File");
|
||||
public static readonly ID = 'workbench.action.openWorkspaceConfigFile';
|
||||
public static readonly LABEL = nls.localize('openWorkspaceConfigFile', "Open Workspace Configuration File");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -388,8 +387,8 @@ export class OpenWorkspaceConfigFileAction extends Action {
|
||||
|
||||
export class OpenFolderAsWorkspaceInNewWindowAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.openFolderAsWorkspaceInNewWindow';
|
||||
public static LABEL = nls.localize('openFolderAsWorkspaceInNewWindow', "Open Folder as Workspace in New Window");
|
||||
public static readonly ID = 'workbench.action.openFolderAsWorkspaceInNewWindow';
|
||||
public static readonly LABEL = nls.localize('openFolderAsWorkspaceInNewWindow', "Open Folder as Workspace in New Window");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
|
||||
@@ -26,10 +26,10 @@ import { IConstructorSignature0, IInstantiationService } from 'vs/platform/insta
|
||||
* layout and focus call, but only one create and dispose call.
|
||||
*/
|
||||
export abstract class Composite extends Component implements IComposite {
|
||||
private _telemetryData: any = {};
|
||||
private _onTitleAreaUpdate: Emitter<void>;
|
||||
|
||||
private visible: boolean;
|
||||
private parent: Builder;
|
||||
private _onTitleAreaUpdate: Emitter<void>;
|
||||
|
||||
protected actionRunner: IActionRunner;
|
||||
|
||||
@@ -100,42 +100,6 @@ export abstract class Composite extends Component implements IComposite {
|
||||
public setVisible(visible: boolean): TPromise<void> {
|
||||
this.visible = visible;
|
||||
|
||||
// Reset telemetry data when composite becomes visible
|
||||
if (visible) {
|
||||
this._telemetryData = {};
|
||||
this._telemetryData.startTime = new Date();
|
||||
|
||||
// Only submit telemetry data when not running from an integration test
|
||||
if (this._telemetryService && this._telemetryService.publicLog) {
|
||||
const eventName: string = 'compositeOpen';
|
||||
/* __GDPR__
|
||||
"compositeOpen" : {
|
||||
"composite" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this._telemetryService.publicLog(eventName, { composite: this.getId() });
|
||||
}
|
||||
}
|
||||
|
||||
// Send telemetry data when composite hides
|
||||
else {
|
||||
this._telemetryData.timeSpent = (Date.now() - this._telemetryData.startTime) / 1000;
|
||||
delete this._telemetryData.startTime;
|
||||
|
||||
// Only submit telemetry data when not running from an integration test
|
||||
if (this._telemetryService && this._telemetryService.publicLog) {
|
||||
const eventName: string = 'compositeShown';
|
||||
this._telemetryData.composite = this.getId();
|
||||
/* __GDPR__
|
||||
"compositeShown" : {
|
||||
"timeSpent" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
|
||||
"composite": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this._telemetryService.publicLog(eventName, this._telemetryData);
|
||||
}
|
||||
}
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
@@ -234,7 +198,7 @@ export abstract class CompositeDescriptor<T extends Composite> {
|
||||
public name: string;
|
||||
public cssClass: string;
|
||||
public order: number;
|
||||
public keybindingId;
|
||||
public keybindingId: string;
|
||||
|
||||
private ctor: IConstructorSignature0<T>;
|
||||
|
||||
@@ -275,10 +239,6 @@ export abstract class CompositeRegistry<T extends Composite> {
|
||||
return this.composites.slice(0);
|
||||
}
|
||||
|
||||
protected setComposites(compositesToSet: CompositeDescriptor<T>[]): void {
|
||||
this.composites = compositesToSet;
|
||||
}
|
||||
|
||||
private compositeById(id: string): CompositeDescriptor<T> {
|
||||
for (let i = 0; i < this.composites.length; i++) {
|
||||
if (this.composites[i].id === id) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { IConstructorSignature0, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { isArray } from 'vs/base/common/types';
|
||||
import URI from 'vs/base/common/uri';
|
||||
|
||||
export interface IEditorDescriptor {
|
||||
instantiate(instantiationService: IInstantiationService): BaseEditor;
|
||||
@@ -196,4 +197,43 @@ export const Extensions = {
|
||||
Editors: 'workbench.contributions.editors'
|
||||
};
|
||||
|
||||
Registry.add(Extensions.Editors, new EditorRegistry());
|
||||
Registry.add(Extensions.Editors, new EditorRegistry());
|
||||
|
||||
export interface IDraggedResource {
|
||||
resource: URI;
|
||||
isExternal: boolean;
|
||||
}
|
||||
|
||||
export function extractResources(e: DragEvent, externalOnly?: boolean): IDraggedResource[] {
|
||||
const resources: IDraggedResource[] = [];
|
||||
if (e.dataTransfer.types.length > 0) {
|
||||
|
||||
// Check for in-app DND
|
||||
if (!externalOnly) {
|
||||
const rawData = e.dataTransfer.getData('URL');
|
||||
if (rawData) {
|
||||
try {
|
||||
resources.push({ resource: URI.parse(rawData), isExternal: false });
|
||||
} catch (error) {
|
||||
// Invalid URI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for native file transfer
|
||||
if (e.dataTransfer && e.dataTransfer.files) {
|
||||
for (let i = 0; i < e.dataTransfer.files.length; i++) {
|
||||
const file = e.dataTransfer.files[i] as { path: string };
|
||||
if (file && file.path) {
|
||||
try {
|
||||
resources.push({ resource: URI.file(file.path), isExternal: true });
|
||||
} catch (error) {
|
||||
// Invalid URI
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resources;
|
||||
}
|
||||
@@ -65,8 +65,8 @@ export class ResourceLabel extends IconLabel {
|
||||
|
||||
private registerListeners(): void {
|
||||
|
||||
// update when extensions are loaded with potentially new languages
|
||||
this.extensionService.onReady().then(() => this.render(true /* clear cache */));
|
||||
// update when extensions are registered with potentially new languages
|
||||
this.toDispose.push(this.extensionService.onDidRegisterExtensions(() => this.render(true /* clear cache */)));
|
||||
|
||||
// react to model mode changes
|
||||
this.toDispose.push(this.modelService.onModelModeChanged(e => this.onModelModeChanged(e)));
|
||||
@@ -183,7 +183,7 @@ export class ResourceLabel extends IconLabel {
|
||||
|
||||
if (this.options && typeof this.options.title === 'string') {
|
||||
iconLabelOptions.title = this.options.title;
|
||||
} else if (resource) {
|
||||
} else if (resource && resource.scheme !== Schemas.data /* do not accidentally inline Data URIs */) {
|
||||
iconLabelOptions.title = getPathLabel(resource, void 0, this.environmentService);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,9 +49,10 @@ interface PartLayoutInfo {
|
||||
*/
|
||||
export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontalSashLayoutProvider {
|
||||
|
||||
private static sashXOneWidthSettingsKey = 'workbench.sidebar.width';
|
||||
private static sashXTwoWidthSettingsKey = 'workbench.panel.width';
|
||||
private static sashYHeightSettingsKey = 'workbench.panel.height';
|
||||
private static readonly sashXOneWidthSettingsKey = 'workbench.sidebar.width';
|
||||
private static readonly sashXTwoWidthSettingsKey = 'workbench.panel.width';
|
||||
private static readonly sashYHeightSettingsKey = 'workbench.panel.height';
|
||||
private static readonly panelSizeBeforeMaximizedKey = 'workbench.panel.sizeBeforeMaximized';
|
||||
|
||||
private parent: Builder;
|
||||
private workbenchContainer: Builder;
|
||||
@@ -108,7 +109,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
this.statusbar = parts.statusbar;
|
||||
this.quickopen = quickopen;
|
||||
this.toUnbind = [];
|
||||
this.panelSizeBeforeMaximized = 0;
|
||||
this.panelSizeBeforeMaximized = this.storageService.getInteger(WorkbenchLayout.panelSizeBeforeMaximizedKey, StorageScope.GLOBAL, 0);
|
||||
this.panelMaximized = false;
|
||||
|
||||
this.sashXOne = new Sash(this.workbenchContainer.getHTMLElement(), this, {
|
||||
@@ -236,27 +237,27 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
let startPanelHeight: number;
|
||||
let startPanelWidth: number;
|
||||
|
||||
this.toUnbind.push(this.sashXOne.addListener('start', (e: ISashEvent) => {
|
||||
this.toUnbind.push(this.sashXOne.onDidStart((e: ISashEvent) => {
|
||||
startSidebarWidth = this.sidebarWidth;
|
||||
startX = e.startX;
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashY.addListener('start', (e: ISashEvent) => {
|
||||
this.toUnbind.push(this.sashY.onDidStart((e: ISashEvent) => {
|
||||
startPanelHeight = this.panelHeight;
|
||||
startY = e.startY;
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashXTwo.addListener('start', (e: ISashEvent) => {
|
||||
this.toUnbind.push(this.sashXTwo.onDidStart((e: ISashEvent) => {
|
||||
startPanelWidth = this.panelWidth;
|
||||
startXTwo = e.startX;
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashXOne.addListener('change', (e: ISashEvent) => {
|
||||
this.toUnbind.push(this.sashXOne.onDidChange((e: ISashEvent) => {
|
||||
let doLayout = false;
|
||||
let sidebarPosition = this.partService.getSideBarPosition();
|
||||
let isSidebarVisible = this.partService.isVisible(Parts.SIDEBAR_PART);
|
||||
let newSashWidth = (sidebarPosition === Position.LEFT) ? startSidebarWidth + e.currentX - startX : startSidebarWidth - e.currentX + startX;
|
||||
let promise = TPromise.as<void>(null);
|
||||
let promise = TPromise.wrap<void>(null);
|
||||
|
||||
// Sidebar visible
|
||||
if (isSidebarVisible) {
|
||||
@@ -291,11 +292,11 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
}
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashY.addListener('change', (e: ISashEvent) => {
|
||||
this.toUnbind.push(this.sashY.onDidChange((e: ISashEvent) => {
|
||||
let doLayout = false;
|
||||
let isPanelVisible = this.partService.isVisible(Parts.PANEL_PART);
|
||||
let newSashHeight = startPanelHeight - (e.currentY - startY);
|
||||
let promise = TPromise.as<void>(null);
|
||||
let promise = TPromise.wrap<void>(null);
|
||||
|
||||
// Panel visible
|
||||
if (isPanelVisible) {
|
||||
@@ -329,11 +330,11 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
}
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashXTwo.addListener('change', (e: ISashEvent) => {
|
||||
this.toUnbind.push(this.sashXTwo.onDidChange((e: ISashEvent) => {
|
||||
let doLayout = false;
|
||||
let isPanelVisible = this.partService.isVisible(Parts.PANEL_PART);
|
||||
let newSashWidth = startPanelWidth - (e.currentX - startXTwo);
|
||||
let promise = TPromise.as<void>(null);
|
||||
let promise = TPromise.wrap<void>(null);
|
||||
|
||||
// Panel visible
|
||||
if (isPanelVisible) {
|
||||
@@ -367,25 +368,25 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
}
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashXOne.addListener('end', () => {
|
||||
this.toUnbind.push(this.sashXOne.onDidEnd(() => {
|
||||
this.storageService.store(WorkbenchLayout.sashXOneWidthSettingsKey, this.sidebarWidth, StorageScope.GLOBAL);
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashY.addListener('end', () => {
|
||||
this.toUnbind.push(this.sashY.onDidEnd(() => {
|
||||
this.storageService.store(WorkbenchLayout.sashYHeightSettingsKey, this.panelHeight, StorageScope.GLOBAL);
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashXTwo.addListener('end', () => {
|
||||
this.toUnbind.push(this.sashXTwo.onDidEnd(() => {
|
||||
this.storageService.store(WorkbenchLayout.sashXTwoWidthSettingsKey, this.panelWidth, StorageScope.GLOBAL);
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashY.addListener('reset', () => {
|
||||
this.toUnbind.push(this.sashY.onDidReset(() => {
|
||||
this.panelHeight = this.sidebarHeight * DEFAULT_PANEL_SIZE_COEFFICIENT;
|
||||
this.storageService.store(WorkbenchLayout.sashYHeightSettingsKey, this.panelHeight, StorageScope.GLOBAL);
|
||||
this.layout();
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashXOne.addListener('reset', () => {
|
||||
this.toUnbind.push(this.sashXOne.onDidReset(() => {
|
||||
let activeViewlet = this.viewletService.getActiveViewlet();
|
||||
let optimalWidth = activeViewlet && activeViewlet.getOptimalWidth();
|
||||
this.sidebarWidth = optimalWidth || 0;
|
||||
@@ -393,7 +394,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
this.partService.setSideBarHidden(false).done(() => this.layout(), errors.onUnexpectedError);
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashXTwo.addListener('reset', () => {
|
||||
this.toUnbind.push(this.sashXTwo.onDidReset(() => {
|
||||
this.panelWidth = (this.workbenchSize.width - this.sidebarWidth - this.activitybarWidth) * DEFAULT_PANEL_SIZE_COEFFICIENT;
|
||||
this.storageService.store(WorkbenchLayout.sashXTwoWidthSettingsKey, this.panelWidth, StorageScope.GLOBAL);
|
||||
this.layout();
|
||||
@@ -501,6 +502,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
this.panelSizeBeforeMaximized = panelWidth;
|
||||
}
|
||||
}
|
||||
this.storageService.store(WorkbenchLayout.panelSizeBeforeMaximizedKey, this.panelSizeBeforeMaximized, StorageScope.GLOBAL);
|
||||
const panelDimension = new Dimension(panelWidth, panelHeight);
|
||||
|
||||
// Editor
|
||||
@@ -680,7 +682,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
return this.workbenchSize.width - this.sidebarWidth - this.activitybarWidth;
|
||||
}
|
||||
|
||||
return this.workbenchSize.width - this.panelWidth - (sidebarPosition === Position.RIGHT ? this.sidebarWidth + this.activitybarWidth : 0);
|
||||
return this.workbenchSize.width - (this.partService.isVisible(Parts.PANEL_PART) ? this.panelWidth : 0) - (sidebarPosition === Position.RIGHT ? this.sidebarWidth + this.activitybarWidth : 0);
|
||||
}
|
||||
|
||||
public getVerticalSashHeight(sash: Sash): number {
|
||||
@@ -710,7 +712,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
|
||||
// change part size along the main axis
|
||||
public resizePart(part: Parts, sizeChange: number): void {
|
||||
const visibleEditors = this.editorService.getVisibleEditors().length;
|
||||
const panelPosition = this.partService.getPanelPosition();
|
||||
const sizeChangePxWidth = this.workbenchSize.width * (sizeChange / 100);
|
||||
const sizeChangePxHeight = this.workbenchSize.height * (sizeChange / 100);
|
||||
|
||||
@@ -720,24 +722,37 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
case Parts.SIDEBAR_PART:
|
||||
this.sidebarWidth = this.sidebarWidth + sizeChangePxWidth; // Sidebar can not become smaller than MIN_PART_WIDTH
|
||||
|
||||
if (this.layoutEditorGroupsVertically && (this.workbenchSize.width - this.sidebarWidth < visibleEditors * MIN_EDITOR_PART_WIDTH)) {
|
||||
this.sidebarWidth = (this.workbenchSize.width - visibleEditors * MIN_EDITOR_PART_WIDTH);
|
||||
if (this.layoutEditorGroupsVertically && (this.workbenchSize.width - this.sidebarWidth < this.editorCountForWidth * MIN_EDITOR_PART_WIDTH)) {
|
||||
this.sidebarWidth = (this.workbenchSize.width - this.editorCountForWidth * MIN_EDITOR_PART_WIDTH);
|
||||
}
|
||||
|
||||
doLayout = true;
|
||||
break;
|
||||
case Parts.PANEL_PART:
|
||||
this.panelHeight = this.panelHeight + sizeChangePxHeight;
|
||||
this.panelWidth = this.panelWidth + sizeChangePxWidth;
|
||||
if (panelPosition === Position.BOTTOM) {
|
||||
this.panelHeight = this.panelHeight + sizeChangePxHeight;
|
||||
} else if (panelPosition === Position.RIGHT) {
|
||||
this.panelWidth = this.panelWidth + sizeChangePxWidth;
|
||||
}
|
||||
|
||||
doLayout = true;
|
||||
break;
|
||||
case Parts.EDITOR_PART:
|
||||
// If we have one editor we can cheat and resize sidebar with the negative delta
|
||||
const visibleEditorCount = this.editorService.getVisibleEditors().length;
|
||||
// If the sidebar is not visible and panel is, resize panel main axis with negative Delta
|
||||
if (this.editorCountForWidth === 1) {
|
||||
if (this.partService.isVisible(Parts.SIDEBAR_PART)) {
|
||||
this.sidebarWidth = this.sidebarWidth - sizeChangePxWidth;
|
||||
doLayout = true;
|
||||
} else if (this.partService.isVisible(Parts.PANEL_PART)) {
|
||||
if (panelPosition === Position.BOTTOM) {
|
||||
this.panelHeight = this.panelHeight - sizeChangePxHeight;
|
||||
} else if (panelPosition === Position.RIGHT) {
|
||||
this.panelWidth = this.panelWidth - sizeChangePxWidth;
|
||||
}
|
||||
doLayout = true;
|
||||
}
|
||||
|
||||
if (visibleEditorCount === 1) {
|
||||
this.sidebarWidth = this.sidebarWidth - sizeChangePxWidth;
|
||||
doLayout = true;
|
||||
} else {
|
||||
const stacks = this.editorGroupService.getStacksModel();
|
||||
const activeGroup = stacks.positionOfGroup(stacks.activeGroup);
|
||||
|
||||
@@ -35,13 +35,6 @@ export class PanelRegistry extends CompositeRegistry<Panel> {
|
||||
super.registerComposite(descriptor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the panel descriptor for the given id or null if none.
|
||||
*/
|
||||
public getPanel(id: string): PanelDescriptor {
|
||||
return this.getComposite(id) as PanelDescriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of registered panels known to the platform.
|
||||
*/
|
||||
|
||||
@@ -98,20 +98,13 @@ export abstract class Part extends Component {
|
||||
public layout(dimension: Dimension): Dimension[] {
|
||||
return this.partLayout.layout(dimension);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the part layout implementation.
|
||||
*/
|
||||
public getLayout(): PartLayout {
|
||||
return this.partLayout;
|
||||
}
|
||||
}
|
||||
|
||||
const TITLE_HEIGHT = 35;
|
||||
|
||||
export class PartLayout {
|
||||
|
||||
constructor(private container: Builder, private options: IPartOptions, private titleArea: Builder, private contentArea: Builder) {
|
||||
constructor(container: Builder, private options: IPartOptions, titleArea: Builder, private contentArea: Builder) {
|
||||
}
|
||||
|
||||
public layout(dimension: Dimension): Dimension[] {
|
||||
|
||||
@@ -25,7 +25,7 @@ import { ActivityAction, ActivityActionItem, ICompositeBarColors } from 'vs/work
|
||||
|
||||
export class ViewletActivityAction extends ActivityAction {
|
||||
|
||||
private static preventDoubleClickDelay = 300;
|
||||
private static readonly preventDoubleClickDelay = 300;
|
||||
|
||||
private lastRun: number = 0;
|
||||
|
||||
|
||||
@@ -18,10 +18,8 @@ import { Part } from 'vs/workbench/browser/part';
|
||||
import { GlobalActivityActionItem, GlobalActivityAction, ViewletActivityAction, ToggleViewletAction } from 'vs/workbench/browser/parts/activitybar/activitybarActions';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { IBadge } from 'vs/workbench/services/activity/common/activity';
|
||||
import { IPartService, Position as SideBarPosition } from 'vs/workbench/services/part/common/partService';
|
||||
import { IPartService, Parts, Position as SideBarPosition } from 'vs/workbench/services/part/common/partService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { dispose, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
@@ -32,16 +30,19 @@ import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { CompositeBar } from 'vs/workbench/browser/parts/compositebar/compositeBar';
|
||||
import { ToggleCompositePinnedAction } from 'vs/workbench/browser/parts/compositebar/compositeBarActions';
|
||||
import { ViewletDescriptor } from 'vs/workbench/browser/viewlet';
|
||||
// {{SQL CARBON EDIT}}
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
|
||||
export class ActivitybarPart extends Part {
|
||||
|
||||
private static readonly PINNED_VIEWLETS = 'workbench.activity.pinnedViewlets';
|
||||
private static COLORS = {
|
||||
private static readonly COLORS = {
|
||||
backgroundColor: ACTIVITY_BAR_FOREGROUND,
|
||||
badgeBackground: ACTIVITY_BAR_BADGE_BACKGROUND,
|
||||
badgeForeground: ACTIVITY_BAR_BADGE_FOREGROUND,
|
||||
dragAndDropBackground: ACTIVITY_BAR_DRAG_AND_DROP_BACKGROUND
|
||||
};
|
||||
private static readonly ACTION_HEIGHT = 50;
|
||||
|
||||
public _serviceBrand: any;
|
||||
|
||||
@@ -55,12 +56,12 @@ export class ActivitybarPart extends Part {
|
||||
constructor(
|
||||
id: string,
|
||||
@IViewletService private viewletService: IViewletService,
|
||||
@IExtensionService private extensionService: IExtensionService,
|
||||
@IStorageService private storageService: IStorageService,
|
||||
@IContextMenuService private contextMenuService: IContextMenuService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@IPartService private partService: IPartService,
|
||||
@IThemeService themeService: IThemeService
|
||||
@IThemeService themeService: IThemeService,
|
||||
// {{SQL CARBON EDIT}}
|
||||
@IStorageService private storageService: IStorageService
|
||||
) {
|
||||
super(id, { hasTitle: false }, themeService);
|
||||
|
||||
@@ -69,7 +70,7 @@ export class ActivitybarPart extends Part {
|
||||
icon: true,
|
||||
storageId: ActivitybarPart.PINNED_VIEWLETS,
|
||||
orientation: ActionsOrientation.VERTICAL,
|
||||
composites: this.getViewlets(), // {{SQL CARBON EDIT}}
|
||||
composites: this.viewletService.getViewlets(),
|
||||
openComposite: (compositeId: string) => this.viewletService.openViewlet(compositeId, true),
|
||||
getActivityAction: (compositeId: string) => this.instantiationService.createInstance(ViewletActivityAction, this.viewletService.getViewlet(compositeId)),
|
||||
getCompositePinnedAction: (compositeId: string) => new ToggleCompositePinnedAction(this.viewletService.getViewlet(compositeId), this.compositeBar),
|
||||
@@ -77,7 +78,7 @@ export class ActivitybarPart extends Part {
|
||||
getDefaultCompositeId: () => this.viewletService.getDefaultViewletId(),
|
||||
hidePart: () => this.partService.setSideBarHidden(true),
|
||||
colors: ActivitybarPart.COLORS,
|
||||
overflowActionSize: 50
|
||||
overflowActionSize: ActivitybarPart.ACTION_HEIGHT
|
||||
});
|
||||
this.registerListeners();
|
||||
}
|
||||
@@ -194,13 +195,16 @@ export class ActivitybarPart extends Part {
|
||||
}
|
||||
|
||||
public getPinned(): string[] {
|
||||
return this.viewletService.getViewlets().map(v => v.id).filter(id => this.compositeBar.isPinned(id));;
|
||||
return this.viewletService.getViewlets().map(v => v.id).filter(id => this.compositeBar.isPinned(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Layout title, content and status area in the given dimension.
|
||||
*/
|
||||
public layout(dimension: Dimension): Dimension[] {
|
||||
if (!this.partService.isVisible(Parts.ACTIVITYBAR_PART)) {
|
||||
return [dimension];
|
||||
}
|
||||
|
||||
// Pass to super
|
||||
const sizes = super.layout(dimension);
|
||||
@@ -210,7 +214,7 @@ export class ActivitybarPart extends Part {
|
||||
let availableHeight = this.dimension.height;
|
||||
if (this.globalActionBar) {
|
||||
// adjust height for global actions showing
|
||||
availableHeight -= (this.globalActionBar.items.length * this.globalActionBar.domNode.clientHeight);
|
||||
availableHeight -= (this.globalActionBar.items.length * ActivitybarPart.ACTION_HEIGHT);
|
||||
}
|
||||
this.compositeBar.layout(new Dimension(dimension.width, availableHeight));
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { Dimension, Builder, $ } from 'vs/base/browser/builder';
|
||||
import events = require('vs/base/common/events');
|
||||
import strings = require('vs/base/common/strings');
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import types = require('vs/base/common/types');
|
||||
@@ -23,7 +22,7 @@ import { CONTEXT as ToolBarContext, ToolBar } from 'vs/base/browser/ui/toolbar/t
|
||||
import { IActionItem, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar';
|
||||
import { IActionBarRegistry, Extensions, prepareActions } from 'vs/workbench/browser/actions';
|
||||
import { Action, IAction } from 'vs/base/common/actions';
|
||||
import { Action, IAction, IRunEvent } from 'vs/base/common/actions';
|
||||
import { Part, IPartOptions } from 'vs/workbench/browser/part';
|
||||
import { Composite, CompositeRegistry } from 'vs/workbench/browser/composite';
|
||||
import { IComposite } from 'vs/workbench/common/composite';
|
||||
@@ -282,7 +281,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
|
||||
}
|
||||
|
||||
// Action Run Handling
|
||||
this.telemetryActionsListener = this.toolBar.actionRunner.addListener(events.EventType.RUN, (e: any) => {
|
||||
this.telemetryActionsListener = this.toolBar.actionRunner.onDidRun((e: IRunEvent) => {
|
||||
|
||||
// Check for Error
|
||||
if (e.error && !errors.isPromiseCanceledError(e.error)) {
|
||||
|
||||
@@ -70,7 +70,8 @@ export class CompositeBar implements ICompositeBar {
|
||||
|
||||
const pinnedComposites = JSON.parse(this.storageService.get(this.options.storageId, StorageScope.GLOBAL, null)) as string[];
|
||||
if (pinnedComposites) {
|
||||
this.pinnedComposites = pinnedComposites;
|
||||
const compositeIds = this.options.composites.map(c => c.id);
|
||||
this.pinnedComposites = pinnedComposites.filter(pcid => compositeIds.indexOf(pcid) >= 0);
|
||||
} else {
|
||||
this.pinnedComposites = this.options.composites.map(c => c.id);
|
||||
}
|
||||
@@ -196,7 +197,7 @@ export class CompositeBar implements ICompositeBar {
|
||||
return; // We have not been rendered yet so there is nothing to update.
|
||||
}
|
||||
|
||||
let compositesToShow = this.pinnedComposites;
|
||||
let compositesToShow = this.pinnedComposites.slice(0); // never modify original array
|
||||
|
||||
// Always show the active composite even if it is marked to be hidden
|
||||
if (this.activeCompositeId && !compositesToShow.some(id => id === this.activeCompositeId)) {
|
||||
@@ -222,15 +223,22 @@ export class CompositeBar implements ICompositeBar {
|
||||
if (overflows) {
|
||||
size -= this.compositeSizeInBar.get(compositesToShow[maxVisible]);
|
||||
compositesToShow = compositesToShow.slice(0, maxVisible);
|
||||
size += this.options.overflowActionSize;
|
||||
}
|
||||
// Check if we need to make extra room for the overflow action
|
||||
if (overflows && (size + this.options.overflowActionSize > limit)) {
|
||||
compositesToShow.pop();
|
||||
if (size > limit) {
|
||||
size -= this.compositeSizeInBar.get(compositesToShow.pop());
|
||||
}
|
||||
// We always try show the active composite
|
||||
if (this.activeCompositeId && compositesToShow.length && compositesToShow.indexOf(this.activeCompositeId) === -1) {
|
||||
compositesToShow.pop();
|
||||
const removedComposite = compositesToShow.pop();
|
||||
size = size - this.compositeSizeInBar.get(removedComposite) + this.compositeSizeInBar.get(this.activeCompositeId);
|
||||
compositesToShow.push(this.activeCompositeId);
|
||||
}
|
||||
// The active composite might have bigger size than the removed composite, check for overflow again
|
||||
if (size > limit) {
|
||||
compositesToShow.length ? compositesToShow.splice(compositesToShow.length - 2, 1) : compositesToShow.pop();
|
||||
}
|
||||
|
||||
const visibleComposites = Object.keys(this.compositeIdToActions);
|
||||
const visibleCompositesChange = !arrays.equals(compositesToShow, visibleComposites);
|
||||
@@ -347,6 +355,9 @@ export class CompositeBar implements ICompositeBar {
|
||||
const visibleComposites = this.getVisibleComposites();
|
||||
|
||||
let unpinPromise: TPromise<any>;
|
||||
// remove from pinned
|
||||
const index = this.pinnedComposites.indexOf(compositeId);
|
||||
this.pinnedComposites.splice(index, 1);
|
||||
|
||||
// Case: composite is not the active one or the active one is a different one
|
||||
// Solv: we do nothing
|
||||
@@ -373,10 +384,6 @@ export class CompositeBar implements ICompositeBar {
|
||||
}
|
||||
|
||||
unpinPromise.then(() => {
|
||||
// then remove from pinned and update switcher
|
||||
const index = this.pinnedComposites.indexOf(compositeId);
|
||||
this.pinnedComposites.splice(index, 1);
|
||||
|
||||
this.updateCompositeSwitcher();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -198,10 +198,6 @@ export class ActivityActionItem extends BaseActionItem {
|
||||
this.updateStyles();
|
||||
}
|
||||
|
||||
public setBadge(badge: IBadge): void {
|
||||
this.updateBadge(badge);
|
||||
}
|
||||
|
||||
protected updateBadge(badge: IBadge): void {
|
||||
this.$badgeContent.empty();
|
||||
this.$badge.hide();
|
||||
@@ -211,7 +207,13 @@ export class ActivityActionItem extends BaseActionItem {
|
||||
// Number
|
||||
if (badge instanceof NumberBadge) {
|
||||
if (badge.number) {
|
||||
this.$badgeContent.text(badge.number > 99 ? '99+' : badge.number.toString());
|
||||
let number = badge.number.toString();
|
||||
if (badge.number > 9999) {
|
||||
number = nls.localize('largeNumberBadge', '10k+');
|
||||
} else if (badge.number > 999) {
|
||||
number = number.charAt(0) + 'k';
|
||||
}
|
||||
this.$badgeContent.text(number);
|
||||
this.$badge.show();
|
||||
}
|
||||
}
|
||||
@@ -291,8 +293,6 @@ export class CompositeOverflowActivityAction extends ActivityAction {
|
||||
}
|
||||
|
||||
export class CompositeOverflowActivityActionItem extends ActivityActionItem {
|
||||
private name: string;
|
||||
private cssClass: string;
|
||||
private actions: Action[];
|
||||
|
||||
constructor(
|
||||
@@ -302,14 +302,10 @@ export class CompositeOverflowActivityActionItem extends ActivityActionItem {
|
||||
private getBadge: (compositeId: string) => IBadge,
|
||||
private getCompositeOpenAction: (compositeId: string) => Action,
|
||||
colors: ICompositeBarColors,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@IContextMenuService private contextMenuService: IContextMenuService,
|
||||
@IThemeService themeService: IThemeService
|
||||
) {
|
||||
super(action, { icon: true, colors }, themeService);
|
||||
|
||||
this.cssClass = action.class;
|
||||
this.name = action.label;
|
||||
}
|
||||
|
||||
public showMenu(): void {
|
||||
|
||||
@@ -52,7 +52,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
|
||||
this._input = input;
|
||||
this._options = options;
|
||||
|
||||
return TPromise.as<void>(null);
|
||||
return TPromise.wrap<void>(null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@ import { BaseBinaryResourceEditor } from 'vs/workbench/browser/parts/editor/bina
|
||||
*/
|
||||
export class BinaryResourceDiffEditor extends SideBySideEditor {
|
||||
|
||||
public static ID = BINARY_DIFF_EDITOR_ID;
|
||||
public static readonly ID = BINARY_DIFF_EDITOR_ID;
|
||||
|
||||
constructor(
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
|
||||
@@ -68,7 +68,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
|
||||
// Return early for same input unless we force to open
|
||||
const forceOpen = options && options.forceOpen;
|
||||
if (!forceOpen && input.matches(this.input)) {
|
||||
return TPromise.as<void>(null);
|
||||
return TPromise.wrap<void>(null);
|
||||
}
|
||||
|
||||
// Otherwise set input and resolve
|
||||
@@ -88,7 +88,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
|
||||
// Render Input
|
||||
const model = <BinaryEditorModel>resolvedModel;
|
||||
ResourceViewer.show(
|
||||
{ name: model.getName(), resource: model.getResource(), size: model.getSize(), etag: model.getETag() },
|
||||
{ name: model.getName(), resource: model.getResource(), size: model.getSize(), etag: model.getETag(), mime: model.getMime() },
|
||||
this.binaryContainer,
|
||||
this.scrollbar,
|
||||
(resource: URI) => {
|
||||
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
NavigateBetweenGroupsAction, FocusActiveGroupAction, FocusFirstGroupAction, FocusSecondGroupAction, FocusThirdGroupAction, EvenGroupWidthsAction, MaximizeGroupAction, MinimizeOtherGroupsAction, FocusPreviousGroup, FocusNextGroup, ShowEditorsInGroupOneAction,
|
||||
toEditorQuickOpenEntry, CloseLeftEditorsInGroupAction, CloseRightEditorsInGroupAction, CloseUnmodifiedEditorsInGroupAction, OpenNextEditor, OpenPreviousEditor, NavigateBackwardsAction, NavigateForwardAction, NavigateLastAction, ReopenClosedEditorAction, OpenPreviousRecentlyUsedEditorInGroupAction, NAVIGATE_IN_GROUP_ONE_PREFIX,
|
||||
OpenPreviousEditorFromHistoryAction, ShowAllEditorsAction, NAVIGATE_ALL_EDITORS_GROUP_PREFIX, ClearEditorHistoryAction, ShowEditorsInGroupTwoAction, MoveEditorRightInGroupAction, OpenNextEditorInGroup, OpenPreviousEditorInGroup, OpenNextRecentlyUsedEditorAction, OpenPreviousRecentlyUsedEditorAction,
|
||||
NAVIGATE_IN_GROUP_TWO_PREFIX, ShowEditorsInGroupThreeAction, NAVIGATE_IN_GROUP_THREE_PREFIX, FocusLastEditorInStackAction, OpenNextRecentlyUsedEditorInGroupAction, MoveEditorToPreviousGroupAction, MoveEditorToNextGroupAction, MoveEditorLeftInGroupAction, ClearRecentFilesAction
|
||||
NAVIGATE_IN_GROUP_TWO_PREFIX, ShowEditorsInGroupThreeAction, NAVIGATE_IN_GROUP_THREE_PREFIX, FocusLastEditorInStackAction, OpenNextRecentlyUsedEditorInGroupAction, MoveEditorToPreviousGroupAction, MoveEditorToNextGroupAction, MoveEditorLeftInGroupAction, ClearRecentFilesAction, OpenLastEditorInGroup
|
||||
} from 'vs/workbench/browser/parts/editor/editorActions';
|
||||
import * as editorCommands from 'vs/workbench/browser/parts/editor/editorCommands';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -332,6 +332,7 @@ Registry.as<IQuickOpenRegistry>(QuickOpenExtensions.Quickopen).registerQuickOpen
|
||||
const category = nls.localize('view', "View");
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenNextEditorInGroup, OpenNextEditorInGroup.ID, OpenNextEditorInGroup.LABEL), 'View: Open Next Editor in Group', category);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenPreviousEditorInGroup, OpenPreviousEditorInGroup.ID, OpenPreviousEditorInGroup.LABEL), 'View: Open Previous Editor in Group', category);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenLastEditorInGroup, OpenLastEditorInGroup.ID, OpenLastEditorInGroup.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_9 }), 'View: Open Last Editor in Group', category);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenNextRecentlyUsedEditorAction, OpenNextRecentlyUsedEditorAction.ID, OpenNextRecentlyUsedEditorAction.LABEL), 'View: Open Next Recently Used Editor', category);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenPreviousRecentlyUsedEditorAction, OpenPreviousRecentlyUsedEditorAction.ID, OpenPreviousRecentlyUsedEditorAction.LABEL), 'View: Open Previous Recently Used Editor', category);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(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);
|
||||
|
||||
@@ -8,7 +8,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import nls = require('vs/nls');
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { getCodeEditor } from 'vs/editor/common/services/codeEditorService';
|
||||
import { getCodeEditor } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { EditorInput, TextEditorOptions, EditorOptions, IEditorIdentifier, IEditorContext, ActiveEditorMoveArguments, ActiveEditorMovePositioning, EditorCommands, ConfirmResult } from 'vs/workbench/common/editor';
|
||||
import { QuickOpenEntryGroup } from 'vs/base/parts/quickopen/browser/quickOpenModel';
|
||||
import { EditorQuickOpenEntry, EditorQuickOpenEntryGroup, IEditorQuickOpenEntry, QuickOpenAction } from 'vs/workbench/browser/quickopen';
|
||||
@@ -25,8 +25,8 @@ import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
|
||||
export class SplitEditorAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.splitEditor';
|
||||
public static LABEL = nls.localize('splitEditor', "Split Editor");
|
||||
public static readonly ID = 'workbench.action.splitEditor';
|
||||
public static readonly LABEL = nls.localize('splitEditor', "Split Editor");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -107,13 +107,12 @@ export class SplitEditorAction extends Action {
|
||||
|
||||
export class JoinTwoGroupsAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.joinTwoGroups';
|
||||
public static LABEL = nls.localize('joinTwoGroups', "Join Editors of Two Groups");
|
||||
public static readonly ID = 'workbench.action.joinTwoGroups';
|
||||
public static readonly LABEL = nls.localize('joinTwoGroups', "Join Editors of Two Groups");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
||||
@IEditorGroupService private editorGroupService: IEditorGroupService
|
||||
) {
|
||||
super(id, label);
|
||||
@@ -172,8 +171,8 @@ export class JoinTwoGroupsAction extends Action {
|
||||
|
||||
export class NavigateBetweenGroupsAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.navigateEditorGroups';
|
||||
public static LABEL = nls.localize('navigateEditorGroups', "Navigate Between Editor Groups");
|
||||
public static readonly ID = 'workbench.action.navigateEditorGroups';
|
||||
public static readonly LABEL = nls.localize('navigateEditorGroups', "Navigate Between Editor Groups");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -205,8 +204,8 @@ export class NavigateBetweenGroupsAction extends Action {
|
||||
|
||||
export class FocusActiveGroupAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.focusActiveEditorGroup';
|
||||
public static LABEL = nls.localize('focusActiveEditorGroup', "Focus Active Editor Group");
|
||||
public static readonly ID = 'workbench.action.focusActiveEditorGroup';
|
||||
public static readonly LABEL = nls.localize('focusActiveEditorGroup', "Focus Active Editor Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -228,8 +227,8 @@ export class FocusActiveGroupAction extends Action {
|
||||
|
||||
export class FocusFirstGroupAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.focusFirstEditorGroup';
|
||||
public static LABEL = nls.localize('focusFirstEditorGroup', "Focus First Editor Group");
|
||||
public static readonly ID = 'workbench.action.focusFirstEditorGroup';
|
||||
public static readonly LABEL = nls.localize('focusFirstEditorGroup', "Focus First Editor Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -324,11 +323,13 @@ export abstract class BaseFocusSideGroupAction extends Action {
|
||||
else if (referenceEditor) {
|
||||
const history = this.historyService.getHistory();
|
||||
for (let input of history) {
|
||||
if (input instanceof EditorInput && input.supportsSplitEditor()) {
|
||||
return this.editorService.openEditor(input, { pinned: true }, this.getTargetEditorSide());
|
||||
if (input instanceof EditorInput) {
|
||||
if (input.supportsSplitEditor()) {
|
||||
return this.editorService.openEditor(input, { pinned: true }, this.getTargetEditorSide());
|
||||
}
|
||||
} else {
|
||||
return this.editorService.openEditor({ resource: (input as IResourceInput).resource, options: { pinned: true } }, this.getTargetEditorSide());
|
||||
}
|
||||
|
||||
return this.editorService.openEditor({ resource: (input as IResourceInput).resource, options: { pinned: true } }, this.getTargetEditorSide());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,8 +339,8 @@ export abstract class BaseFocusSideGroupAction extends Action {
|
||||
|
||||
export class FocusSecondGroupAction extends BaseFocusSideGroupAction {
|
||||
|
||||
public static ID = 'workbench.action.focusSecondEditorGroup';
|
||||
public static LABEL = nls.localize('focusSecondEditorGroup', "Focus Second Editor Group");
|
||||
public static readonly ID = 'workbench.action.focusSecondEditorGroup';
|
||||
public static readonly LABEL = nls.localize('focusSecondEditorGroup', "Focus Second Editor Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -362,8 +363,8 @@ export class FocusSecondGroupAction extends BaseFocusSideGroupAction {
|
||||
|
||||
export class FocusThirdGroupAction extends BaseFocusSideGroupAction {
|
||||
|
||||
public static ID = 'workbench.action.focusThirdEditorGroup';
|
||||
public static LABEL = nls.localize('focusThirdEditorGroup', "Focus Third Editor Group");
|
||||
public static readonly ID = 'workbench.action.focusThirdEditorGroup';
|
||||
public static readonly LABEL = nls.localize('focusThirdEditorGroup', "Focus Third Editor Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -386,8 +387,8 @@ export class FocusThirdGroupAction extends BaseFocusSideGroupAction {
|
||||
|
||||
export class FocusPreviousGroup extends Action {
|
||||
|
||||
public static ID = 'workbench.action.focusPreviousGroup';
|
||||
public static LABEL = nls.localize('focusPreviousGroup', "Focus Previous Group");
|
||||
public static readonly ID = 'workbench.action.focusPreviousGroup';
|
||||
public static readonly LABEL = nls.localize('focusPreviousGroup', "Focus Previous Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -424,8 +425,8 @@ export class FocusPreviousGroup extends Action {
|
||||
|
||||
export class FocusNextGroup extends Action {
|
||||
|
||||
public static ID = 'workbench.action.focusNextGroup';
|
||||
public static LABEL = nls.localize('focusNextGroup', "Focus Next Group");
|
||||
public static readonly ID = 'workbench.action.focusNextGroup';
|
||||
public static readonly LABEL = nls.localize('focusNextGroup', "Focus Next Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -462,8 +463,8 @@ export class FocusNextGroup extends Action {
|
||||
|
||||
export class OpenToSideAction extends Action {
|
||||
|
||||
public static OPEN_TO_SIDE_ID = 'workbench.action.openToSide';
|
||||
public static OPEN_TO_SIDE_LABEL = nls.localize('openToSide', "Open to the Side");
|
||||
public static readonly OPEN_TO_SIDE_ID = 'workbench.action.openToSide';
|
||||
public static readonly OPEN_TO_SIDE_LABEL = nls.localize('openToSide', "Open to the Side");
|
||||
|
||||
constructor(
|
||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
||||
@@ -524,8 +525,8 @@ export function toEditorQuickOpenEntry(element: any): IEditorQuickOpenEntry {
|
||||
|
||||
export class CloseEditorAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.closeActiveEditor';
|
||||
public static LABEL = nls.localize('closeEditor', "Close Editor");
|
||||
public static readonly ID = 'workbench.action.closeActiveEditor';
|
||||
public static readonly LABEL = nls.localize('closeEditor', "Close Editor");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -567,8 +568,8 @@ export class CloseEditorAction extends Action {
|
||||
|
||||
export class RevertAndCloseEditorAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.revertAndCloseActiveEditor';
|
||||
public static LABEL = nls.localize('revertAndCloseActiveEditor', "Revert and Close Editor");
|
||||
public static readonly ID = 'workbench.action.revertAndCloseActiveEditor';
|
||||
public static readonly LABEL = nls.localize('revertAndCloseActiveEditor', "Revert and Close Editor");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -595,8 +596,8 @@ export class RevertAndCloseEditorAction extends Action {
|
||||
|
||||
export class CloseLeftEditorsInGroupAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.closeEditorsToTheLeft';
|
||||
public static LABEL = nls.localize('closeEditorsToTheLeft', "Close Editors to the Left");
|
||||
public static readonly ID = 'workbench.action.closeEditorsToTheLeft';
|
||||
public static readonly LABEL = nls.localize('closeEditorsToTheLeft', "Close Editors to the Left");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -619,8 +620,8 @@ export class CloseLeftEditorsInGroupAction extends Action {
|
||||
|
||||
export class CloseRightEditorsInGroupAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.closeEditorsToTheRight';
|
||||
public static LABEL = nls.localize('closeEditorsToTheRight', "Close Editors to the Right");
|
||||
public static readonly ID = 'workbench.action.closeEditorsToTheRight';
|
||||
public static readonly LABEL = nls.localize('closeEditorsToTheRight', "Close Editors to the Right");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -643,8 +644,8 @@ export class CloseRightEditorsInGroupAction extends Action {
|
||||
|
||||
export class CloseAllEditorsAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.closeAllEditors';
|
||||
public static LABEL = nls.localize('closeAllEditors', "Close All Editors");
|
||||
public static readonly ID = 'workbench.action.closeAllEditors';
|
||||
public static readonly LABEL = nls.localize('closeAllEditors', "Close All Editors");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -687,8 +688,8 @@ export class CloseAllEditorsAction extends Action {
|
||||
|
||||
export class CloseUnmodifiedEditorsInGroupAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.closeUnmodifiedEditors';
|
||||
public static LABEL = nls.localize('closeUnmodifiedEditors', "Close Unmodified Editors in Group");
|
||||
public static readonly ID = 'workbench.action.closeUnmodifiedEditors';
|
||||
public static readonly LABEL = nls.localize('closeUnmodifiedEditors', "Close Unmodified Editors in Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -720,8 +721,8 @@ export class CloseUnmodifiedEditorsInGroupAction extends Action {
|
||||
|
||||
export class CloseEditorsInOtherGroupsAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.closeEditorsInOtherGroups';
|
||||
public static LABEL = nls.localize('closeEditorsInOtherGroups', "Close Editors in Other Groups");
|
||||
public static readonly ID = 'workbench.action.closeEditorsInOtherGroups';
|
||||
public static readonly LABEL = nls.localize('closeEditorsInOtherGroups', "Close Editors in Other Groups");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -751,8 +752,8 @@ export class CloseEditorsInOtherGroupsAction extends Action {
|
||||
|
||||
export class CloseOtherEditorsInGroupAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.closeOtherEditors';
|
||||
public static LABEL = nls.localize('closeOtherEditorsInGroup', "Close Other Editors");
|
||||
public static readonly ID = 'workbench.action.closeOtherEditors';
|
||||
public static readonly LABEL = nls.localize('closeOtherEditorsInGroup', "Close Other Editors");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -784,8 +785,8 @@ export class CloseOtherEditorsInGroupAction extends Action {
|
||||
|
||||
export class CloseEditorsInGroupAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.closeEditorsInGroup';
|
||||
public static LABEL = nls.localize('closeEditorsInGroup', "Close All Editors in Group");
|
||||
public static readonly ID = 'workbench.action.closeEditorsInGroup';
|
||||
public static readonly LABEL = nls.localize('closeEditorsInGroup', "Close All Editors in Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -815,8 +816,8 @@ export class CloseEditorsInGroupAction extends Action {
|
||||
|
||||
export class MoveGroupLeftAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.moveActiveEditorGroupLeft';
|
||||
public static LABEL = nls.localize('moveActiveGroupLeft', "Move Editor Group Left");
|
||||
public static readonly ID = 'workbench.action.moveActiveEditorGroupLeft';
|
||||
public static readonly LABEL = nls.localize('moveActiveGroupLeft', "Move Editor Group Left");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -849,8 +850,8 @@ export class MoveGroupLeftAction extends Action {
|
||||
|
||||
export class MoveGroupRightAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.moveActiveEditorGroupRight';
|
||||
public static LABEL = nls.localize('moveActiveGroupRight', "Move Editor Group Right");
|
||||
public static readonly ID = 'workbench.action.moveActiveEditorGroupRight';
|
||||
public static readonly LABEL = nls.localize('moveActiveGroupRight', "Move Editor Group Right");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -885,8 +886,8 @@ export class MoveGroupRightAction extends Action {
|
||||
|
||||
export class MinimizeOtherGroupsAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.minimizeOtherEditors';
|
||||
public static LABEL = nls.localize('minimizeOtherEditorGroups', "Minimize Other Editor Groups");
|
||||
public static readonly ID = 'workbench.action.minimizeOtherEditors';
|
||||
public static readonly LABEL = nls.localize('minimizeOtherEditorGroups', "Minimize Other Editor Groups");
|
||||
|
||||
constructor(id: string, label: string, @IEditorGroupService private editorGroupService: IEditorGroupService) {
|
||||
super(id, label);
|
||||
@@ -901,8 +902,8 @@ export class MinimizeOtherGroupsAction extends Action {
|
||||
|
||||
export class EvenGroupWidthsAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.evenEditorWidths';
|
||||
public static LABEL = nls.localize('evenEditorGroups', "Even Editor Group Widths");
|
||||
public static readonly ID = 'workbench.action.evenEditorWidths';
|
||||
public static readonly LABEL = nls.localize('evenEditorGroups', "Even Editor Group Widths");
|
||||
|
||||
constructor(id: string, label: string, @IEditorGroupService private editorGroupService: IEditorGroupService) {
|
||||
super(id, label);
|
||||
@@ -917,8 +918,8 @@ export class EvenGroupWidthsAction extends Action {
|
||||
|
||||
export class MaximizeGroupAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.maximizeEditor';
|
||||
public static LABEL = nls.localize('maximizeEditor', "Maximize Editor Group and Hide Sidebar");
|
||||
public static readonly ID = 'workbench.action.maximizeEditor';
|
||||
public static readonly LABEL = nls.localize('maximizeEditor', "Maximize Editor Group and Hide Sidebar");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -942,8 +943,8 @@ export class MaximizeGroupAction extends Action {
|
||||
|
||||
export class KeepEditorAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.keepEditor';
|
||||
public static LABEL = nls.localize('keepEditor', "Keep Editor");
|
||||
public static readonly ID = 'workbench.action.keepEditor';
|
||||
public static readonly LABEL = nls.localize('keepEditor', "Keep Editor");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1003,8 +1004,8 @@ export abstract class BaseNavigateEditorAction extends Action {
|
||||
|
||||
export class OpenNextEditor extends BaseNavigateEditorAction {
|
||||
|
||||
public static ID = 'workbench.action.nextEditor';
|
||||
public static LABEL = nls.localize('openNextEditor', "Open Next Editor");
|
||||
public static readonly ID = 'workbench.action.nextEditor';
|
||||
public static readonly LABEL = nls.localize('openNextEditor', "Open Next Editor");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1022,8 +1023,8 @@ export class OpenNextEditor extends BaseNavigateEditorAction {
|
||||
|
||||
export class OpenPreviousEditor extends BaseNavigateEditorAction {
|
||||
|
||||
public static ID = 'workbench.action.previousEditor';
|
||||
public static LABEL = nls.localize('openPreviousEditor', "Open Previous Editor");
|
||||
public static readonly ID = 'workbench.action.previousEditor';
|
||||
public static readonly LABEL = nls.localize('openPreviousEditor', "Open Previous Editor");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1041,8 +1042,8 @@ export class OpenPreviousEditor extends BaseNavigateEditorAction {
|
||||
|
||||
export class OpenNextEditorInGroup extends BaseNavigateEditorAction {
|
||||
|
||||
public static ID = 'workbench.action.nextEditorInGroup';
|
||||
public static LABEL = nls.localize('nextEditorInGroup', "Open Next Editor in Group");
|
||||
public static readonly ID = 'workbench.action.nextEditorInGroup';
|
||||
public static readonly LABEL = nls.localize('nextEditorInGroup', "Open Next Editor in Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1060,8 +1061,8 @@ export class OpenNextEditorInGroup extends BaseNavigateEditorAction {
|
||||
|
||||
export class OpenPreviousEditorInGroup extends BaseNavigateEditorAction {
|
||||
|
||||
public static ID = 'workbench.action.previousEditorInGroup';
|
||||
public static LABEL = nls.localize('openPreviousEditorInGroup', "Open Previous Editor in Group");
|
||||
public static readonly ID = 'workbench.action.previousEditorInGroup';
|
||||
public static readonly LABEL = nls.localize('openPreviousEditorInGroup', "Open Previous Editor in Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1077,10 +1078,29 @@ export class OpenPreviousEditorInGroup extends BaseNavigateEditorAction {
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenLastEditorInGroup extends BaseNavigateEditorAction {
|
||||
|
||||
public static readonly ID = 'workbench.action.lastEditorInGroup';
|
||||
public static readonly LABEL = nls.localize('lastEditorInGroup', "Open Last Editor in Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IEditorGroupService editorGroupService: IEditorGroupService,
|
||||
@IWorkbenchEditorService editorService: IWorkbenchEditorService
|
||||
) {
|
||||
super(id, label, editorGroupService, editorService);
|
||||
}
|
||||
|
||||
protected navigate(): IEditorIdentifier {
|
||||
return this.editorGroupService.getStacksModel().last();
|
||||
}
|
||||
}
|
||||
|
||||
export class NavigateForwardAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.navigateForward';
|
||||
public static LABEL = nls.localize('navigateNext', "Go Forward");
|
||||
public static readonly ID = 'workbench.action.navigateForward';
|
||||
public static readonly LABEL = nls.localize('navigateNext', "Go Forward");
|
||||
|
||||
constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
|
||||
super(id, label);
|
||||
@@ -1095,8 +1115,8 @@ export class NavigateForwardAction extends Action {
|
||||
|
||||
export class NavigateBackwardsAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.navigateBack';
|
||||
public static LABEL = nls.localize('navigatePrevious', "Go Back");
|
||||
public static readonly ID = 'workbench.action.navigateBack';
|
||||
public static readonly LABEL = nls.localize('navigatePrevious', "Go Back");
|
||||
|
||||
constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
|
||||
super(id, label);
|
||||
@@ -1111,8 +1131,8 @@ export class NavigateBackwardsAction extends Action {
|
||||
|
||||
export class NavigateLastAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.navigateLast';
|
||||
public static LABEL = nls.localize('navigateLast', "Go Last");
|
||||
public static readonly ID = 'workbench.action.navigateLast';
|
||||
public static readonly LABEL = nls.localize('navigateLast', "Go Last");
|
||||
|
||||
constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
|
||||
super(id, label);
|
||||
@@ -1127,8 +1147,8 @@ export class NavigateLastAction extends Action {
|
||||
|
||||
export class ReopenClosedEditorAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.reopenClosedEditor';
|
||||
public static LABEL = nls.localize('reopenClosedEditor', "Reopen Closed Editor");
|
||||
public static readonly ID = 'workbench.action.reopenClosedEditor';
|
||||
public static readonly LABEL = nls.localize('reopenClosedEditor', "Reopen Closed Editor");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1147,8 +1167,8 @@ export class ReopenClosedEditorAction extends Action {
|
||||
|
||||
export class ClearRecentFilesAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.clearRecentFiles';
|
||||
public static LABEL = nls.localize('clearRecentFiles', "Clear Recently Opened");
|
||||
public static readonly ID = 'workbench.action.clearRecentFiles';
|
||||
public static readonly LABEL = nls.localize('clearRecentFiles', "Clear Recently Opened");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1169,8 +1189,8 @@ export const NAVIGATE_IN_GROUP_ONE_PREFIX = 'edt one ';
|
||||
|
||||
export class ShowEditorsInGroupOneAction extends QuickOpenAction {
|
||||
|
||||
public static ID = 'workbench.action.showEditorsInFirstGroup';
|
||||
public static LABEL = nls.localize('showEditorsInFirstGroup', "Show Editors in First Group");
|
||||
public static readonly ID = 'workbench.action.showEditorsInFirstGroup';
|
||||
public static readonly LABEL = nls.localize('showEditorsInFirstGroup', "Show Editors in First Group");
|
||||
|
||||
constructor(
|
||||
actionId: string,
|
||||
@@ -1187,8 +1207,8 @@ export const NAVIGATE_IN_GROUP_TWO_PREFIX = 'edt two ';
|
||||
|
||||
export class ShowEditorsInGroupTwoAction extends QuickOpenAction {
|
||||
|
||||
public static ID = 'workbench.action.showEditorsInSecondGroup';
|
||||
public static LABEL = nls.localize('showEditorsInSecondGroup', "Show Editors in Second Group");
|
||||
public static readonly ID = 'workbench.action.showEditorsInSecondGroup';
|
||||
public static readonly LABEL = nls.localize('showEditorsInSecondGroup', "Show Editors in Second Group");
|
||||
|
||||
constructor(
|
||||
actionId: string,
|
||||
@@ -1205,8 +1225,8 @@ export const NAVIGATE_IN_GROUP_THREE_PREFIX = 'edt three ';
|
||||
|
||||
export class ShowEditorsInGroupThreeAction extends QuickOpenAction {
|
||||
|
||||
public static ID = 'workbench.action.showEditorsInThirdGroup';
|
||||
public static LABEL = nls.localize('showEditorsInThirdGroup', "Show Editors in Third Group");
|
||||
public static readonly ID = 'workbench.action.showEditorsInThirdGroup';
|
||||
public static readonly LABEL = nls.localize('showEditorsInThirdGroup', "Show Editors in Third Group");
|
||||
|
||||
constructor(
|
||||
actionId: string,
|
||||
@@ -1221,8 +1241,8 @@ export class ShowEditorsInGroupThreeAction extends QuickOpenAction {
|
||||
|
||||
export class ShowEditorsInGroupAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.showEditorsInGroup';
|
||||
public static LABEL = nls.localize('showEditorsInGroup', "Show Editors in Group");
|
||||
public static readonly ID = 'workbench.action.showEditorsInGroup';
|
||||
public static readonly LABEL = nls.localize('showEditorsInGroup', "Show Editors in Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1255,8 +1275,8 @@ export const NAVIGATE_ALL_EDITORS_GROUP_PREFIX = 'edt ';
|
||||
|
||||
export class ShowAllEditorsAction extends QuickOpenAction {
|
||||
|
||||
public static ID = 'workbench.action.showAllEditors';
|
||||
public static LABEL = nls.localize('showAllEditors', "Show All Editors");
|
||||
public static readonly ID = 'workbench.action.showAllEditors';
|
||||
public static readonly LABEL = nls.localize('showAllEditors', "Show All Editors");
|
||||
|
||||
constructor(actionId: string, actionLabel: string, @IQuickOpenService quickOpenService: IQuickOpenService) {
|
||||
super(actionId, actionLabel, NAVIGATE_ALL_EDITORS_GROUP_PREFIX, quickOpenService);
|
||||
@@ -1298,8 +1318,8 @@ export class BaseQuickOpenEditorInGroupAction extends Action {
|
||||
|
||||
export class OpenPreviousRecentlyUsedEditorInGroupAction extends BaseQuickOpenEditorInGroupAction {
|
||||
|
||||
public static ID = 'workbench.action.openPreviousRecentlyUsedEditorInGroup';
|
||||
public static LABEL = nls.localize('openPreviousRecentlyUsedEditorInGroup', "Open Previous Recently Used Editor in Group");
|
||||
public static readonly ID = 'workbench.action.openPreviousRecentlyUsedEditorInGroup';
|
||||
public static readonly LABEL = nls.localize('openPreviousRecentlyUsedEditorInGroup', "Open Previous Recently Used Editor in Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1314,8 +1334,8 @@ export class OpenPreviousRecentlyUsedEditorInGroupAction extends BaseQuickOpenEd
|
||||
|
||||
export class OpenNextRecentlyUsedEditorInGroupAction extends BaseQuickOpenEditorInGroupAction {
|
||||
|
||||
public static ID = 'workbench.action.openNextRecentlyUsedEditorInGroup';
|
||||
public static LABEL = nls.localize('openNextRecentlyUsedEditorInGroup', "Open Next Recently Used Editor in Group");
|
||||
public static readonly ID = 'workbench.action.openNextRecentlyUsedEditorInGroup';
|
||||
public static readonly LABEL = nls.localize('openNextRecentlyUsedEditorInGroup', "Open Next Recently Used Editor in Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1330,8 +1350,8 @@ export class OpenNextRecentlyUsedEditorInGroupAction extends BaseQuickOpenEditor
|
||||
|
||||
export class OpenPreviousEditorFromHistoryAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.openPreviousEditorFromHistory';
|
||||
public static LABEL = nls.localize('navigateEditorHistoryByInput', "Open Previous Editor from History");
|
||||
public static readonly ID = 'workbench.action.openPreviousEditorFromHistory';
|
||||
public static readonly LABEL = nls.localize('navigateEditorHistoryByInput', "Open Previous Editor from History");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1353,8 +1373,8 @@ export class OpenPreviousEditorFromHistoryAction extends Action {
|
||||
|
||||
export class OpenNextRecentlyUsedEditorAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.openNextRecentlyUsedEditor';
|
||||
public static LABEL = nls.localize('openNextRecentlyUsedEditor', "Open Next Recently Used Editor");
|
||||
public static readonly ID = 'workbench.action.openNextRecentlyUsedEditor';
|
||||
public static readonly LABEL = nls.localize('openNextRecentlyUsedEditor', "Open Next Recently Used Editor");
|
||||
|
||||
constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
|
||||
super(id, label);
|
||||
@@ -1369,8 +1389,8 @@ export class OpenNextRecentlyUsedEditorAction extends Action {
|
||||
|
||||
export class OpenPreviousRecentlyUsedEditorAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.openPreviousRecentlyUsedEditor';
|
||||
public static LABEL = nls.localize('openPreviousRecentlyUsedEditor', "Open Previous Recently Used Editor");
|
||||
public static readonly ID = 'workbench.action.openPreviousRecentlyUsedEditor';
|
||||
public static readonly LABEL = nls.localize('openPreviousRecentlyUsedEditor', "Open Previous Recently Used Editor");
|
||||
|
||||
constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
|
||||
super(id, label);
|
||||
@@ -1385,8 +1405,8 @@ export class OpenPreviousRecentlyUsedEditorAction extends Action {
|
||||
|
||||
export class ClearEditorHistoryAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.clearEditorHistory';
|
||||
public static LABEL = nls.localize('clearEditorHistory', "Clear Editor History");
|
||||
public static readonly ID = 'workbench.action.clearEditorHistory';
|
||||
public static readonly LABEL = nls.localize('clearEditorHistory', "Clear Editor History");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1407,8 +1427,8 @@ export class ClearEditorHistoryAction extends Action {
|
||||
|
||||
export class FocusLastEditorInStackAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.openLastEditorInGroup';
|
||||
public static LABEL = nls.localize('focusLastEditorInStack', "Open Last Editor in Group");
|
||||
public static readonly ID = 'workbench.action.openLastEditorInGroup';
|
||||
public static readonly LABEL = nls.localize('focusLastEditorInStack', "Open Last Editor in Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1436,8 +1456,8 @@ export class FocusLastEditorInStackAction extends Action {
|
||||
|
||||
export class MoveEditorLeftInGroupAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.moveEditorLeftInGroup';
|
||||
public static LABEL = nls.localize('moveEditorLeft', "Move Editor Left");
|
||||
public static readonly ID = 'workbench.action.moveEditorLeftInGroup';
|
||||
public static readonly LABEL = nls.localize('moveEditorLeft', "Move Editor Left");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1459,8 +1479,8 @@ export class MoveEditorLeftInGroupAction extends Action {
|
||||
|
||||
export class MoveEditorRightInGroupAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.moveEditorRightInGroup';
|
||||
public static LABEL = nls.localize('moveEditorRight', "Move Editor Right");
|
||||
public static readonly ID = 'workbench.action.moveEditorRightInGroup';
|
||||
public static readonly LABEL = nls.localize('moveEditorRight', "Move Editor Right");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1482,8 +1502,8 @@ export class MoveEditorRightInGroupAction extends Action {
|
||||
|
||||
export class MoveEditorToPreviousGroupAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.moveEditorToPreviousGroup';
|
||||
public static LABEL = nls.localize('moveEditorToPreviousGroup', "Move Editor into Previous Group");
|
||||
public static readonly ID = 'workbench.action.moveEditorToPreviousGroup';
|
||||
public static readonly LABEL = nls.localize('moveEditorToPreviousGroup', "Move Editor into Previous Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -1506,8 +1526,8 @@ export class MoveEditorToPreviousGroupAction extends Action {
|
||||
|
||||
export class MoveEditorToNextGroupAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.moveEditorToNextGroup';
|
||||
public static LABEL = nls.localize('moveEditorToNextGroup', "Move Editor into Next Group");
|
||||
public static readonly ID = 'workbench.action.moveEditorToNextGroup';
|
||||
public static readonly LABEL = nls.localize('moveEditorToNextGroup', "Move Editor into Next Group");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
|
||||
@@ -60,11 +60,7 @@ function registerActiveEditorMoveCommand(): void {
|
||||
args: [
|
||||
{
|
||||
name: nls.localize('editorCommand.activeEditorMove.arg.name', "Active editor move argument"),
|
||||
description: nls.localize('editorCommand.activeEditorMove.arg.description', `Argument Properties:
|
||||
* 'to': String value providing where to move.
|
||||
* 'by': String value providing the unit for move. By tab or by group.
|
||||
* 'value': Number value providing how many positions or an absolute position to move.
|
||||
`),
|
||||
description: nls.localize('editorCommand.activeEditorMove.arg.description', "Argument Properties:\n\t* 'to': String value providing where to move.\n\t* 'by': String value providing the unit for move. By tab or by group.\n\t* 'value': Number value providing how many positions or an absolute position to move."),
|
||||
constraint: isActiveEditorMoveArg
|
||||
}
|
||||
]
|
||||
|
||||
@@ -21,7 +21,6 @@ import { isMacintosh } from 'vs/base/common/platform';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { Position, POSITIONS } from 'vs/platform/editor/common/editor';
|
||||
import { IEditorGroupService, IEditorTabOptions, GroupArrangement, GroupOrientation } from 'vs/workbench/services/group/common/groupService';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
@@ -30,9 +29,9 @@ import { TabsTitleControl } from 'vs/workbench/browser/parts/editor/tabsTitleCon
|
||||
import { TitleControl, ITitleAreaControl, handleWorkspaceExternalDrop } from 'vs/workbench/browser/parts/editor/titleControl';
|
||||
import { NoTabsTitleControl } from 'vs/workbench/browser/parts/editor/noTabsTitleControl';
|
||||
import { IEditorStacksModel, IStacksModelChangeEvent, IEditorGroup, EditorOptions, TextEditorOptions, IEditorIdentifier } from 'vs/workbench/common/editor';
|
||||
import { extractResources } from 'vs/base/browser/dnd';
|
||||
import { extractResources } from 'vs/workbench/browser/editor';
|
||||
import { IWindowService, IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { getCodeEditor } from 'vs/editor/common/services/codeEditorService';
|
||||
import { getCodeEditor } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { editorBackground, contrastBorder, activeContrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { Themable, EDITOR_GROUP_HEADER_TABS_BACKGROUND, EDITOR_GROUP_HEADER_NO_TABS_BACKGROUND, EDITOR_GROUP_BORDER, EDITOR_DRAG_AND_DROP_BACKGROUND, EDITOR_GROUP_BACKGROUND, EDITOR_GROUP_HEADER_TABS_BORDER } from 'vs/workbench/common/theme';
|
||||
@@ -40,6 +39,7 @@ import { attachProgressBarStyler } from 'vs/platform/theme/common/styler';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IDisposable, combinedDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
export enum Rochade {
|
||||
NONE,
|
||||
@@ -98,17 +98,17 @@ export interface IEditorGroupsControl {
|
||||
*/
|
||||
export class EditorGroupsControl extends Themable implements IEditorGroupsControl, IVerticalSashLayoutProvider, IHorizontalSashLayoutProvider {
|
||||
|
||||
private static TITLE_AREA_CONTROL_KEY = '__titleAreaControl';
|
||||
private static PROGRESS_BAR_CONTROL_KEY = '__progressBar';
|
||||
private static INSTANTIATION_SERVICE_KEY = '__instantiationService';
|
||||
private static readonly TITLE_AREA_CONTROL_KEY = '__titleAreaControl';
|
||||
private static readonly PROGRESS_BAR_CONTROL_KEY = '__progressBar';
|
||||
private static readonly INSTANTIATION_SERVICE_KEY = '__instantiationService';
|
||||
|
||||
private static MIN_EDITOR_WIDTH = 170;
|
||||
private static MIN_EDITOR_HEIGHT = 70;
|
||||
private static readonly MIN_EDITOR_WIDTH = 170;
|
||||
private static readonly MIN_EDITOR_HEIGHT = 70;
|
||||
|
||||
private static EDITOR_TITLE_HEIGHT = 35;
|
||||
private static readonly EDITOR_TITLE_HEIGHT = 35;
|
||||
|
||||
private static SNAP_TO_MINIMIZED_THRESHOLD_WIDTH = 50;
|
||||
private static SNAP_TO_MINIMIZED_THRESHOLD_HEIGHT = 20;
|
||||
private static readonly SNAP_TO_MINIMIZED_THRESHOLD_WIDTH = 50;
|
||||
private static readonly SNAP_TO_MINIMIZED_THRESHOLD_HEIGHT = 20;
|
||||
|
||||
private stacks: IEditorStacksModel;
|
||||
|
||||
@@ -136,7 +136,7 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
private lastActiveEditor: BaseEditor;
|
||||
private lastActivePosition: Position;
|
||||
|
||||
private visibleEditorFocusTrackers: DOM.IFocusTracker[];
|
||||
private visibleEditorFocusTrackerDisposable: IDisposable[];
|
||||
|
||||
private _onGroupFocusChanged: Emitter<void>;
|
||||
|
||||
@@ -148,7 +148,6 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
groupOrientation: GroupOrientation,
|
||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
||||
@IEditorGroupService private editorGroupService: IEditorGroupService,
|
||||
@ITelemetryService private telemetryService: ITelemetryService,
|
||||
@IContextKeyService private contextKeyService: IContextKeyService,
|
||||
@IExtensionService private extensionService: IExtensionService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@@ -171,7 +170,7 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
this.silosMinimized = [];
|
||||
|
||||
this.visibleEditors = [];
|
||||
this.visibleEditorFocusTrackers = [];
|
||||
this.visibleEditorFocusTrackerDisposable = [];
|
||||
|
||||
this._onGroupFocusChanged = new Emitter<void>();
|
||||
this.toUnbind.push(this._onGroupFocusChanged);
|
||||
@@ -225,11 +224,14 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
private registerListeners(): void {
|
||||
this.toUnbind.push(this.stacks.onModelChanged(e => this.onStacksChanged(e)));
|
||||
this.toUnbind.push(this.editorGroupService.onTabOptionsChanged(options => this.updateTabOptions(options, true)));
|
||||
this.extensionService.onReady().then(() => this.onExtensionsReady());
|
||||
this.toUnbind.push(this.extensionService.onDidRegisterExtensions(() => this.onDidRegisterExtensions()));
|
||||
}
|
||||
|
||||
private updateTabOptions(tabOptions: IEditorTabOptions, refresh?: boolean): void {
|
||||
const tabCloseButton = this.tabOptions ? this.tabOptions.tabCloseButton : 'right';
|
||||
const tabSizing = this.tabOptions ? this.tabOptions.tabSizing : 'fit';
|
||||
const iconTheme = this.tabOptions ? this.tabOptions.iconTheme : 'vs-seti';
|
||||
|
||||
this.tabOptions = tabOptions;
|
||||
|
||||
if (!refresh) {
|
||||
@@ -266,8 +268,13 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
this.createTitleControl(this.stacks.groupAt(position), this.silos[position], titleContainer, this.getInstantiationService(position));
|
||||
}
|
||||
|
||||
// Refresh title when icons change
|
||||
else if (showingIcons !== this.tabOptions.showIcons || tabCloseButton !== this.tabOptions.tabCloseButton) {
|
||||
// Refresh title when layout options change
|
||||
else if (
|
||||
showingIcons !== this.tabOptions.showIcons ||
|
||||
tabCloseButton !== this.tabOptions.tabCloseButton ||
|
||||
tabSizing !== this.tabOptions.tabSizing ||
|
||||
iconTheme !== this.tabOptions.iconTheme
|
||||
) {
|
||||
titleControl.refresh();
|
||||
}
|
||||
}
|
||||
@@ -277,7 +284,7 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
});
|
||||
}
|
||||
|
||||
private onExtensionsReady(): void {
|
||||
private onDidRegisterExtensions(): void {
|
||||
|
||||
// Up to date title areas
|
||||
POSITIONS.forEach(position => this.getTitleAreaControl(position).update());
|
||||
@@ -420,15 +427,17 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
private trackFocus(editor: BaseEditor, position: Position): void {
|
||||
|
||||
// In case there is a previous tracker on the position, dispose it first
|
||||
if (this.visibleEditorFocusTrackers[position]) {
|
||||
this.visibleEditorFocusTrackers[position].dispose();
|
||||
if (this.visibleEditorFocusTrackerDisposable[position]) {
|
||||
this.visibleEditorFocusTrackerDisposable[position].dispose();
|
||||
}
|
||||
|
||||
// Track focus on editor container
|
||||
this.visibleEditorFocusTrackers[position] = DOM.trackFocus(editor.getContainer().getHTMLElement());
|
||||
this.visibleEditorFocusTrackers[position].addFocusListener(() => {
|
||||
const focusTracker = DOM.trackFocus(editor.getContainer().getHTMLElement());
|
||||
const listenerDispose = focusTracker.onDidFocus(() => {
|
||||
this.onFocusGained(editor);
|
||||
});
|
||||
|
||||
this.visibleEditorFocusTrackerDisposable[position] = combinedDisposable([focusTracker, listenerDispose]);
|
||||
}
|
||||
|
||||
private onFocusGained(editor: BaseEditor): void {
|
||||
@@ -443,15 +452,6 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
|
||||
// Automatically maximize this position if it is minimized
|
||||
if (this.isSiloMinimized(this.lastActivePosition)) {
|
||||
|
||||
// Log this fact in telemetry
|
||||
if (this.telemetryService) {
|
||||
/* __GDPR__
|
||||
"workbenchEditorMaximized" : {}
|
||||
*/
|
||||
this.telemetryService.publicLog('workbenchEditorMaximized');
|
||||
}
|
||||
|
||||
let remainingSize = this.totalSize;
|
||||
let layout = false;
|
||||
|
||||
@@ -629,9 +629,9 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
private clearPosition(position: Position): void {
|
||||
|
||||
// Unregister Listeners
|
||||
if (this.visibleEditorFocusTrackers[position]) {
|
||||
this.visibleEditorFocusTrackers[position].dispose();
|
||||
this.visibleEditorFocusTrackers[position] = null;
|
||||
if (this.visibleEditorFocusTrackerDisposable[position]) {
|
||||
this.visibleEditorFocusTrackerDisposable[position].dispose();
|
||||
this.visibleEditorFocusTrackerDisposable[position] = null;
|
||||
}
|
||||
|
||||
// Clear from active editors
|
||||
@@ -652,9 +652,9 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
editor.changePosition(to);
|
||||
|
||||
// Change data structures
|
||||
const listeners = this.visibleEditorFocusTrackers[from];
|
||||
this.visibleEditorFocusTrackers[to] = listeners;
|
||||
this.visibleEditorFocusTrackers[from] = null;
|
||||
const listeners = this.visibleEditorFocusTrackerDisposable[from];
|
||||
this.visibleEditorFocusTrackerDisposable[to] = listeners;
|
||||
this.visibleEditorFocusTrackerDisposable[from] = null;
|
||||
|
||||
const minimizedState = this.silosMinimized[from];
|
||||
this.silosMinimized[to] = minimizedState;
|
||||
@@ -738,7 +738,7 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
|
||||
// Change data structures
|
||||
arrays.move(this.visibleEditors, from, to);
|
||||
arrays.move(this.visibleEditorFocusTrackers, from, to);
|
||||
arrays.move(this.visibleEditorFocusTrackerDisposable, from, to);
|
||||
arrays.move(this.silosSize, from, to);
|
||||
arrays.move(this.silosMinimized, from, to);
|
||||
|
||||
@@ -957,10 +957,10 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
|
||||
// Sash One
|
||||
this.sashOne = new Sash(this.parent.getHTMLElement(), this, { baseSize: 5, orientation: this.layoutVertically ? Orientation.VERTICAL : Orientation.HORIZONTAL });
|
||||
this.toUnbind.push(this.sashOne.addListener('start', () => this.onSashOneDragStart()));
|
||||
this.toUnbind.push(this.sashOne.addListener('change', (e: ISashEvent) => this.onSashOneDrag(e)));
|
||||
this.toUnbind.push(this.sashOne.addListener('end', () => this.onSashOneDragEnd()));
|
||||
this.toUnbind.push(this.sashOne.addListener('reset', () => this.onSashOneReset()));
|
||||
this.toUnbind.push(this.sashOne.onDidStart(() => this.onSashOneDragStart()));
|
||||
this.toUnbind.push(this.sashOne.onDidChange((e: ISashEvent) => this.onSashOneDrag(e)));
|
||||
this.toUnbind.push(this.sashOne.onDidEnd(() => this.onSashOneDragEnd()));
|
||||
this.toUnbind.push(this.sashOne.onDidReset(() => this.onSashOneReset()));
|
||||
this.sashOne.hide();
|
||||
|
||||
// Silo Two
|
||||
@@ -968,10 +968,10 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
|
||||
// Sash Two
|
||||
this.sashTwo = new Sash(this.parent.getHTMLElement(), this, { baseSize: 5, orientation: this.layoutVertically ? Orientation.VERTICAL : Orientation.HORIZONTAL });
|
||||
this.toUnbind.push(this.sashTwo.addListener('start', () => this.onSashTwoDragStart()));
|
||||
this.toUnbind.push(this.sashTwo.addListener('change', (e: ISashEvent) => this.onSashTwoDrag(e)));
|
||||
this.toUnbind.push(this.sashTwo.addListener('end', () => this.onSashTwoDragEnd()));
|
||||
this.toUnbind.push(this.sashTwo.addListener('reset', () => this.onSashTwoReset()));
|
||||
this.toUnbind.push(this.sashTwo.onDidStart(() => this.onSashTwoDragStart()));
|
||||
this.toUnbind.push(this.sashTwo.onDidChange((e: ISashEvent) => this.onSashTwoDrag(e)));
|
||||
this.toUnbind.push(this.sashTwo.onDidEnd(() => this.onSashTwoDragEnd()));
|
||||
this.toUnbind.push(this.sashTwo.onDidReset(() => this.onSashTwoReset()));
|
||||
this.sashTwo.hide();
|
||||
|
||||
// Silo Three
|
||||
@@ -2040,7 +2040,9 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
|
||||
// Layout title controls
|
||||
POSITIONS.forEach(position => {
|
||||
this.getTitleAreaControl(position).layout();
|
||||
const siloWidth = this.layoutVertically ? this.silosSize[position] : this.dimension.width;
|
||||
|
||||
this.getTitleAreaControl(position).layout(new Dimension(siloWidth, EditorGroupsControl.EDITOR_TITLE_HEIGHT));
|
||||
});
|
||||
|
||||
// Update minimized state
|
||||
|
||||
@@ -16,7 +16,7 @@ import arrays = require('vs/base/common/arrays');
|
||||
import types = require('vs/base/common/types');
|
||||
import errors = require('vs/base/common/errors');
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import { getCodeEditor } from 'vs/editor/common/services/codeEditorService';
|
||||
import { getCodeEditor } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
import { Scope as MementoScope } from 'vs/workbench/common/memento';
|
||||
import { Part } from 'vs/workbench/browser/part';
|
||||
@@ -41,16 +41,16 @@ import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/c
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { editorBackground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { EDITOR_GROUP_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import { createCSSRule } from 'vs/base/browser/dom';
|
||||
import { createCSSRule, scheduleAtNextAnimationFrame } from 'vs/base/browser/dom';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { isCommonCodeEditor } from 'vs/editor/common/editorCommon';
|
||||
import { IEditorDescriptor, IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/browser/editor';
|
||||
import { ThrottledEmitter } from 'vs/base/common/async';
|
||||
import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
import { convertEditorInput } from 'sql/parts/common/customInputConverter';
|
||||
|
||||
|
||||
class ProgressMonitor {
|
||||
|
||||
constructor(private _token: number, private progressPromise: TPromise<void>) { }
|
||||
@@ -84,14 +84,14 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
|
||||
public _serviceBrand: any;
|
||||
|
||||
private static GROUP_LEFT = nls.localize('groupOneVertical', "Left");
|
||||
private static GROUP_CENTER = nls.localize('groupTwoVertical', "Center");
|
||||
private static GROUP_RIGHT = nls.localize('groupThreeVertical', "Right");
|
||||
private static GROUP_TOP = nls.localize('groupOneHorizontal', "Top");
|
||||
private static GROUP_MIDDLE = nls.localize('groupTwoHorizontal', "Center");
|
||||
private static GROUP_BOTTOM = nls.localize('groupThreeHorizontal', "Bottom");
|
||||
private static readonly GROUP_LEFT = nls.localize('groupOneVertical', "Left");
|
||||
private static readonly GROUP_CENTER = nls.localize('groupTwoVertical', "Center");
|
||||
private static readonly GROUP_RIGHT = nls.localize('groupThreeVertical', "Right");
|
||||
private static readonly GROUP_TOP = nls.localize('groupOneHorizontal', "Top");
|
||||
private static readonly GROUP_MIDDLE = nls.localize('groupTwoHorizontal', "Center");
|
||||
private static readonly GROUP_BOTTOM = nls.localize('groupThreeHorizontal', "Bottom");
|
||||
|
||||
private static EDITOR_PART_UI_STATE_STORAGE_KEY = 'editorpart.uiState';
|
||||
private static readonly EDITOR_PART_UI_STATE_STORAGE_KEY = 'editorpart.uiState';
|
||||
|
||||
private dimension: Dimension;
|
||||
private editorGroupsControl: IEditorGroupsControl;
|
||||
@@ -102,7 +102,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
private doNotFireTabOptionsChanged: boolean;
|
||||
private revealIfOpen: boolean;
|
||||
|
||||
private _onEditorsChanged: Emitter<void>;
|
||||
private _onEditorsChanged: ThrottledEmitter<void>;
|
||||
private _onEditorOpening: Emitter<IEditorOpeningEvent>;
|
||||
private _onEditorGroupMoved: Emitter<void>;
|
||||
private _onEditorOpenFail: Emitter<EditorInput>;
|
||||
@@ -136,7 +136,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
) {
|
||||
super(id, { hasTitle: false }, themeService);
|
||||
|
||||
this._onEditorsChanged = new Emitter<void>();
|
||||
this._onEditorsChanged = new ThrottledEmitter<void>();
|
||||
this._onEditorOpening = new Emitter<IEditorOpeningEvent>();
|
||||
this._onEditorGroupMoved = new Emitter<void>();
|
||||
this._onEditorOpenFail = new Emitter<EditorInput>();
|
||||
@@ -156,7 +156,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
|
||||
this.textCompareEditorVisible = TextCompareEditorVisible.bindTo(contextKeyService);
|
||||
|
||||
const config = configurationService.getConfiguration<IWorkbenchEditorConfiguration>();
|
||||
const config = configurationService.getValue<IWorkbenchEditorConfiguration>();
|
||||
if (config && config.workbench && config.workbench.editor) {
|
||||
const editorConfig = config.workbench.editor;
|
||||
|
||||
@@ -165,26 +165,21 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
showIcons: editorConfig.showIcons,
|
||||
showTabs: editorConfig.showTabs,
|
||||
tabCloseButton: editorConfig.tabCloseButton,
|
||||
tabSizing: editorConfig.tabSizing,
|
||||
labelFormat: editorConfig.labelFormat,
|
||||
iconTheme: config.workbench.iconTheme
|
||||
};
|
||||
|
||||
this.revealIfOpen = editorConfig.revealIfOpen;
|
||||
|
||||
/* __GDPR__
|
||||
"workbenchEditorConfiguration" : {
|
||||
"${include}": [
|
||||
"${IWorkbenchEditorConfiguration}"
|
||||
]
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('workbenchEditorConfiguration', editorConfig);
|
||||
} else {
|
||||
this.tabOptions = {
|
||||
previewEditors: true,
|
||||
showIcons: false,
|
||||
showTabs: true,
|
||||
tabCloseButton: 'right',
|
||||
tabSizing: 'fit',
|
||||
labelFormat: 'default',
|
||||
iconTheme: 'vs-seti'
|
||||
};
|
||||
|
||||
this.revealIfOpen = false;
|
||||
@@ -218,8 +213,8 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
}
|
||||
|
||||
private onConfigurationUpdated(event: IConfigurationChangeEvent): void {
|
||||
if (event.affectsConfiguration('workbench.editor')) {
|
||||
const configuration = this.configurationService.getConfiguration<IWorkbenchEditorConfiguration>();
|
||||
if (event.affectsConfiguration('workbench.editor') || event.affectsConfiguration('workbench.iconTheme')) {
|
||||
const configuration = this.configurationService.getValue<IWorkbenchEditorConfiguration>();
|
||||
if (configuration && configuration.workbench && configuration.workbench.editor) {
|
||||
const editorConfig = configuration.workbench.editor;
|
||||
|
||||
@@ -233,13 +228,15 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
});
|
||||
}
|
||||
|
||||
const oldTabOptions = objects.clone(this.tabOptions);
|
||||
const oldTabOptions = objects.deepClone(this.tabOptions);
|
||||
this.tabOptions = {
|
||||
previewEditors: newPreviewEditors,
|
||||
showIcons: editorConfig.showIcons,
|
||||
tabCloseButton: editorConfig.tabCloseButton,
|
||||
tabSizing: editorConfig.tabSizing,
|
||||
showTabs: this.forceHideTabs ? false : editorConfig.showTabs,
|
||||
labelFormat: editorConfig.labelFormat,
|
||||
iconTheme: configuration.workbench.iconTheme
|
||||
};
|
||||
|
||||
if (!this.doNotFireTabOptionsChanged && !objects.equals(oldTabOptions, this.tabOptions)) {
|
||||
@@ -286,7 +283,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
|
||||
public hideTabs(forceHide: boolean): void {
|
||||
this.forceHideTabs = forceHide;
|
||||
const config = this.configurationService.getConfiguration<IWorkbenchEditorConfiguration>();
|
||||
const config = this.configurationService.getValue<IWorkbenchEditorConfiguration>();
|
||||
this.tabOptions.showTabs = forceHide ? false : config && config.workbench && config.workbench.editor && config.workbench.editor.showTabs;
|
||||
this._onTabOptionsChanged.fire(this.tabOptions);
|
||||
}
|
||||
@@ -340,7 +337,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
!this.editorGroupsControl || // too early
|
||||
this.editorGroupsControl.isDragging() // pending editor DND
|
||||
) {
|
||||
return TPromise.as<BaseEditor>(null);
|
||||
return TPromise.wrap<BaseEditor>(null);
|
||||
}
|
||||
|
||||
// Editor opening event (can be prevented and overridden)
|
||||
@@ -367,16 +364,6 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
return TPromise.wrapError<BaseEditor>(new Error(strings.format('Can not find a registered editor for the input {0}', input)));
|
||||
}
|
||||
|
||||
// Opened to the side
|
||||
if (position !== Position.ONE) {
|
||||
/* __GDPR__
|
||||
"workbenchSideEditorOpened" : {
|
||||
"position" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('workbenchSideEditorOpened', { position: position });
|
||||
}
|
||||
|
||||
// Update stacks: We do this early on before the UI is there because we want our stacks model to have
|
||||
// a consistent view of the editor world and updating it later async after the UI is there will cause
|
||||
// issues (e.g. when a closeEditor call is made that expects the openEditor call to have updated the
|
||||
@@ -392,7 +379,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
|
||||
// Return early if the editor is to be open inactive and there are other editors in this group to show
|
||||
if (!active) {
|
||||
return TPromise.as<BaseEditor>(null);
|
||||
return TPromise.wrap<BaseEditor>(null);
|
||||
}
|
||||
|
||||
// Progress Monitor & Ref Counting
|
||||
@@ -409,7 +396,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
// Show editor
|
||||
const editor = this.doShowEditor(group, descriptor, input, options, ratio, monitor);
|
||||
if (!editor) {
|
||||
return TPromise.as<BaseEditor>(null); // canceled or other error
|
||||
return TPromise.wrap<BaseEditor>(null); // canceled or other error
|
||||
}
|
||||
|
||||
// Set input to editor
|
||||
@@ -583,14 +570,14 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
|
||||
// Recover by closing the active editor (if the input is still the active one)
|
||||
if (group.activeEditor === input) {
|
||||
this.doCloseActiveEditor(group);
|
||||
this.doCloseActiveEditor(group, !(options && options.preserveFocus) /* still preserve focus as needed */);
|
||||
}
|
||||
}
|
||||
|
||||
public closeEditor(position: Position, input: EditorInput): TPromise<void> {
|
||||
const group = this.stacks.groupAt(position);
|
||||
if (!group) {
|
||||
return TPromise.as<void>(null);
|
||||
return TPromise.wrap<void>(null);
|
||||
}
|
||||
|
||||
// Check for dirty and veto
|
||||
@@ -713,9 +700,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
}
|
||||
|
||||
// Check for dirty and veto
|
||||
const editorsToClose = arrays.flatten(groups.map(group => group.getEditors().map(editor => { return { group, editor }; })));
|
||||
|
||||
return this.handleDirty(editorsToClose).then(veto => {
|
||||
return this.handleDirty(arrays.flatten(groups.map(group => group.getEditors(true /* in MRU order */).map(editor => { return { group, editor }; })))).then(veto => {
|
||||
if (veto) {
|
||||
return;
|
||||
}
|
||||
@@ -727,22 +712,27 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
public closeEditors(position: Position, filter: { except?: EditorInput, direction?: Direction, unmodifiedOnly?: boolean } = Object.create(null)): TPromise<void> {
|
||||
const group = this.stacks.groupAt(position);
|
||||
if (!group) {
|
||||
return TPromise.as<void>(null);
|
||||
return TPromise.wrap<void>(null);
|
||||
}
|
||||
|
||||
let editors = group.getEditors();
|
||||
let editorsToClose = group.getEditors(true /* in MRU order */);
|
||||
|
||||
// Filter: unmodified only
|
||||
if (filter.unmodifiedOnly) {
|
||||
editors = editors.filter(e => !e.isDirty());
|
||||
editorsToClose = editorsToClose.filter(e => !e.isDirty());
|
||||
}
|
||||
|
||||
// Filter: direction (left / right)
|
||||
if (!types.isUndefinedOrNull(filter.direction)) {
|
||||
editorsToClose = (filter.direction === Direction.LEFT) ? editorsToClose.slice(0, group.indexOf(filter.except)) : editorsToClose.slice(group.indexOf(filter.except) + 1);
|
||||
}
|
||||
|
||||
// Filter: except
|
||||
else {
|
||||
editorsToClose = editorsToClose.filter(e => !filter.except || !e.matches(filter.except));
|
||||
}
|
||||
|
||||
// Check for dirty and veto
|
||||
let editorsToClose: EditorInput[];
|
||||
if (types.isUndefinedOrNull(filter.direction)) {
|
||||
editorsToClose = editors.filter(e => !filter.except || !e.matches(filter.except));
|
||||
} else {
|
||||
editorsToClose = (filter.direction === Direction.LEFT) ? editors.slice(0, group.indexOf(filter.except)) : editors.slice(group.indexOf(filter.except) + 1);
|
||||
}
|
||||
|
||||
return this.handleDirty(editorsToClose.map(editor => { return { group, editor }; }), true /* ignore if opened in other group */).then(veto => {
|
||||
if (veto) {
|
||||
return;
|
||||
@@ -838,17 +828,43 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
|
||||
const { editor } = identifier;
|
||||
|
||||
const res = editor.confirmSave();
|
||||
switch (res) {
|
||||
case ConfirmResult.SAVE:
|
||||
return editor.save().then(ok => !ok);
|
||||
// Switch to editor that we want to handle
|
||||
return this.openEditor(identifier.editor, null, this.stacks.positionOfGroup(identifier.group)).then(() => {
|
||||
return this.ensureEditorOpenedBeforePrompt().then(() => {
|
||||
const res = editor.confirmSave();
|
||||
switch (res) {
|
||||
case ConfirmResult.SAVE:
|
||||
return editor.save().then(ok => !ok);
|
||||
|
||||
case ConfirmResult.DONT_SAVE:
|
||||
return editor.revert().then(ok => !ok);
|
||||
case ConfirmResult.DONT_SAVE:
|
||||
return editor.revert().then(ok => !ok);
|
||||
|
||||
case ConfirmResult.CANCEL:
|
||||
return TPromise.as(true); // veto
|
||||
}
|
||||
case ConfirmResult.CANCEL:
|
||||
return true; // veto
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private ensureEditorOpenedBeforePrompt(): TPromise<void> {
|
||||
|
||||
// Force title area update
|
||||
this.editorGroupsControl.updateTitleAreas(true /* refresh active group */);
|
||||
|
||||
// TODO@Ben our dialogs currently use the sync API, which means they block the JS
|
||||
// thread when showing. As such, any UI update will not happen unless we wait a little
|
||||
// bit. We wait for 2 request animation frames before showing the confirm. The first
|
||||
// frame is where the UI is updating and the second is good enough to bring up the dialog.
|
||||
// See also https://github.com/Microsoft/vscode/issues/39536
|
||||
return new TPromise<void>(c => {
|
||||
scheduleAtNextAnimationFrame(() => {
|
||||
// Here the UI is updating
|
||||
scheduleAtNextAnimationFrame(() => {
|
||||
// Here we can show a blocking dialog
|
||||
c(void 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private countEditors(editor: EditorInput): number {
|
||||
@@ -1146,7 +1162,8 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
|
||||
const editorState: IEditorPartUIState = this.memento[EditorPart.EDITOR_PART_UI_STATE_STORAGE_KEY];
|
||||
|
||||
return this.doOpenEditors(editors, activePosition, editorState && editorState.ratio);
|
||||
// Open editors (throttle editor change events)
|
||||
return this._onEditorsChanged.throttle(this.doOpenEditors(editors, activePosition, editorState && editorState.ratio));
|
||||
}
|
||||
|
||||
private doOpenEditors(editors: { input: EditorInput, position: Position, options?: EditorOptions }[], activePosition?: number, ratio?: number[]): TPromise<IEditor[]> {
|
||||
@@ -1294,48 +1311,11 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
}
|
||||
}
|
||||
|
||||
public unpinEditor(group: EditorGroup, input: EditorInput): void;
|
||||
public unpinEditor(position: Position, input: EditorInput): void;
|
||||
public unpinEditor(arg1: any, input: EditorInput): void {
|
||||
if (input.isDirty()) {
|
||||
return; // we do not allow to unpin dirty editors
|
||||
}
|
||||
|
||||
const group = (typeof arg1 === 'number') ? this.stacks.groupAt(arg1) : arg1;
|
||||
if (group) {
|
||||
if (group.isPreview(input)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Unpinning an editor closes the preview editor if we have any
|
||||
let handlePreviewEditor: TPromise<boolean> = TPromise.as(false);
|
||||
if (group.previewEditor) {
|
||||
handlePreviewEditor = this.handleDirty([{ group, editor: group.previewEditor }], true /* ignore if opened in other group */);
|
||||
}
|
||||
|
||||
handlePreviewEditor.done(veto => {
|
||||
if (veto) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The active editor is the preview editor and we are asked to make
|
||||
// another editor the preview editor. So we need to take care of closing
|
||||
// the active editor first
|
||||
if (group.isPreview(group.activeEditor) && !group.activeEditor.matches(input)) {
|
||||
this.doCloseActiveEditor(group);
|
||||
}
|
||||
|
||||
// Update stacks model
|
||||
group.unpin(input);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public invokeWithinEditorContext<T>(fn: (accessor: ServicesAccessor) => T): T {
|
||||
const activeEditor = this.getActiveEditor();
|
||||
if (activeEditor) {
|
||||
const activeEditorControl = activeEditor.getControl();
|
||||
if (isCommonCodeEditor(activeEditorControl)) {
|
||||
if (isCodeEditor(activeEditorControl)) {
|
||||
return activeEditorControl.invokeWithinContext(fn);
|
||||
}
|
||||
|
||||
@@ -1622,4 +1602,4 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
||||
private hasGroup(position: Position): boolean {
|
||||
return !!this.stacks.groupAt(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import { Position } from 'vs/platform/editor/common/editor';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { EditorInput, toResource, IEditorGroup, IEditorStacksModel } from 'vs/workbench/common/editor';
|
||||
import { compareItemsByScore, scoreItem, ScorerCache, prepareQuery } from 'vs/base/parts/quickopen/common/quickOpenScorer';
|
||||
|
||||
@@ -91,7 +90,6 @@ export abstract class BaseEditorPicker extends QuickOpenHandler {
|
||||
|
||||
constructor(
|
||||
@IInstantiationService protected instantiationService: IInstantiationService,
|
||||
@IWorkspaceContextService private contextService: IWorkspaceContextService,
|
||||
@IWorkbenchEditorService protected editorService: IWorkbenchEditorService,
|
||||
@IEditorGroupService protected editorGroupService: IEditorGroupService
|
||||
) {
|
||||
|
||||
@@ -23,17 +23,17 @@ import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorIn
|
||||
import { IFileEditorInput, EncodingMode, IEncodingSupport, toResource, SideBySideEditorInput } from 'vs/workbench/common/editor';
|
||||
import { IDisposable, combinedDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IEditorAction, ICommonCodeEditor, EndOfLineSequence, IModel } from 'vs/editor/common/editorCommon';
|
||||
import { IEditorAction, EndOfLineSequence, IModel } from 'vs/editor/common/editorCommon';
|
||||
import { IModelLanguageChangedEvent, IModelOptionsChangedEvent } from 'vs/editor/common/model/textModelEvents';
|
||||
import { TrimTrailingWhitespaceAction } from 'vs/editor/contrib/linesOperations/common/linesOperations';
|
||||
import { IndentUsingSpaces, IndentUsingTabs, DetectIndentation, IndentationToSpacesAction, IndentationToTabsAction } from 'vs/editor/contrib/indentation/common/indentation';
|
||||
import { TrimTrailingWhitespaceAction } from 'vs/editor/contrib/linesOperations/linesOperations';
|
||||
import { IndentUsingSpaces, IndentUsingTabs, DetectIndentation, IndentationToSpacesAction, IndentationToTabsAction } from 'vs/editor/contrib/indentation/indentation';
|
||||
import { BaseBinaryResourceEditor } from 'vs/workbench/browser/parts/editor/binaryEditor';
|
||||
import { BinaryResourceDiffEditor } from 'vs/workbench/browser/parts/editor/binaryDiffEditor';
|
||||
import { IEditor as IBaseEditor, IEditorInput } from 'vs/platform/editor/common/editor';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IQuickOpenService, IPickOpenEntry, IFilePickOpenEntry } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import { SUPPORTED_ENCODINGS, IFileService, IFilesConfiguration, FILES_ASSOCIATIONS_CONFIG } from 'vs/platform/files/common/files';
|
||||
import { SUPPORTED_ENCODINGS, IFileService, FILES_ASSOCIATIONS_CONFIG } from 'vs/platform/files/common/files';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
@@ -43,7 +43,7 @@ import { TabFocus } from 'vs/editor/common/config/commonEditorConfig';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { getCodeEditor as getEditorWidget, getCodeOrDiffEditor } from 'vs/editor/common/services/codeEditorService';
|
||||
import { getCodeEditor as getEditorWidget, getCodeOrDiffEditor } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
|
||||
import { IConfigurationChangedEvent, IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
@@ -55,12 +55,13 @@ import { widgetShadow, editorWidgetBackground } from 'vs/platform/theme/common/c
|
||||
// TODO@Sandeep layer breaker
|
||||
// tslint:disable-next-line:import-patterns
|
||||
import { IPreferencesService } from 'vs/workbench/parts/preferences/common/preferences';
|
||||
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration'
|
||||
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { deepClone } from 'vs/base/common/objects';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
import { QueryEditorService } from 'sql/parts/query/services/queryEditorService';
|
||||
|
||||
|
||||
function toEditorWithEncodingSupport(input: IEditorInput): IEncodingSupport {
|
||||
if (input instanceof SideBySideEditorInput) {
|
||||
input = input.master;
|
||||
@@ -580,7 +581,7 @@ export class EditorStatus implements IStatusbarItem {
|
||||
}
|
||||
}
|
||||
|
||||
private onModeChange(editorWidget: ICommonCodeEditor): void {
|
||||
private onModeChange(editorWidget: ICodeEditor): void {
|
||||
let info: StateDelta = { mode: null };
|
||||
|
||||
// We only support text based editors
|
||||
@@ -596,7 +597,7 @@ export class EditorStatus implements IStatusbarItem {
|
||||
this.updateState(info);
|
||||
}
|
||||
|
||||
private onIndentationChange(editorWidget: ICommonCodeEditor): void {
|
||||
private onIndentationChange(editorWidget: ICodeEditor): void {
|
||||
const update: StateDelta = { indentation: null };
|
||||
|
||||
if (editorWidget) {
|
||||
@@ -626,14 +627,14 @@ export class EditorStatus implements IStatusbarItem {
|
||||
|
||||
private _promptedScreenReader: boolean = false;
|
||||
|
||||
private onScreenReaderModeChange(editorWidget: ICommonCodeEditor): void {
|
||||
private onScreenReaderModeChange(editorWidget: ICodeEditor): void {
|
||||
let screenReaderMode = false;
|
||||
|
||||
// We only support text based editors
|
||||
if (editorWidget) {
|
||||
const screenReaderDetected = (browser.getAccessibilitySupport() === AccessibilitySupport.Enabled);
|
||||
if (screenReaderDetected) {
|
||||
const screenReaderConfiguration = this.configurationService.getConfiguration<IEditorOptions>('editor').accessibilitySupport;
|
||||
const screenReaderConfiguration = this.configurationService.getValue<IEditorOptions>('editor').accessibilitySupport;
|
||||
if (screenReaderConfiguration === 'auto') {
|
||||
// show explanation
|
||||
if (!this._promptedScreenReader) {
|
||||
@@ -656,7 +657,7 @@ export class EditorStatus implements IStatusbarItem {
|
||||
this.updateState({ screenReaderMode: screenReaderMode });
|
||||
}
|
||||
|
||||
private onSelectionChange(editorWidget: ICommonCodeEditor): void {
|
||||
private onSelectionChange(editorWidget: ICodeEditor): void {
|
||||
const info: IEditorSelectionStatus = {};
|
||||
|
||||
// We only support text based editors
|
||||
@@ -693,7 +694,7 @@ export class EditorStatus implements IStatusbarItem {
|
||||
this.updateState({ selectionStatus: this.getSelectionLabel(info) });
|
||||
}
|
||||
|
||||
private onEOLChange(editorWidget: ICommonCodeEditor): void {
|
||||
private onEOLChange(editorWidget: ICodeEditor): void {
|
||||
const info: StateDelta = { EOL: null };
|
||||
|
||||
if (editorWidget && !editorWidget.getConfiguration().readOnly) {
|
||||
@@ -753,7 +754,7 @@ export class EditorStatus implements IStatusbarItem {
|
||||
}
|
||||
}
|
||||
|
||||
function isWritableCodeEditor(codeEditor: ICommonCodeEditor): boolean {
|
||||
function isWritableCodeEditor(codeEditor: ICodeEditor): boolean {
|
||||
if (!codeEditor) {
|
||||
return false;
|
||||
}
|
||||
@@ -786,8 +787,8 @@ export class ShowLanguageExtensionsAction extends Action {
|
||||
|
||||
export class ChangeModeAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.editor.changeLanguageMode';
|
||||
public static LABEL = nls.localize('changeMode', "Change Language Mode");
|
||||
public static readonly ID = 'workbench.action.editor.changeLanguageMode';
|
||||
public static readonly LABEL = nls.localize('changeMode', "Change Language Mode");
|
||||
|
||||
constructor(
|
||||
actionId: string,
|
||||
@@ -799,7 +800,6 @@ export class ChangeModeAction extends Action {
|
||||
@IQuickOpenService private quickOpenService: IQuickOpenService,
|
||||
@IPreferencesService private preferencesService: IPreferencesService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@ICommandService private commandService: ICommandService,
|
||||
@IUntitledEditorService private untitledEditorService: IUntitledEditorService
|
||||
) {
|
||||
super(actionId, actionLabel);
|
||||
@@ -990,7 +990,7 @@ export class ChangeModeAction extends Action {
|
||||
}
|
||||
|
||||
// Make sure to write into the value of the target and not the merged value from USER and WORKSPACE config
|
||||
let currentAssociations = (target === ConfigurationTarget.WORKSPACE) ? fileAssociationsConfig.workspace : fileAssociationsConfig.user;
|
||||
let currentAssociations = deepClone((target === ConfigurationTarget.WORKSPACE) ? fileAssociationsConfig.workspace : fileAssociationsConfig.user);
|
||||
if (!currentAssociations) {
|
||||
currentAssociations = Object.create(null);
|
||||
}
|
||||
@@ -1010,8 +1010,8 @@ export interface IChangeEOLEntry extends IPickOpenEntry {
|
||||
|
||||
class ChangeIndentationAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.editor.changeIndentation';
|
||||
public static LABEL = nls.localize('changeIndentation', "Change Indentation");
|
||||
public static readonly ID = 'workbench.action.editor.changeIndentation';
|
||||
public static readonly LABEL = nls.localize('changeIndentation', "Change Indentation");
|
||||
|
||||
constructor(
|
||||
actionId: string,
|
||||
@@ -1060,8 +1060,8 @@ class ChangeIndentationAction extends Action {
|
||||
|
||||
export class ChangeEOLAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.editor.changeEOL';
|
||||
public static LABEL = nls.localize('changeEndOfLine', "Change End of Line Sequence");
|
||||
public static readonly ID = 'workbench.action.editor.changeEOL';
|
||||
public static readonly LABEL = nls.localize('changeEndOfLine', "Change End of Line Sequence");
|
||||
|
||||
constructor(
|
||||
actionId: string,
|
||||
@@ -1107,8 +1107,8 @@ export class ChangeEOLAction extends Action {
|
||||
|
||||
export class ChangeEncodingAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.editor.changeEncoding';
|
||||
public static LABEL = nls.localize('changeEncoding', "Change File Encoding");
|
||||
public static readonly ID = 'workbench.action.editor.changeEncoding';
|
||||
public static readonly LABEL = nls.localize('changeEncoding', "Change File Encoding");
|
||||
|
||||
constructor(
|
||||
actionId: string,
|
||||
@@ -1170,8 +1170,7 @@ export class ChangeEncodingAction extends Action {
|
||||
.then((guessedEncoding: string) => {
|
||||
const isReopenWithEncoding = (action === reopenWithEncodingPick);
|
||||
|
||||
const config = this.textResourceConfigurationService.getConfiguration(resource) as IFilesConfiguration;
|
||||
const configuredEncoding = config && config.files && config.files.encoding;
|
||||
const configuredEncoding = this.textResourceConfigurationService.getValue(resource, 'files.encoding');
|
||||
|
||||
let directMatchIndex: number;
|
||||
let aliasMatchIndex: number;
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab {
|
||||
display: flex;
|
||||
width: 120px;
|
||||
min-width: fit-content;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
height: 35px;
|
||||
@@ -47,6 +45,35 @@
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.sizing-shrink.has-icon-theme.close-button-right,
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.sizing-shrink.has-icon-theme.close-button-off {
|
||||
padding-left: 5px; /* reduce padding when we show icons and are in shrinking mode and tab close button is not left */
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.sizing-fit {
|
||||
width: 120px;
|
||||
min-width: fit-content;
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.sizing-shrink {
|
||||
min-width: 60px;
|
||||
flex-basis: 0; /* all tabs are even */
|
||||
flex-grow: 1; /* all tabs grow even */
|
||||
max-width: fit-content;
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.sizing-shrink.close-button-left {
|
||||
min-width: 80px; /* make more room for close button when it shows to the left */
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.dragged {
|
||||
will-change: transform; /* forces tab to be drawn on a separate layer (fixes https://github.com/Microsoft/vscode/issues/18733) */
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.dragged-over * {
|
||||
pointer-events: none; /* prevents cursor flickering (fixes https://github.com/Microsoft/vscode/issues/38753) */
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.close-button-left {
|
||||
flex-direction: row-reverse;
|
||||
padding-left: 0;
|
||||
@@ -60,7 +87,8 @@
|
||||
margin-bottom: auto;
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab .monaco-icon-label {
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.sizing-fit .monaco-icon-label,
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.sizing-fit .monaco-icon-label > .monaco-icon-label-description-container {
|
||||
overflow: visible; /* fixes https://github.com/Microsoft/vscode/issues/20182 */
|
||||
}
|
||||
|
||||
@@ -76,6 +104,16 @@
|
||||
width: 28px;
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.close-button-right.sizing-shrink > .tab-close {
|
||||
flex: 0;
|
||||
overflow: hidden; /* let the close button be pushed out of view when sizing is set to shrink to make more room... */
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.dirty.close-button-right.sizing-shrink > .tab-close,
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.close-button-right.sizing-shrink:hover > .tab-close {
|
||||
overflow: visible; /* ...but still show the close button on hover and when dirty */
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.close-button-off > .tab-close {
|
||||
display: none; /* hide the close action bar when we are configured to hide it */
|
||||
}
|
||||
@@ -127,8 +165,7 @@
|
||||
/* No Tab Close Button */
|
||||
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.close-button-off {
|
||||
padding-right: 12px;
|
||||
transition: padding-right ease-in-out 100ms;
|
||||
padding-right: 10px; /* give a little bit more room if close button is off */
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.close-button-off.dirty {
|
||||
|
||||
@@ -18,7 +18,6 @@ import { EventType as TouchEventType, GestureEvent, Gesture } from 'vs/base/brow
|
||||
export class NoTabsTitleControl extends TitleControl {
|
||||
private titleContainer: HTMLElement;
|
||||
private editorLabel: ResourceLabel;
|
||||
private titleTouchSupport: Gesture;
|
||||
|
||||
public setContext(group: IEditorGroup): void {
|
||||
super.setContext(group);
|
||||
@@ -32,7 +31,7 @@ export class NoTabsTitleControl extends TitleControl {
|
||||
this.titleContainer = parent;
|
||||
|
||||
// Gesture Support
|
||||
this.titleTouchSupport = new Gesture(this.titleContainer);
|
||||
Gesture.addTarget(this.titleContainer);
|
||||
|
||||
// Pin on double click
|
||||
this.toUnbind.push(DOM.addDisposableListener(this.titleContainer, DOM.EventType.DBLCLICK, (e: MouseEvent) => this.onTitleDoubleClick(e)));
|
||||
@@ -91,8 +90,11 @@ export class NoTabsTitleControl extends TitleControl {
|
||||
this.closeEditorAction.run({ group, editor: group.activeEditor }).done(null, errors.onUnexpectedError);
|
||||
}
|
||||
|
||||
// Focus editor group unless click on toolbar
|
||||
else if (this.stacks.groups.length === 1 && !DOM.isAncestor((e.target || e.srcElement) as HTMLElement, this.editorActionsToolbar.getContainer().getHTMLElement())) {
|
||||
// Focus editor group unless:
|
||||
// - click on toolbar: should trigger actions within
|
||||
// - mouse click: do not focus group if there are more than one as it otherwise makes group DND funky
|
||||
// - touch: always focus
|
||||
else if ((this.stacks.groups.length === 1 || !(e instanceof MouseEvent)) && !DOM.isAncestor((e.target || e.srcElement) as HTMLElement, this.editorActionsToolbar.getContainer().getHTMLElement())) {
|
||||
this.editorGroupService.focusGroup(group);
|
||||
}
|
||||
}
|
||||
@@ -159,10 +161,4 @@ export class NoTabsTitleControl extends TitleControl {
|
||||
default: return Verbosity.MEDIUM;
|
||||
}
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
super.dispose();
|
||||
|
||||
this.titleTouchSupport.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
117
src/vs/workbench/browser/parts/editor/rangeDecorations.ts
Normal file
@@ -0,0 +1,117 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { CursorChangeReason, ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
|
||||
import { ModelDecorationOptions } from 'vs/editor/common/model/textModelWithDecorations';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
|
||||
export interface IRangeHighlightDecoration {
|
||||
resource: URI;
|
||||
range: IRange;
|
||||
isWholeLine?: boolean;
|
||||
}
|
||||
|
||||
export class RangeHighlightDecorations implements IDisposable {
|
||||
|
||||
private rangeHighlightDecorationId: string = null;
|
||||
private editor: ICodeEditor = null;
|
||||
private editorDisposables: IDisposable[] = [];
|
||||
|
||||
private _onHighlightRemoved: Emitter<void> = new Emitter<void>();
|
||||
public readonly onHighlghtRemoved: Event<void> = this._onHighlightRemoved.event;
|
||||
|
||||
constructor( @IWorkbenchEditorService private editorService: IWorkbenchEditorService) {
|
||||
}
|
||||
|
||||
public removeHighlightRange() {
|
||||
if (this.editor && this.editor.getModel() && this.rangeHighlightDecorationId) {
|
||||
this.editor.deltaDecorations([this.rangeHighlightDecorationId], []);
|
||||
this._onHighlightRemoved.fire();
|
||||
}
|
||||
this.rangeHighlightDecorationId = null;
|
||||
}
|
||||
|
||||
public highlightRange(range: IRangeHighlightDecoration, editor?: ICodeEditor) {
|
||||
editor = editor ? editor : this.getEditor(range);
|
||||
if (editor) {
|
||||
this.doHighlightRange(editor, range);
|
||||
}
|
||||
}
|
||||
|
||||
private doHighlightRange(editor: ICodeEditor, selectionRange: IRangeHighlightDecoration) {
|
||||
this.removeHighlightRange();
|
||||
editor.changeDecorations((changeAccessor: editorCommon.IModelDecorationsChangeAccessor) => {
|
||||
this.rangeHighlightDecorationId = changeAccessor.addDecoration(selectionRange.range, this.createRangeHighlightDecoration(selectionRange.isWholeLine));
|
||||
});
|
||||
this.setEditor(editor);
|
||||
}
|
||||
|
||||
private getEditor(resourceRange: IRangeHighlightDecoration): ICodeEditor {
|
||||
const activeInput = this.editorService.getActiveEditorInput();
|
||||
const resource = activeInput && activeInput.getResource();
|
||||
if (resource) {
|
||||
if (resource.toString() === resourceRange.resource.toString()) {
|
||||
return <ICodeEditor>this.editorService.getActiveEditor().getControl();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private setEditor(editor: ICodeEditor) {
|
||||
if (this.editor !== editor) {
|
||||
this.disposeEditorListeners();
|
||||
this.editor = editor;
|
||||
this.editorDisposables.push(this.editor.onDidChangeCursorPosition((e: ICursorPositionChangedEvent) => {
|
||||
if (
|
||||
e.reason === CursorChangeReason.NotSet
|
||||
|| e.reason === CursorChangeReason.Explicit
|
||||
|| e.reason === CursorChangeReason.Undo
|
||||
|| e.reason === CursorChangeReason.Redo
|
||||
) {
|
||||
this.removeHighlightRange();
|
||||
}
|
||||
}));
|
||||
this.editorDisposables.push(this.editor.onDidChangeModel(() => { this.removeHighlightRange(); }));
|
||||
this.editorDisposables.push(this.editor.onDidDispose(() => {
|
||||
this.removeHighlightRange();
|
||||
this.editor = null;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private disposeEditorListeners() {
|
||||
this.editorDisposables.forEach(disposable => disposable.dispose());
|
||||
this.editorDisposables = [];
|
||||
}
|
||||
|
||||
private static readonly _WHOLE_LINE_RANGE_HIGHLIGHT = ModelDecorationOptions.register({
|
||||
stickiness: editorCommon.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
||||
className: 'rangeHighlight',
|
||||
isWholeLine: true
|
||||
});
|
||||
|
||||
private static readonly _RANGE_HIGHLIGHT = ModelDecorationOptions.register({
|
||||
stickiness: editorCommon.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
||||
className: 'rangeHighlight'
|
||||
});
|
||||
|
||||
private createRangeHighlightDecoration(isWholeLine: boolean = true): ModelDecorationOptions {
|
||||
return (isWholeLine ? RangeHighlightDecorations._WHOLE_LINE_RANGE_HIGHLIGHT : RangeHighlightDecorations._RANGE_HIGHLIGHT);
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
if (this.editor && this.editor.getModel()) {
|
||||
this.removeHighlightRange();
|
||||
this.disposeEditorListeners();
|
||||
this.editor = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,16 +36,19 @@ import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { IDisposable, dispose, combinedDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
|
||||
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
|
||||
import { extractResources } from 'vs/base/browser/dnd';
|
||||
import { extractResources } from 'vs/workbench/browser/editor';
|
||||
import { getOrSet } from 'vs/base/common/map';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { IThemeService, registerThemingParticipant, ITheme, ICssStyleCollector, HIGH_CONTRAST } from 'vs/platform/theme/common/themeService';
|
||||
import { IThemeService, registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
|
||||
import { TAB_INACTIVE_BACKGROUND, TAB_ACTIVE_BACKGROUND, TAB_ACTIVE_FOREGROUND, TAB_INACTIVE_FOREGROUND, TAB_BORDER, EDITOR_DRAG_AND_DROP_BACKGROUND, TAB_UNFOCUSED_ACTIVE_FOREGROUND, TAB_UNFOCUSED_INACTIVE_FOREGROUND, TAB_UNFOCUSED_ACTIVE_BORDER, TAB_ACTIVE_BORDER } from 'vs/workbench/common/theme';
|
||||
import { activeContrastBorder, contrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { Dimension } from 'vs/base/browser/builder';
|
||||
import { scheduleAtNextAnimationFrame } from 'vs/base/browser/dom';
|
||||
|
||||
// {{SQL CARBON EDIT}} -- Display the editor's tab color
|
||||
import { HIGH_CONTRAST } from 'vs/platform/theme/common/themeService';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import * as QueryConstants from 'sql/parts/query/common/constants';
|
||||
@@ -66,11 +69,14 @@ type AugmentedLabel = IEditorInputLabel & { editor: IEditorInput };
|
||||
export class TabsTitleControl extends TitleControl {
|
||||
private titleContainer: HTMLElement;
|
||||
private tabsContainer: HTMLElement;
|
||||
private editorToolbarContainer: HTMLElement;
|
||||
private activeTab: HTMLElement;
|
||||
private editorLabels: ResourceLabel[];
|
||||
private scrollbar: ScrollableElement;
|
||||
private tabDisposeables: IDisposable[];
|
||||
private blockRevealActiveTab: boolean;
|
||||
private dimension: Dimension;
|
||||
private layoutScheduled: IDisposable;
|
||||
|
||||
constructor(
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
@@ -162,11 +168,17 @@ export class TabsTitleControl extends TitleControl {
|
||||
|
||||
const group = this.context;
|
||||
if (group) {
|
||||
TaskUtilities.newQuery(undefined, this.connectionService, this.queryEditorService, this.objectExplorerService, this.workbenchEditorService).then(undefined, errors.onUnexpectedError);
|
||||
this.editorService.openEditor({ options: { pinned: true, index: group.count /* always at the end */ } } as IUntitledResourceInput).done(null, errors.onUnexpectedError); // untitled are always pinned
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
this.toUnbind.push(DOM.addDisposableListener(this.tabsContainer, DOM.EventType.MOUSE_DOWN, (e: MouseEvent) => {
|
||||
if (e.button === 1) {
|
||||
e.preventDefault(); // required to prevent auto-scrolling (https://github.com/Microsoft/vscode/issues/16690)
|
||||
}
|
||||
}));
|
||||
|
||||
// Custom Scrollbar
|
||||
this.scrollbar = new ScrollableElement(this.tabsContainer, {
|
||||
horizontal: ScrollbarVisibility.Auto,
|
||||
@@ -184,10 +196,11 @@ export class TabsTitleControl extends TitleControl {
|
||||
|
||||
// Drag over
|
||||
this.toUnbind.push(DOM.addDisposableListener(this.tabsContainer, DOM.EventType.DRAG_OVER, (e: DragEvent) => {
|
||||
const draggedEditor = TabsTitleControl.getDraggedEditor();
|
||||
|
||||
// update the dropEffect, otherwise it would look like a "move" operation. but only if we are
|
||||
// not dragging a tab actually because there we support both moving as well as copying
|
||||
if (!TabsTitleControl.getDraggedEditor()) {
|
||||
if (!draggedEditor) {
|
||||
e.dataTransfer.dropEffect = 'copy';
|
||||
}
|
||||
|
||||
@@ -195,7 +208,17 @@ export class TabsTitleControl extends TitleControl {
|
||||
|
||||
const target = e.target;
|
||||
if (target instanceof HTMLElement && target.className.indexOf('tabs-container') === 0) {
|
||||
this.updateDropFeedback(this.tabsContainer, true);
|
||||
|
||||
// Find out if the currently dragged editor is the last tab of this group and in that
|
||||
// case we do not want to show any drop feedback because the drop would be a no-op
|
||||
let draggedEditorIsLastTab = false;
|
||||
if (draggedEditor && this.context === draggedEditor.group && this.context.indexOf(draggedEditor.editor) === this.context.count - 1) {
|
||||
draggedEditorIsLastTab = true;
|
||||
}
|
||||
|
||||
if (!draggedEditorIsLastTab) {
|
||||
this.updateDropFeedback(this.tabsContainer, true);
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -228,13 +251,13 @@ export class TabsTitleControl extends TitleControl {
|
||||
}
|
||||
}));
|
||||
|
||||
// Editor Actions Container
|
||||
const editorActionsContainer = document.createElement('div');
|
||||
DOM.addClass(editorActionsContainer, 'editor-actions');
|
||||
this.titleContainer.appendChild(editorActionsContainer);
|
||||
// Editor Toolbar Container
|
||||
this.editorToolbarContainer = document.createElement('div');
|
||||
DOM.addClass(this.editorToolbarContainer, 'editor-actions');
|
||||
this.titleContainer.appendChild(this.editorToolbarContainer);
|
||||
|
||||
// Editor Actions Toolbar
|
||||
this.createEditorActionsToolBar(editorActionsContainer);
|
||||
this.createEditorActionsToolBar(this.editorToolbarContainer);
|
||||
}
|
||||
|
||||
private updateDropFeedback(element: HTMLElement, isDND: boolean, index?: number): void {
|
||||
@@ -296,78 +319,91 @@ export class TabsTitleControl extends TitleControl {
|
||||
|
||||
// Tab label and styles
|
||||
editorsOfGroup.forEach((editor, index) => {
|
||||
const tabContainer = this.tabsContainer.children[index];
|
||||
if (tabContainer instanceof HTMLElement) {
|
||||
const isPinned = group.isPinned(index);
|
||||
const isTabActive = group.isActive(editor);
|
||||
const isDirty = editor.isDirty();
|
||||
const tabContainer = this.tabsContainer.children[index] as HTMLElement;
|
||||
if (!tabContainer) {
|
||||
return; // could be a race condition between updating tabs and creating tabs
|
||||
}
|
||||
|
||||
const label = labels[index];
|
||||
const name = label.name;
|
||||
const description = label.description || '';
|
||||
const title = label.title || '';
|
||||
const isPinned = group.isPinned(index);
|
||||
const isTabActive = group.isActive(editor);
|
||||
const isDirty = editor.isDirty();
|
||||
|
||||
// Container
|
||||
tabContainer.setAttribute('aria-label', `${name}, tab`);
|
||||
tabContainer.title = title;
|
||||
tabContainer.style.borderLeftColor = (index !== 0) ? (this.getColor(TAB_BORDER) || this.getColor(contrastBorder)) : null;
|
||||
tabContainer.style.borderRightColor = (index === editorsOfGroup.length - 1) ? (this.getColor(TAB_BORDER) || this.getColor(contrastBorder)) : null;
|
||||
tabContainer.style.outlineColor = this.getColor(activeContrastBorder);
|
||||
const label = labels[index];
|
||||
const name = label.name;
|
||||
const description = label.description || '';
|
||||
const title = label.title || '';
|
||||
|
||||
const tabOptions = this.editorGroupService.getTabOptions();
|
||||
['off', 'left'].forEach(option => {
|
||||
const domAction = tabOptions.tabCloseButton === option ? DOM.addClass : DOM.removeClass;
|
||||
domAction(tabContainer, `close-button-${option}`);
|
||||
});
|
||||
// Container
|
||||
tabContainer.setAttribute('aria-label', `${name}, tab`);
|
||||
tabContainer.title = title;
|
||||
tabContainer.style.borderLeftColor = (index !== 0) ? (this.getColor(TAB_BORDER) || this.getColor(contrastBorder)) : null;
|
||||
tabContainer.style.borderRightColor = (index === editorsOfGroup.length - 1) ? (this.getColor(TAB_BORDER) || this.getColor(contrastBorder)) : null;
|
||||
tabContainer.style.outlineColor = this.getColor(activeContrastBorder);
|
||||
|
||||
// Label
|
||||
const tabLabel = this.editorLabels[index];
|
||||
// {{SQL CARBON EDIT}} -- add title in options passed
|
||||
tabLabel.setLabel({ name, description, resource: toResource(editor, { supportSideBySide: true }) }, { extraClasses: ['tab-label'], italic: !isPinned, title });
|
||||
const tabOptions = this.editorGroupService.getTabOptions();
|
||||
|
||||
// Active state
|
||||
if (isTabActive) {
|
||||
DOM.addClass(tabContainer, 'active');
|
||||
tabContainer.setAttribute('aria-selected', 'true');
|
||||
tabContainer.style.backgroundColor = this.getColor(TAB_ACTIVE_BACKGROUND);
|
||||
tabLabel.element.style.color = this.getColor(isGroupActive ? TAB_ACTIVE_FOREGROUND : TAB_UNFOCUSED_ACTIVE_FOREGROUND);
|
||||
['off', 'left', 'right'].forEach(option => {
|
||||
const domAction = tabOptions.tabCloseButton === option ? DOM.addClass : DOM.removeClass;
|
||||
domAction(tabContainer, `close-button-${option}`);
|
||||
});
|
||||
|
||||
// Use boxShadow for the active tab border because if we also have a editor group header
|
||||
// color, the two colors would collide and the tab border never shows up.
|
||||
// see https://github.com/Microsoft/vscode/issues/33111
|
||||
const activeTabBorderColor = this.getColor(isGroupActive ? TAB_ACTIVE_BORDER : TAB_UNFOCUSED_ACTIVE_BORDER);
|
||||
if (activeTabBorderColor) {
|
||||
tabContainer.style.boxShadow = `${activeTabBorderColor} 0 -1px inset`;
|
||||
} else {
|
||||
tabContainer.style.boxShadow = null;
|
||||
}
|
||||
['fit', 'shrink'].forEach(option => {
|
||||
const domAction = tabOptions.tabSizing === option ? DOM.addClass : DOM.removeClass;
|
||||
domAction(tabContainer, `sizing-${option}`);
|
||||
});
|
||||
|
||||
this.activeTab = tabContainer;
|
||||
if (tabOptions.showIcons && !!tabOptions.iconTheme) {
|
||||
DOM.addClass(tabContainer, 'has-icon-theme');
|
||||
} else {
|
||||
DOM.removeClass(tabContainer, 'has-icon-theme');
|
||||
}
|
||||
|
||||
// Label
|
||||
const tabLabel = this.editorLabels[index];
|
||||
// {{SQL CARBON EDIT}} -- add title in options passed
|
||||
tabLabel.setLabel({ name, description, resource: toResource(editor, { supportSideBySide: true }) }, { extraClasses: ['tab-label'], italic: !isPinned, title });
|
||||
|
||||
// Active state
|
||||
if (isTabActive) {
|
||||
DOM.addClass(tabContainer, 'active');
|
||||
tabContainer.setAttribute('aria-selected', 'true');
|
||||
tabContainer.style.backgroundColor = this.getColor(TAB_ACTIVE_BACKGROUND);
|
||||
tabLabel.element.style.color = this.getColor(isGroupActive ? TAB_ACTIVE_FOREGROUND : TAB_UNFOCUSED_ACTIVE_FOREGROUND);
|
||||
|
||||
// Use boxShadow for the active tab border because if we also have a editor group header
|
||||
// color, the two colors would collide and the tab border never shows up.
|
||||
// see https://github.com/Microsoft/vscode/issues/33111
|
||||
const activeTabBorderColor = this.getColor(isGroupActive ? TAB_ACTIVE_BORDER : TAB_UNFOCUSED_ACTIVE_BORDER);
|
||||
if (activeTabBorderColor) {
|
||||
tabContainer.style.boxShadow = `${activeTabBorderColor} 0 -1px inset`;
|
||||
} else {
|
||||
DOM.removeClass(tabContainer, 'active');
|
||||
tabContainer.setAttribute('aria-selected', 'false');
|
||||
tabContainer.style.backgroundColor = this.getColor(TAB_INACTIVE_BACKGROUND);
|
||||
tabLabel.element.style.color = this.getColor(isGroupActive ? TAB_INACTIVE_FOREGROUND : TAB_UNFOCUSED_INACTIVE_FOREGROUND);
|
||||
tabContainer.style.boxShadow = null;
|
||||
}
|
||||
|
||||
// Dirty State
|
||||
if (isDirty) {
|
||||
DOM.addClass(tabContainer, 'dirty');
|
||||
} else {
|
||||
DOM.removeClass(tabContainer, 'dirty');
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}} -- Display the editor's tab color
|
||||
this.setEditorTabColor(editor, tabContainer, isTabActive);
|
||||
this.activeTab = tabContainer;
|
||||
} else {
|
||||
DOM.removeClass(tabContainer, 'active');
|
||||
tabContainer.setAttribute('aria-selected', 'false');
|
||||
tabContainer.style.backgroundColor = this.getColor(TAB_INACTIVE_BACKGROUND);
|
||||
tabLabel.element.style.color = this.getColor(isGroupActive ? TAB_INACTIVE_FOREGROUND : TAB_UNFOCUSED_INACTIVE_FOREGROUND);
|
||||
tabContainer.style.boxShadow = null;
|
||||
}
|
||||
|
||||
// Dirty State
|
||||
if (isDirty) {
|
||||
DOM.addClass(tabContainer, 'dirty');
|
||||
} else {
|
||||
DOM.removeClass(tabContainer, 'dirty');
|
||||
}
|
||||
// {{SQL CARBON EDIT}} -- Display the editor's tab color
|
||||
this.setEditorTabColor(editor, tabContainer, isTabActive);
|
||||
});
|
||||
|
||||
// Update Editor Actions Toolbar
|
||||
this.updateEditorActionsToolbar();
|
||||
|
||||
// Ensure the active tab is always revealed
|
||||
this.layout();
|
||||
this.layout(this.dimension);
|
||||
}
|
||||
|
||||
private getTabLabels(editors: IEditorInput[]): IEditorInputLabel[] {
|
||||
@@ -536,7 +572,7 @@ export class TabsTitleControl extends TitleControl {
|
||||
DOM.addClass(tabContainer, 'tab');
|
||||
|
||||
// Gesture Support
|
||||
const gestureSupport = new Gesture(tabContainer);
|
||||
Gesture.addTarget(tabContainer);
|
||||
|
||||
// Tab Editor Label
|
||||
const editorLabel = this.instantiationService.createInstance(ResourceLabel, tabContainer, void 0);
|
||||
@@ -553,19 +589,41 @@ export class TabsTitleControl extends TitleControl {
|
||||
// Eventing
|
||||
const disposable = this.hookTabListeners(tabContainer, index);
|
||||
|
||||
this.tabDisposeables.push(combinedDisposable([disposable, bar, editorLabel, gestureSupport]));
|
||||
this.tabDisposeables.push(combinedDisposable([disposable, bar, editorLabel]));
|
||||
|
||||
return tabContainer;
|
||||
}
|
||||
|
||||
public layout(): void {
|
||||
if (!this.activeTab) {
|
||||
public layout(dimension: Dimension): void {
|
||||
if (!this.activeTab || !dimension) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.dimension = dimension;
|
||||
|
||||
// The layout of tabs can be an expensive operation because we access DOM properties
|
||||
// that can result in the browser doing a full page layout to validate them. To buffer
|
||||
// this a little bit we try at least to schedule this work on the next animation frame.
|
||||
if (!this.layoutScheduled) {
|
||||
this.layoutScheduled = scheduleAtNextAnimationFrame(() => {
|
||||
this.doLayout(this.dimension);
|
||||
this.layoutScheduled = void 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private doLayout(dimension: Dimension): void {
|
||||
const visibleContainerWidth = this.tabsContainer.offsetWidth;
|
||||
const totalContainerWidth = this.tabsContainer.scrollWidth;
|
||||
|
||||
let activeTabPosX: number;
|
||||
let activeTabWidth: number;
|
||||
|
||||
if (!this.blockRevealActiveTab) {
|
||||
activeTabPosX = this.activeTab.offsetLeft;
|
||||
activeTabWidth = this.activeTab.offsetWidth;
|
||||
}
|
||||
|
||||
// Update scrollbar
|
||||
this.scrollbar.setScrollDimensions({
|
||||
width: visibleContainerWidth,
|
||||
@@ -579,9 +637,7 @@ export class TabsTitleControl extends TitleControl {
|
||||
}
|
||||
|
||||
// Reveal the active one
|
||||
const containerScrollPosX = this.tabsContainer.scrollLeft;
|
||||
const activeTabPosX = this.activeTab.offsetLeft;
|
||||
const activeTabWidth = this.activeTab.offsetWidth;
|
||||
const containerScrollPosX = this.scrollbar.getScrollPosition().scrollLeft;
|
||||
const activeTabFits = activeTabWidth <= visibleContainerWidth;
|
||||
|
||||
// Tab is overflowing to the right: Scroll minimally until the element is fully visible to the right
|
||||
@@ -595,7 +651,7 @@ export class TabsTitleControl extends TitleControl {
|
||||
// Tab is overlflowng to the left or does not fit: Scroll it into view to the left
|
||||
else if (containerScrollPosX > activeTabPosX || !activeTabFits) {
|
||||
this.scrollbar.setScrollPosition({
|
||||
scrollLeft: this.activeTab.offsetLeft
|
||||
scrollLeft: activeTabPosX
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -608,7 +664,7 @@ export class TabsTitleControl extends TitleControl {
|
||||
|
||||
if (e instanceof MouseEvent && e.button !== 0) {
|
||||
if (e.button === 1) {
|
||||
return false; // required due to https://github.com/Microsoft/vscode/issues/16690
|
||||
e.preventDefault(); // required to prevent auto-scrolling (https://github.com/Microsoft/vscode/issues/16690)
|
||||
}
|
||||
|
||||
return void 0; // only for left mouse click
|
||||
@@ -638,7 +694,7 @@ export class TabsTitleControl extends TitleControl {
|
||||
|
||||
// Touch Scroll Support
|
||||
disposables.push(DOM.addDisposableListener(tab, TouchEventType.Change, (e: GestureEvent) => {
|
||||
this.tabsContainer.scrollLeft -= e.translationX;
|
||||
this.scrollbar.setScrollPosition({ scrollLeft: this.scrollbar.getScrollPosition().scrollLeft - e.translationX });
|
||||
}));
|
||||
|
||||
// Close on mouse middle click
|
||||
@@ -743,6 +799,10 @@ export class TabsTitleControl extends TitleControl {
|
||||
e.dataTransfer.setData('DownloadURL', [MIME_BINARY, editor.getName(), resourceStr].join(':')); // enables support to drag a tab as file to desktop
|
||||
}
|
||||
}
|
||||
|
||||
// Fixes https://github.com/Microsoft/vscode/issues/18733
|
||||
DOM.addClass(tab, 'dragged');
|
||||
scheduleAtNextAnimationFrame(() => DOM.removeClass(tab, 'dragged'));
|
||||
}));
|
||||
|
||||
// We need to keep track of DRAG_ENTER and DRAG_LEAVE events because a tab is not just a div without children,
|
||||
@@ -766,6 +826,8 @@ export class TabsTitleControl extends TitleControl {
|
||||
}
|
||||
}
|
||||
|
||||
DOM.addClass(tab, 'dragged-over');
|
||||
|
||||
if (!draggedEditorIsTab) {
|
||||
this.updateDropFeedback(tab, true, index);
|
||||
}
|
||||
@@ -775,6 +837,7 @@ export class TabsTitleControl extends TitleControl {
|
||||
disposables.push(DOM.addDisposableListener(tab, DOM.EventType.DRAG_LEAVE, (e: DragEvent) => {
|
||||
counter--;
|
||||
if (counter === 0) {
|
||||
DOM.removeClass(tab, 'dragged-over');
|
||||
this.updateDropFeedback(tab, false, index);
|
||||
}
|
||||
}));
|
||||
@@ -782,6 +845,7 @@ export class TabsTitleControl extends TitleControl {
|
||||
// Drag end
|
||||
disposables.push(DOM.addDisposableListener(tab, DOM.EventType.DRAG_END, (e: DragEvent) => {
|
||||
counter = 0;
|
||||
DOM.removeClass(tab, 'dragged-over');
|
||||
this.updateDropFeedback(tab, false, index);
|
||||
|
||||
this.onEditorDragEnd();
|
||||
@@ -790,6 +854,7 @@ export class TabsTitleControl extends TitleControl {
|
||||
// Drop
|
||||
disposables.push(DOM.addDisposableListener(tab, DOM.EventType.DROP, (e: DragEvent) => {
|
||||
counter = 0;
|
||||
DOM.removeClass(tab, 'dragged-over');
|
||||
this.updateDropFeedback(tab, false, index);
|
||||
|
||||
const { group, position } = this.toTabContext(index);
|
||||
@@ -895,6 +960,12 @@ export class TabsTitleControl extends TitleControl {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
super.dispose();
|
||||
|
||||
this.layoutScheduled = dispose(this.layoutScheduled);
|
||||
}
|
||||
}
|
||||
|
||||
class TabActionRunner extends ActionRunner {
|
||||
|
||||
@@ -31,7 +31,6 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
|
||||
import { IWorkbenchEditorService, DelegatingWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { IEditorInput } from 'vs/platform/editor/common/editor';
|
||||
import { ScrollType } from 'vs/editor/common/editorCommon';
|
||||
@@ -41,7 +40,7 @@ import { ScrollType } from 'vs/editor/common/editorCommon';
|
||||
*/
|
||||
export class TextDiffEditor extends BaseTextEditor {
|
||||
|
||||
public static ID = TEXT_DIFF_EDITOR_ID;
|
||||
public static readonly ID = TEXT_DIFF_EDITOR_ID;
|
||||
|
||||
private diffNavigator: DiffNavigator;
|
||||
private nextDiffAction: NavigateAction;
|
||||
@@ -55,10 +54,9 @@ export class TextDiffEditor extends BaseTextEditor {
|
||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IEditorGroupService editorGroupService: IEditorGroupService,
|
||||
@IModeService modeService: IModeService,
|
||||
@ITextFileService textFileService: ITextFileService
|
||||
) {
|
||||
super(TextDiffEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, modeService, textFileService, editorGroupService);
|
||||
super(TextDiffEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorGroupService);
|
||||
}
|
||||
|
||||
public getTitle(): string {
|
||||
@@ -122,7 +120,7 @@ export class TextDiffEditor extends BaseTextEditor {
|
||||
textOptions.apply(<IDiffEditor>this.getControl(), ScrollType.Smooth);
|
||||
}
|
||||
|
||||
return TPromise.as<void>(null);
|
||||
return TPromise.wrap<void>(null);
|
||||
}
|
||||
|
||||
// Dispose previous diff navigator
|
||||
@@ -161,7 +159,7 @@ export class TextDiffEditor extends BaseTextEditor {
|
||||
this.diffNavigator = new DiffNavigator(diffEditor, {
|
||||
alwaysRevealFirst
|
||||
});
|
||||
this.diffNavigator.addListener(DiffNavigator.Events.UPDATED, () => {
|
||||
this.diffNavigator.onDidUpdate(() => {
|
||||
this.nextDiffAction.updateEnablement();
|
||||
this.previousDiffAction.updateEnablement();
|
||||
});
|
||||
@@ -343,9 +341,9 @@ class NavigateAction extends Action {
|
||||
}
|
||||
|
||||
class ToggleEditorModeAction extends Action {
|
||||
private static ID = 'toggle.diff.editorMode';
|
||||
private static INLINE_LABEL = nls.localize('inlineDiffLabel', "Switch to Inline View");
|
||||
private static SIDEBYSIDE_LABEL = nls.localize('sideBySideDiffLabel', "Switch to Side by Side View");
|
||||
private static readonly ID = 'toggle.diff.editorMode';
|
||||
private static readonly INLINE_LABEL = nls.localize('inlineDiffLabel', "Switch to Inline View");
|
||||
private static readonly SIDEBYSIDE_LABEL = nls.localize('sideBySideDiffLabel', "Switch to Side by Side View");
|
||||
|
||||
constructor(private editor: TextDiffEditor) {
|
||||
super(ToggleEditorModeAction.ID);
|
||||
@@ -371,4 +369,4 @@ class ToggleEditorModeAction extends Action {
|
||||
|
||||
return control && !control.renderSideBySide;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,28 +16,22 @@ import DOM = require('vs/base/browser/dom');
|
||||
import { CodeEditor } from 'vs/editor/browser/codeEditor';
|
||||
import { EditorInput, EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { IEditorViewState, IEditor, isCommonCodeEditor, isCommonDiffEditor } from 'vs/editor/common/editorCommon';
|
||||
import { IEditorViewState, IEditor } from 'vs/editor/common/editorCommon';
|
||||
import { Position } from 'vs/platform/editor/common/editor';
|
||||
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 { Scope } from 'vs/workbench/common/memento';
|
||||
import { getCodeEditor } from 'vs/editor/common/services/codeEditorService';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { getCodeEditor } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { ITextFileService, SaveReason, AutoSaveMode } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { isDiffEditor, isCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
|
||||
const TEXT_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'textEditorViewState';
|
||||
|
||||
interface ITextEditorViewState {
|
||||
0?: IEditorViewState;
|
||||
1?: IEditorViewState;
|
||||
2?: IEditorViewState;
|
||||
}
|
||||
|
||||
export interface IEditorConfiguration {
|
||||
editor: object;
|
||||
diffEditor: object;
|
||||
@@ -60,13 +54,12 @@ export abstract class BaseTextEditor extends BaseEditor {
|
||||
@IStorageService private storageService: IStorageService,
|
||||
@ITextResourceConfigurationService private _configurationService: ITextResourceConfigurationService,
|
||||
@IThemeService protected themeService: IThemeService,
|
||||
@IModeService private modeService: IModeService,
|
||||
@ITextFileService private _textFileService: ITextFileService,
|
||||
@IEditorGroupService protected editorGroupService: IEditorGroupService
|
||||
) {
|
||||
super(id, telemetryService, themeService);
|
||||
|
||||
this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => this.handleConfigurationChangeEvent(this.configurationService.getConfiguration<IEditorConfiguration>(this.getResource()))));
|
||||
this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => this.handleConfigurationChangeEvent(this.configurationService.getValue<IEditorConfiguration>(this.getResource()))));
|
||||
}
|
||||
|
||||
protected get instantiationService(): IInstantiationService {
|
||||
@@ -99,7 +92,7 @@ export abstract class BaseTextEditor extends BaseEditor {
|
||||
protected computeConfiguration(configuration: IEditorConfiguration): IEditorOptions {
|
||||
|
||||
// Specific editor options always overwrite user configuration
|
||||
const editorConfiguration: IEditorOptions = types.isObject(configuration.editor) ? objects.clone(configuration.editor) : Object.create(null);
|
||||
const editorConfiguration: IEditorOptions = types.isObject(configuration.editor) ? objects.deepClone(configuration.editor) : Object.create(null);
|
||||
objects.assign(editorConfiguration, this.getConfigurationOverrides());
|
||||
|
||||
// ARIA label
|
||||
@@ -134,7 +127,7 @@ export abstract class BaseTextEditor extends BaseEditor {
|
||||
|
||||
// Editor for Text
|
||||
this._editorContainer = parent;
|
||||
this.editorControl = this.createEditorControl(parent, this.computeConfiguration(this.configurationService.getConfiguration<IEditorConfiguration>(this.getResource())));
|
||||
this.editorControl = this.createEditorControl(parent, this.computeConfiguration(this.configurationService.getValue<IEditorConfiguration>(this.getResource())));
|
||||
|
||||
// Model & Language changes
|
||||
const codeEditor = getCodeEditor(this);
|
||||
@@ -144,9 +137,9 @@ export abstract class BaseTextEditor extends BaseEditor {
|
||||
}
|
||||
|
||||
// Application & Editor focus change to respect auto save settings
|
||||
if (isCommonCodeEditor(this.editorControl)) {
|
||||
if (isCodeEditor(this.editorControl)) {
|
||||
this.toUnbind.push(this.editorControl.onDidBlurEditor(() => this.onEditorFocusLost()));
|
||||
} else if (isCommonDiffEditor(this.editorControl)) {
|
||||
} else if (isDiffEditor(this.editorControl)) {
|
||||
this.toUnbind.push(this.editorControl.getOriginalEditor().onDidBlurEditor(() => this.onEditorFocusLost()));
|
||||
this.toUnbind.push(this.editorControl.getModifiedEditor().onDidBlurEditor(() => this.onEditorFocusLost()));
|
||||
}
|
||||
@@ -287,7 +280,7 @@ export abstract class BaseTextEditor extends BaseEditor {
|
||||
return null;
|
||||
}
|
||||
|
||||
private updateEditorConfiguration(configuration = this.configurationService.getConfiguration<IEditorConfiguration>(this.getResource())): void {
|
||||
private updateEditorConfiguration(configuration = this.configurationService.getValue<IEditorConfiguration>(this.getResource())): void {
|
||||
if (!this.editorControl) {
|
||||
return;
|
||||
}
|
||||
@@ -328,7 +321,7 @@ export abstract class BaseTextEditor extends BaseEditor {
|
||||
|
||||
public dispose(): void {
|
||||
this.lastAppliedEditorOptions = void 0;
|
||||
this.editorControl.destroy();
|
||||
this.editorControl.dispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import { ITextResourceConfigurationService } from 'vs/editor/common/services/res
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { once } from 'vs/base/common/event';
|
||||
import { ScrollType } from 'vs/editor/common/editorCommon';
|
||||
@@ -31,7 +30,7 @@ import { ScrollType } from 'vs/editor/common/editorCommon';
|
||||
*/
|
||||
export class TextResourceEditor extends BaseTextEditor {
|
||||
|
||||
public static ID = 'workbench.editors.textResourceEditor';
|
||||
public static readonly ID = 'workbench.editors.textResourceEditor';
|
||||
|
||||
constructor(
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@@ -40,10 +39,9 @@ export class TextResourceEditor extends BaseTextEditor {
|
||||
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IEditorGroupService editorGroupService: IEditorGroupService,
|
||||
@IModeService modeService: IModeService,
|
||||
@ITextFileService textFileService: ITextFileService
|
||||
) {
|
||||
super(TextResourceEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, modeService, textFileService, editorGroupService);
|
||||
super(TextResourceEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorGroupService);
|
||||
}
|
||||
|
||||
public getTitle(): string {
|
||||
@@ -66,7 +64,7 @@ export class TextResourceEditor extends BaseTextEditor {
|
||||
textOptions.apply(this.getControl(), ScrollType.Smooth);
|
||||
}
|
||||
|
||||
return TPromise.as<void>(null);
|
||||
return TPromise.wrap<void>(null);
|
||||
}
|
||||
|
||||
// Remember view settings if input changes
|
||||
|
||||
@@ -9,16 +9,14 @@ import 'vs/css!./media/titlecontrol';
|
||||
import nls = require('vs/nls');
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Scope, IActionBarRegistry, Extensions, prepareActions } from 'vs/workbench/browser/actions';
|
||||
import { IAction, Action } from 'vs/base/common/actions';
|
||||
import { IAction, Action, IRunEvent } from 'vs/base/common/actions';
|
||||
import errors = require('vs/base/common/errors');
|
||||
import DOM = require('vs/base/browser/dom');
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { isCommonCodeEditor, isCommonDiffEditor } from 'vs/editor/common/editorCommon';
|
||||
import arrays = require('vs/base/common/arrays');
|
||||
import { IEditorStacksModel, IEditorGroup, IEditorIdentifier, EditorInput, IStacksModelChangeEvent, toResource } from 'vs/workbench/common/editor';
|
||||
import { EventType as BaseEventType } from 'vs/base/common/events';
|
||||
import { IActionItem, ActionsOrientation, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -39,12 +37,14 @@ import { IMenuService, MenuId, IMenu, ExecuteCommandAction } from 'vs/platform/a
|
||||
import { ResourceContextKey } from 'vs/workbench/common/resources';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { Themable } from 'vs/workbench/common/theme';
|
||||
import { IDraggedResource } from 'vs/base/browser/dnd';
|
||||
import { IDraggedResource } from 'vs/workbench/browser/editor';
|
||||
import { WORKSPACE_EXTENSION, IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { extname } from 'vs/base/common/paths';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { isDiffEditor, isCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { Dimension } from 'vs/base/browser/builder';
|
||||
|
||||
export interface IToolbarActions {
|
||||
primary: IAction[];
|
||||
@@ -61,7 +61,7 @@ export interface ITitleAreaControl {
|
||||
refresh(instant?: boolean): void;
|
||||
update(instant?: boolean): void;
|
||||
updateEditorActionsToolbar(): void;
|
||||
layout(): void;
|
||||
layout(dimension: Dimension): void;
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ export abstract class TitleControl extends Themable implements ITitleAreaControl
|
||||
this.doRefresh();
|
||||
}
|
||||
|
||||
public layout(): void {
|
||||
public layout(dimension: Dimension): void {
|
||||
// Subclasses can opt in to react on layout
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ export abstract class TitleControl extends Themable implements ITitleAreaControl
|
||||
});
|
||||
|
||||
// Action Run Handling
|
||||
this.toUnbind.push(this.editorActionsToolbar.actionRunner.addListener(BaseEventType.RUN, (e: any) => {
|
||||
this.toUnbind.push(this.editorActionsToolbar.actionRunner.onDidRun((e: IRunEvent) => {
|
||||
|
||||
// Check for Error
|
||||
if (e.error && !errors.isPromiseCanceledError(e.error)) {
|
||||
@@ -330,7 +330,7 @@ export abstract class TitleControl extends Themable implements ITitleAreaControl
|
||||
// take this code as sample of how to work with menus
|
||||
this.disposeOnEditorActions = dispose(this.disposeOnEditorActions);
|
||||
const widget = control.getControl();
|
||||
const codeEditor = isCommonCodeEditor(widget) && widget || isCommonDiffEditor(widget) && widget.getModifiedEditor();
|
||||
const codeEditor = isCodeEditor(widget) && widget || isDiffEditor(widget) && widget.getModifiedEditor();
|
||||
const scopedContextKeyService = codeEditor && codeEditor.invokeWithinContext(accessor => accessor.get(IContextKeyService)) || this.contextKeyService;
|
||||
const titleBarMenu = this.menuService.createMenu(MenuId.EditorTitle, scopedContextKeyService);
|
||||
this.disposeOnEditorActions.push(titleBarMenu, titleBarMenu.onDidChange(_ => this.update()));
|
||||
@@ -423,7 +423,17 @@ export abstract class TitleControl extends Themable implements ITitleAreaControl
|
||||
getActions: () => TPromise.as(this.getContextMenuActions(identifier)),
|
||||
getActionsContext: () => identifier,
|
||||
getKeyBinding: (action) => this.getKeybinding(action),
|
||||
onHide: (cancel) => this.resourceContext.set(currentContext) // restore previous context
|
||||
onHide: (cancel) => {
|
||||
|
||||
// restore previous context
|
||||
this.resourceContext.set(currentContext);
|
||||
|
||||
// restore focus to active editor if any
|
||||
const editor = this.editorService.getActiveEditor();
|
||||
if (editor) {
|
||||
editor.focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -560,4 +570,4 @@ export function handleWorkspaceExternalDrop(
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,6 @@ export interface HtmlPreviewEditorViewState {
|
||||
scrollYPercentage: number;
|
||||
}
|
||||
|
||||
interface HtmlPreviewEditorViewStates {
|
||||
0?: HtmlPreviewEditorViewState;
|
||||
1?: HtmlPreviewEditorViewState;
|
||||
2?: HtmlPreviewEditorViewState;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class is only intended to be subclassed and not instantiated.
|
||||
|
||||
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#2d2d30}.icon-vs-out{fill:#2d2d30}.icon-vs-bg{fill:#c5c5c5}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M.379 5.652l2.828-2.828 4.76 4.761 4.826-4.826 2.828 2.828-7.654 7.654L.379 5.652z" id="outline" style="display: none;"/><g id="iconBg"><path class="icon-vs-bg" d="M7.967 11.827L1.793 5.652l1.414-1.414 4.76 4.761 4.826-4.826 1.414 1.414-6.24 6.24z"/></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#2d2d30;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#c5c5c5;}</style></defs><title>CollapseChevronDown_md_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M15.444,6.061,8,13.5.556,6.061,3.03,3.586,8,8.556l4.97-4.97Z" style="display: none;"/><path class="icon-vs-bg" d="M14.03,6.061,8,12.091,1.97,6.061,3.03,5,8,9.97,12.97,5Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 536 B After Width: | Height: | Size: 507 B |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vs-bg{fill:#424242}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M.379 5.652l2.828-2.828 4.76 4.761 4.826-4.826 2.828 2.828-7.654 7.654L.379 5.652z" id="outline" style="display: none;"/><g id="iconBg"><path class="icon-vs-bg" d="M7.967 11.827L1.793 5.652l1.414-1.414 4.76 4.761 4.826-4.826 1.414 1.414-6.24 6.24z"/></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#424242;}</style></defs><title>CollapseChevronDown_md_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M15.444,6.061,8,13.5.556,6.061,3.03,3.586,8,8.556l4.97-4.97Z" style="display: none;"/><path class="icon-vs-bg" d="M14.03,6.061,8,12.091,1.97,6.061,3.03,5,8,9.97,12.97,5Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 536 B After Width: | Height: | Size: 507 B |
@@ -1,36 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
viewBox="0 0 16 16"
|
||||
version="1.1"
|
||||
id="svg3828"
|
||||
sodipodi:docname="left-inverse.svg"
|
||||
inkscape:version="0.92.2 5c3e80d, 2017-08-06">
|
||||
<style
|
||||
id="style3821">.icon-canvas-transparent{opacity:0;fill:#2d2d30}.icon-vs-out{fill:#2d2d30}.icon-vs-bg{fill:#c5c5c5}</style>
|
||||
<path
|
||||
class="icon-canvas-transparent"
|
||||
d="M16 16H0V0h16v16z"
|
||||
id="canvas" />
|
||||
<path
|
||||
class="icon-vs-out"
|
||||
d="M.379 5.652l2.828-2.828 4.76 4.761 4.826-4.826 2.828 2.828-7.654 7.654L.379 5.652z"
|
||||
id="outline"
|
||||
style="display: none;" />
|
||||
<g
|
||||
id="iconBg"
|
||||
transform="rotate(90,7.8976546,8.1705758)">
|
||||
<path
|
||||
class="icon-vs-bg"
|
||||
d="M 7.967,11.827 1.793,5.652 3.207,4.238 l 4.76,4.761 4.826,-4.826 1.414,1.414 z"
|
||||
id="path3825"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#c5c5c5" />
|
||||
</g>
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#2d2d30;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#c5c5c5;}</style></defs><title>CollapseChevronLeft_md_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M7.725,8l4.97,4.97L10.22,15.444,2.775,8,10.22.556,12.694,3.03Z" style="display: none;"/><path class="icon-vs-bg" d="M6.311,8l4.97,4.97L10.22,14.03,4.189,8l6.03-6.03L11.28,3.03Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 514 B |
@@ -1,36 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
viewBox="0 0 16 16"
|
||||
version="1.1"
|
||||
id="svg3828"
|
||||
sodipodi:docname="left.svg"
|
||||
inkscape:version="0.92.2 5c3e80d, 2017-08-06">
|
||||
<style
|
||||
id="style3821">.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vs-bg{fill:#424242}</style>
|
||||
<path
|
||||
class="icon-canvas-transparent"
|
||||
d="M16 16H0V0h16v16z"
|
||||
id="canvas" />
|
||||
<path
|
||||
class="icon-vs-out"
|
||||
d="M.379 5.652l2.828-2.828 4.76 4.761 4.826-4.826 2.828 2.828-7.654 7.654L.379 5.652z"
|
||||
id="outline"
|
||||
style="display: none;" />
|
||||
<g
|
||||
id="iconBg"
|
||||
transform="rotate(90,7.8976546,8.1705758)">
|
||||
<path
|
||||
class="icon-vs-bg"
|
||||
d="M 7.967,11.827 1.793,5.652 3.207,4.238 l 4.76,4.761 4.826,-4.826 1.414,1.414 z"
|
||||
id="path3825"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#424242" />
|
||||
</g>
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#424242;}</style></defs><title>CollapseChevronLeft_md_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M7.725,8l4.97,4.97L10.22,15.444,2.775,8,10.22.556,12.694,3.03Z" style="display: none;"/><path class="icon-vs-bg" d="M6.311,8l4.97,4.97L10.22,14.03,4.189,8l6.03-6.03L11.28,3.03Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 514 B |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#2d2d30;}.icon-canvas-transparent{opacity:0;}.icon-vs-fg{fill:#2b282e;}.icon-vs-bg{fill:#c5c5c5;}</style></defs><title>BottomRowOfTwoRows_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M16,0V15H1V0Z" style="display: none;"/><path class="icon-vs-fg" d="M14,2V8H3V2Z" style="display: none;"/><path class="icon-vs-bg" d="M2,1V14H15V1ZM14,8H3V2H14Z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#2d2d30;}.icon-canvas-transparent{opacity:0;}.icon-vs-fg{fill:#2b282e;}.icon-vs-bg{fill:#c5c5c5;}</style></defs><title>DockBottom_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M16,1V15H0V1Z" style="display: none;"/><path class="icon-vs-fg" d="M14,3V9H2V3Z" style="display: none;"/><path class="icon-vs-bg" d="M1,2V14H15V2ZM14,9H2V3H14Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 519 B After Width: | Height: | Size: 511 B |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-fg{fill:#f0eff1;}.icon-vs-bg{fill:#424242;}</style></defs><title>BottomRowOfTwoRows_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M16,0V15H1V0Z" style="display: none;"/><path class="icon-vs-fg" d="M14,2V8H3V2Z" style="display: none;"/><path class="icon-vs-bg" d="M2,1V14H15V1ZM14,8H3V2H14Z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-fg{fill:#f0eff1;}.icon-vs-bg{fill:#424242;}</style></defs><title>DockBottom_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M16,1V15H0V1Z" style="display: none;"/><path class="icon-vs-fg" d="M14,3V9H2V3Z" style="display: none;"/><path class="icon-vs-bg" d="M1,2V14H15V2ZM14,9H2V3H14Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 519 B After Width: | Height: | Size: 511 B |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#2d2d30;}.icon-canvas-transparent{opacity:0;}.icon-vs-fg{fill:#2b282e;}.icon-vs-bg{fill:#c5c5c5;}</style></defs><title>RightColumnOfTwoColumns_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M16,0V15H1V0Z" style="display: none;"/><path class="icon-vs-fg" d="M9,2V13H3V2Z" style="display: none;"/><path class="icon-vs-bg" d="M2,1V14H15V1ZM9,13H3V2H9Z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#2d2d30;}.icon-canvas-transparent{opacity:0;}.icon-vs-fg{fill:#2b282e;}.icon-vs-bg{fill:#c5c5c5;}</style></defs><title>DockRight_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M16,1V15H0V1Z" style="display: none;"/><path class="icon-vs-fg" d="M10,3V13H2V3Z" style="display: none;"/><path class="icon-vs-bg" d="M1,2V14H15V2Zm9,11H2V3h8Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 523 B After Width: | Height: | Size: 510 B |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-fg{fill:#f0eff1;}.icon-vs-bg{fill:#424242;}</style></defs><title>RightColumnOfTwoColumns_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M16,0V15H1V0Z" style="display: none;"/><path class="icon-vs-fg" d="M9,2V13H3V2Z" style="display: none;"/><path class="icon-vs-bg" d="M2,1V14H15V1ZM9,13H3V2H9Z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-fg{fill:#f0eff1;}.icon-vs-bg{fill:#424242;}</style></defs><title>DockRight_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M16,1V15H0V1Z" style="display: none;"/><path class="icon-vs-fg" d="M10,3V13H2V3Z" style="display: none;"/><path class="icon-vs-bg" d="M1,2V14H15V2Zm9,11H2V3h8Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 523 B After Width: | Height: | Size: 510 B |
@@ -31,7 +31,7 @@
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.panel > .composite.title > .title-actions {
|
||||
flex: 0;
|
||||
flex-grow: 0;
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.panel > .title > .title-actions .monaco-action-bar .action-item .action-label {
|
||||
@@ -53,32 +53,34 @@
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.panel > .title > .panel-switcher-container > .monaco-action-bar .action-item:first-child .action-label {
|
||||
.monaco-workbench > .part.panel > .title > .panel-switcher-container > .monaco-action-bar .action-item:first-child {
|
||||
margin-left: 12px;
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.panel > .title > .panel-switcher-container > .monaco-action-bar .action-item .action-label {
|
||||
.monaco-workbench > .part.panel > .title > .panel-switcher-container > .monaco-action-bar .action-item {
|
||||
text-transform: uppercase;
|
||||
margin-left: 16px;
|
||||
margin-right: 16px;
|
||||
padding-left: 16px;
|
||||
padding-right: 16px;
|
||||
font-size: 11px;
|
||||
padding-bottom: 4px; /* puts the bottom border down */
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.panel > .title > .panel-switcher-container > .monaco-action-bar .action-item:last-child {
|
||||
padding-right: 6px;
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.panel > .title > .panel-switcher-container > .monaco-action-bar .action-item.checked .action-label {
|
||||
border-bottom: 1px solid;
|
||||
height: 82%;
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.panel > .title > .panel-switcher-container > .monaco-action-bar .badge .badge-content {
|
||||
top: 8px;
|
||||
right: 0px;
|
||||
position: absolute;
|
||||
font-size: 11px;
|
||||
min-width: 6px;
|
||||
line-height: 18px;
|
||||
padding: 0 5px;
|
||||
border-radius: 20px;
|
||||
padding: 0.2em 0.5em;
|
||||
border-radius: 1em;
|
||||
font-weight: normal;
|
||||
text-align: center;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/** Actions */
|
||||
|
||||
@@ -1,36 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
viewBox="0 0 16 16"
|
||||
version="1.1"
|
||||
id="svg3828"
|
||||
sodipodi:docname="right-inverse.svg"
|
||||
inkscape:version="0.92.2 5c3e80d, 2017-08-06">
|
||||
<style
|
||||
id="style3821">.icon-canvas-transparent{opacity:0;fill:#2d2d30}.icon-vs-out{fill:#2d2d30}.icon-vs-bg{fill:#c5c5c5}</style>
|
||||
<path
|
||||
class="icon-canvas-transparent"
|
||||
d="M16 16H0V0h16v16z"
|
||||
id="canvas" />
|
||||
<path
|
||||
class="icon-vs-out"
|
||||
d="M.379 5.652l2.828-2.828 4.76 4.761 4.826-4.826 2.828 2.828-7.654 7.654L.379 5.652z"
|
||||
id="outline"
|
||||
style="display: none;" />
|
||||
<g
|
||||
id="iconBg"
|
||||
transform="rotate(-90,8.1705757,8.1023454)">
|
||||
<path
|
||||
class="icon-vs-bg"
|
||||
d="M 7.967,11.827 1.793,5.652 3.207,4.238 l 4.76,4.761 4.826,-4.826 1.414,1.414 z"
|
||||
id="path3825"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#c5c5c5" />
|
||||
</g>
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#2d2d30;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#c5c5c5;}</style></defs><title>ExpandChevronRight_md_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M13.225,8,5.78,15.444,3.306,12.97,8.275,8,3.306,3.03,5.78.556Z" style="display: none;"/><path class="icon-vs-bg" d="M11.811,8,5.78,14.03,4.72,12.97,9.689,8,4.72,3.03,5.78,1.97Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 513 B |
@@ -1,36 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
viewBox="0 0 16 16"
|
||||
version="1.1"
|
||||
id="svg3828"
|
||||
sodipodi:docname="right.svg"
|
||||
inkscape:version="0.92.2 5c3e80d, 2017-08-06">
|
||||
<style
|
||||
id="style3821">.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vs-bg{fill:#424242}</style>
|
||||
<path
|
||||
class="icon-canvas-transparent"
|
||||
d="M16 16H0V0h16v16z"
|
||||
id="canvas" />
|
||||
<path
|
||||
class="icon-vs-out"
|
||||
d="M.379 5.652l2.828-2.828 4.76 4.761 4.826-4.826 2.828 2.828-7.654 7.654L.379 5.652z"
|
||||
id="outline"
|
||||
style="display: none;" />
|
||||
<g
|
||||
id="iconBg"
|
||||
transform="rotate(-90,8.1705757,8.1023454)">
|
||||
<path
|
||||
class="icon-vs-bg"
|
||||
d="M 7.967,11.827 1.793,5.652 3.207,4.238 l 4.76,4.761 4.826,-4.826 1.414,1.414 z"
|
||||
id="path3825"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#424242" />
|
||||
</g>
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#424242;}</style></defs><title>ExpandChevronRight_md_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M13.225,8,5.78,15.444,3.306,12.97,8.275,8,3.306,3.03,5.78.556Z" style="display: none;"/><path class="icon-vs-bg" d="M11.811,8,5.78,14.03,4.72,12.97,9.689,8,4.72,3.03,5.78,1.97Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 513 B |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#2d2d30}.icon-vs-out{fill:#2d2d30}.icon-vs-bg{fill:#c5c5c5}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M7.967 2.759l7.654 7.654-2.828 2.828-4.826-4.826-4.76 4.761-2.828-2.828 7.588-7.589z" id="outline" style="display: none;"/><g id="iconBg"><path class="icon-vs-bg" d="M14.207 10.413l-1.414 1.414-4.826-4.826-4.76 4.761-1.414-1.414 6.174-6.175 6.24 6.24z"/></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#2d2d30;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#c5c5c5;}</style></defs><title>CollapseChevronUp_md_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M15.444,9.939,12.97,12.414,8,7.444l-4.97,4.97L.556,9.939,8,2.5Z" style="display: none;"/><path class="icon-vs-bg" d="M14.03,9.939,12.97,11,8,6.03,3.03,11,1.97,9.939,8,3.909Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 540 B After Width: | Height: | Size: 509 B |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vs-bg{fill:#424242}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M7.967 2.759l7.654 7.654-2.828 2.828-4.826-4.826-4.76 4.761-2.828-2.828 7.588-7.589z" id="outline" style="display: none;"/><g id="iconBg"><path class="icon-vs-bg" d="M14.207 10.413l-1.414 1.414-4.826-4.826-4.76 4.761-1.414-1.414 6.174-6.175 6.24 6.24z"/></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#424242;}</style></defs><title>CollapseChevronUp_md_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M15.444,9.939,12.97,12.414,8,7.444l-4.97,4.97L.556,9.939,8,2.5Z" style="display: none;"/><path class="icon-vs-bg" d="M14.03,9.939,12.97,11,8,6.03,3.03,11,1.97,9.939,8,3.909Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 540 B After Width: | Height: | Size: 509 B |
@@ -16,7 +16,6 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
|
||||
import { IPartService, Parts, Position } from 'vs/workbench/services/part/common/partService';
|
||||
import { ActivityAction } from 'vs/workbench/browser/parts/compositebar/compositeBarActions';
|
||||
import { IActivity } from 'vs/workbench/common/activity';
|
||||
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
export class ClosePanelAction extends Action {
|
||||
static ID = 'workbench.action.closePanel';
|
||||
@@ -54,8 +53,8 @@ export class TogglePanelAction extends Action {
|
||||
|
||||
class FocusPanelAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.focusPanel';
|
||||
public static LABEL = nls.localize('focusPanel', "Focus into Panel");
|
||||
public static readonly ID = 'workbench.action.focusPanel';
|
||||
public static readonly LABEL = nls.localize('focusPanel', "Focus into Panel");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -84,18 +83,16 @@ class FocusPanelAction extends Action {
|
||||
|
||||
export class TogglePanelPositionAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.togglePanelPosition';
|
||||
public static LABEL = nls.localize('toggledPanelPosition', "Toggle Panel Position");
|
||||
private static MOVE_TO_RIGHT_LABEL = nls.localize('moveToRight', "Move to Right");
|
||||
private static MOVE_TO_BOTTOM_LABEL = nls.localize('moveToBottom', "Move to Bottom");
|
||||
private static panelPositionConfigurationKey = 'workbench.panel.location';
|
||||
public static readonly ID = 'workbench.action.togglePanelPosition';
|
||||
public static readonly LABEL = nls.localize('toggledPanelPosition', "Toggle Panel Position");
|
||||
private static readonly MOVE_TO_RIGHT_LABEL = nls.localize('moveToRight', "Move to Right");
|
||||
private static readonly MOVE_TO_BOTTOM_LABEL = nls.localize('moveToBottom', "Move to Bottom");
|
||||
private toDispose: IDisposable[];
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IPartService private partService: IPartService,
|
||||
@IConfigurationService private configurationService: IConfigurationService
|
||||
|
||||
) {
|
||||
super(id, label, partService.getPanelPosition() === Position.RIGHT ? 'move-panel-to-bottom' : 'move-panel-to-right');
|
||||
@@ -111,9 +108,7 @@ export class TogglePanelPositionAction extends Action {
|
||||
|
||||
public run(): TPromise<any> {
|
||||
const position = this.partService.getPanelPosition();
|
||||
const newPositionValue = (position === Position.BOTTOM) ? 'right' : 'bottom';
|
||||
|
||||
return this.configurationService.updateValue(TogglePanelPositionAction.panelPositionConfigurationKey, newPositionValue, ConfigurationTarget.USER);
|
||||
return this.partService.setPanelPosition(position === Position.BOTTOM ? Position.RIGHT : Position.BOTTOM);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
@@ -124,10 +119,10 @@ export class TogglePanelPositionAction extends Action {
|
||||
|
||||
export class ToggleMaximizedPanelAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.toggleMaximizedPanel';
|
||||
public static LABEL = nls.localize('toggleMaximizedPanel', "Toggle Maximized Panel");
|
||||
private static MAXIMIZE_LABEL = nls.localize('maximizePanel', "Maximize Panel Size");
|
||||
private static RESTORE_LABEL = nls.localize('minimizePanel', "Restore Panel Size");
|
||||
public static readonly ID = 'workbench.action.toggleMaximizedPanel';
|
||||
public static readonly LABEL = nls.localize('toggleMaximizedPanel', "Toggle Maximized Panel");
|
||||
private static readonly MAXIMIZE_LABEL = nls.localize('maximizePanel', "Maximize Panel Size");
|
||||
private static readonly RESTORE_LABEL = nls.localize('minimizePanel', "Restore Panel Size");
|
||||
private toDispose: IDisposable[];
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -34,7 +34,7 @@ import { IBadge } from 'vs/workbench/services/activity/common/activity';
|
||||
|
||||
export class PanelPart extends CompositePart<Panel> implements IPanelService {
|
||||
|
||||
public static activePanelSettingsKey = 'workbench.panelpart.activepanelid';
|
||||
public static readonly activePanelSettingsKey = 'workbench.panelpart.activepanelid';
|
||||
private static readonly PINNED_PANELS = 'workbench.panel.pinnedPanels';
|
||||
private static readonly MIN_COMPOSITE_BAR_WIDTH = 50;
|
||||
|
||||
@@ -43,6 +43,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
|
||||
private blockOpeningPanel: boolean;
|
||||
private compositeBar: CompositeBar;
|
||||
private dimension: Dimension;
|
||||
private toolbarWidth = new Map<string, number>();
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -86,7 +87,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
|
||||
getOnCompositeClickAction: (compositeId: string) => this.instantiationService.createInstance(PanelActivityAction, this.getPanel(compositeId)),
|
||||
getDefaultCompositeId: () => Registry.as<PanelRegistry>(PanelExtensions.Panels).getDefaultPanelId(),
|
||||
hidePart: () => this.partService.setPanelHidden(true),
|
||||
overflowActionSize: 28,
|
||||
overflowActionSize: 44,
|
||||
colors: {
|
||||
backgroundColor: PANEL_BACKGROUND,
|
||||
badgeBackground,
|
||||
@@ -138,7 +139,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
|
||||
}
|
||||
|
||||
// First check if panel is hidden and show if so
|
||||
let promise = TPromise.as<any>(null);
|
||||
let promise = TPromise.wrap(null);
|
||||
if (!this.partService.isVisible(Parts.PANEL_PART)) {
|
||||
try {
|
||||
this.blockOpeningPanel = true;
|
||||
@@ -213,6 +214,9 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
|
||||
}
|
||||
|
||||
public layout(dimension: Dimension): Dimension[] {
|
||||
if (!this.partService.isVisible(Parts.PANEL_PART)) {
|
||||
return [dimension];
|
||||
}
|
||||
|
||||
if (this.partService.getPanelPosition() === Position.RIGHT) {
|
||||
// Take into account the 1px border when layouting
|
||||
@@ -228,15 +232,27 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
|
||||
|
||||
private layoutCompositeBar(): void {
|
||||
if (this.dimension) {
|
||||
let availableWidth = this.dimension.width - 8; // take padding into account
|
||||
let availableWidth = this.dimension.width - 40; // take padding into account
|
||||
if (this.toolBar) {
|
||||
// adjust height for global actions showing
|
||||
availableWidth = Math.max(PanelPart.MIN_COMPOSITE_BAR_WIDTH, availableWidth - this.toolBar.getContainer().getHTMLElement().offsetWidth);
|
||||
availableWidth = Math.max(PanelPart.MIN_COMPOSITE_BAR_WIDTH, availableWidth - this.getToolbarWidth());
|
||||
}
|
||||
this.compositeBar.layout(new Dimension(availableWidth, this.dimension.height));
|
||||
}
|
||||
}
|
||||
|
||||
private getToolbarWidth(): number {
|
||||
const activePanel = this.getActivePanel();
|
||||
if (!activePanel) {
|
||||
return 0;
|
||||
}
|
||||
if (!this.toolbarWidth.has(activePanel.getId())) {
|
||||
this.toolbarWidth.set(activePanel.getId(), this.toolBar.getContainer().getHTMLElement().offsetWidth);
|
||||
}
|
||||
|
||||
return this.toolbarWidth.get(activePanel.getId());
|
||||
}
|
||||
|
||||
public shutdown(): void {
|
||||
// Persist Hidden State
|
||||
this.compositeBar.store();
|
||||
|
||||
@@ -25,7 +25,6 @@ import { QuickOpenEntry, QuickOpenModel, QuickOpenEntryGroup, compareEntries, Qu
|
||||
import { QuickOpenWidget, HideReason } from 'vs/base/parts/quickopen/browser/quickOpenWidget';
|
||||
import { ContributableActionProvider } from 'vs/workbench/browser/actions';
|
||||
import labels = require('vs/base/common/labels');
|
||||
import paths = require('vs/base/common/paths');
|
||||
import { ITextFileService, AutoSaveMode } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IResourceInput, IEditorInput } from 'vs/platform/editor/common/editor';
|
||||
@@ -36,7 +35,6 @@ import { EditorInput, IWorkbenchEditorConfiguration } from 'vs/workbench/common/
|
||||
import { Component } from 'vs/workbench/common/component';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
import { KeyMod } from 'vs/base/common/keyCodes';
|
||||
import { QuickOpenHandler, QuickOpenHandlerDescriptor, IQuickOpenRegistry, Extensions, EditorQuickOpenEntry, CLOSE_ON_FOCUS_LOST_CONFIG } from 'vs/workbench/browser/quickopen';
|
||||
import errors = require('vs/base/common/errors');
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -44,11 +42,9 @@ import { IPickOpenEntry, IFilePickOpenEntry, IInputOptions, IQuickOpenService, I
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IHistoryService } from 'vs/workbench/services/history/common/history';
|
||||
import { IListService } from 'vs/platform/list/browser/listService';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { SIDE_BAR_BACKGROUND, SIDE_BAR_FOREGROUND } from 'vs/workbench/common/theme';
|
||||
import { attachQuickOpenStyler } from 'vs/platform/theme/common/styler';
|
||||
@@ -57,6 +53,8 @@ import { ITree, IActionProvider } from 'vs/base/parts/tree/browser/tree';
|
||||
import { BaseActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { FileKind, IFileService } from 'vs/platform/files/common/files';
|
||||
import { scoreItem, ScorerCache, compareItemsByScore, prepareQuery } from 'vs/base/parts/quickopen/common/quickOpenScorer';
|
||||
import { getBaseLabel } from 'vs/base/common/labels';
|
||||
import { WorkbenchTree, IListService } from 'vs/platform/list/browser/listService';
|
||||
|
||||
const HELP_PREFIX = '?';
|
||||
|
||||
@@ -77,11 +75,11 @@ interface IInternalPickOptions {
|
||||
|
||||
export class QuickOpenController extends Component implements IQuickOpenService {
|
||||
|
||||
private static MAX_SHORT_RESPONSE_TIME = 500;
|
||||
private static readonly MAX_SHORT_RESPONSE_TIME = 500;
|
||||
|
||||
public _serviceBrand: any;
|
||||
|
||||
private static ID = 'workbench.component.quickopen';
|
||||
private static readonly ID = 'workbench.component.quickopen';
|
||||
|
||||
private _onShow: Emitter<void>;
|
||||
private _onHide: Emitter<void>;
|
||||
@@ -98,7 +96,6 @@ export class QuickOpenController extends Component implements IQuickOpenService
|
||||
private promisesToCompleteOnHide: ValueCallback[];
|
||||
private previousActiveHandlerDescriptor: QuickOpenHandlerDescriptor;
|
||||
private actionProvider = new ContributableActionProvider();
|
||||
private previousValue = '';
|
||||
private visibilityChangeTimeoutHandle: number;
|
||||
private closeOnFocusLost: boolean;
|
||||
private editorHistoryHandler: EditorHistoryHandler;
|
||||
@@ -106,11 +103,8 @@ export class QuickOpenController extends Component implements IQuickOpenService
|
||||
constructor(
|
||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
||||
@IMessageService private messageService: IMessageService,
|
||||
@ITelemetryService private telemetryService: ITelemetryService,
|
||||
@IWorkspaceContextService private contextService: IWorkspaceContextService,
|
||||
@IContextKeyService private contextKeyService: IContextKeyService,
|
||||
@IConfigurationService private configurationService: IConfigurationService,
|
||||
@IHistoryService private historyService: IHistoryService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@IPartService private partService: IPartService,
|
||||
@IListService private listService: IListService,
|
||||
@@ -316,14 +310,13 @@ export class QuickOpenController extends Component implements IQuickOpenService
|
||||
onHide: (reason) => this.handleOnHide(true, reason)
|
||||
}, {
|
||||
inputPlaceHolder: options.placeHolder || '',
|
||||
keyboardSupport: false
|
||||
},
|
||||
this.telemetryService
|
||||
keyboardSupport: false,
|
||||
treeCreator: (container, config, opts) => new WorkbenchTree(container, config, opts, this.contextKeyService, this.listService, this.themeService)
|
||||
}
|
||||
);
|
||||
this.toUnbind.push(attachQuickOpenStyler(this.pickOpenWidget, this.themeService, { background: SIDE_BAR_BACKGROUND, foreground: SIDE_BAR_FOREGROUND }));
|
||||
|
||||
const pickOpenContainer = this.pickOpenWidget.create();
|
||||
this.toUnbind.push(this.listService.register(this.pickOpenWidget.getTree()));
|
||||
DOM.addClass(pickOpenContainer, 'show-file-icons');
|
||||
this.positionQuickOpenWidget();
|
||||
}
|
||||
@@ -551,8 +544,6 @@ export class QuickOpenController extends Component implements IQuickOpenService
|
||||
let inputSelection = options ? options.inputSelection : void 0;
|
||||
let autoFocus = options ? options.autoFocus : void 0;
|
||||
|
||||
this.previousValue = prefix;
|
||||
|
||||
const promiseCompletedOnHide = new TPromise<void>(c => {
|
||||
this.promisesToCompleteOnHide.push(c);
|
||||
});
|
||||
@@ -561,14 +552,6 @@ export class QuickOpenController extends Component implements IQuickOpenService
|
||||
const registry = Registry.as<IQuickOpenRegistry>(Extensions.Quickopen);
|
||||
const handlerDescriptor = registry.getQuickOpenHandler(prefix) || registry.getDefaultQuickOpenHandler();
|
||||
|
||||
/* __GDPR__
|
||||
"quickOpenWidgetShown" : {
|
||||
"mode" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"quickNavigate": { "${inline}": [ "${IQuickNavigateConfiguration}" ] }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('quickOpenWidgetShown', { mode: handlerDescriptor.getId(), quickNavigate: quickNavigateConfiguration });
|
||||
|
||||
// Trigger onOpen
|
||||
this.resolveHandler(handlerDescriptor).done(null, errors.onUnexpectedError);
|
||||
|
||||
@@ -585,14 +568,13 @@ export class QuickOpenController extends Component implements IQuickOpenService
|
||||
onFocusLost: () => !this.closeOnFocusLost
|
||||
}, {
|
||||
inputPlaceHolder: this.hasHandler(HELP_PREFIX) ? nls.localize('quickOpenInput', "Type '?' to get help on the actions you can take from here") : '',
|
||||
keyboardSupport: false
|
||||
},
|
||||
this.telemetryService
|
||||
keyboardSupport: false,
|
||||
treeCreator: (container, config, opts) => new WorkbenchTree(container, config, opts, this.contextKeyService, this.listService, this.themeService)
|
||||
}
|
||||
);
|
||||
this.toUnbind.push(attachQuickOpenStyler(this.quickOpenWidget, this.themeService, { background: SIDE_BAR_BACKGROUND, foreground: SIDE_BAR_FOREGROUND }));
|
||||
|
||||
const quickOpenContainer = this.quickOpenWidget.create();
|
||||
this.toUnbind.push(this.listService.register(this.quickOpenWidget.getTree()));
|
||||
DOM.addClass(quickOpenContainer, 'show-file-icons');
|
||||
this.positionQuickOpenWidget();
|
||||
}
|
||||
@@ -747,7 +729,6 @@ export class QuickOpenController extends Component implements IQuickOpenService
|
||||
}
|
||||
|
||||
private onType(value: string): void {
|
||||
this.previousValue = value;
|
||||
|
||||
// look for a handler
|
||||
const registry = Registry.as<IQuickOpenRegistry>(Extensions.Quickopen);
|
||||
@@ -1176,7 +1157,6 @@ class EditorHistoryHandler {
|
||||
constructor(
|
||||
@IHistoryService private historyService: IHistoryService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@IWorkspaceContextService private contextService: IWorkspaceContextService,
|
||||
@IFileService private fileService: IFileService
|
||||
) {
|
||||
this.scorerCache = Object.create(null);
|
||||
@@ -1265,7 +1245,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
|
||||
@IWorkspaceContextService contextService: IWorkspaceContextService,
|
||||
@IConfigurationService private configurationService: IConfigurationService,
|
||||
@IEnvironmentService environmentService: IEnvironmentService,
|
||||
@IFileService private fileService: IFileService
|
||||
@IFileService fileService: IFileService
|
||||
) {
|
||||
super(editorService);
|
||||
|
||||
@@ -1279,7 +1259,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
|
||||
} else {
|
||||
const resourceInput = input as IResourceInput;
|
||||
this.resource = resourceInput.resource;
|
||||
this.label = paths.basename(resourceInput.resource.fsPath);
|
||||
this.label = getBaseLabel(resourceInput.resource);
|
||||
this.description = labels.getPathLabel(resources.dirname(this.resource), contextService, environmentService);
|
||||
this.dirty = this.resource && this.textFileService.isDirty(this.resource);
|
||||
|
||||
@@ -1321,8 +1301,8 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
|
||||
|
||||
public run(mode: Mode, context: IEntryRunContext): boolean {
|
||||
if (mode === Mode.OPEN) {
|
||||
const sideBySide = !context.quickNavigateConfiguration && context.keymods.indexOf(KeyMod.CtrlCmd) >= 0;
|
||||
const pinned = !this.configurationService.getConfiguration<IWorkbenchEditorConfiguration>().workbench.editor.enablePreviewFromQuickOpen;
|
||||
const sideBySide = !context.quickNavigateConfiguration && context.keymods.ctrlCmd;
|
||||
const pinned = !this.configurationService.getValue<IWorkbenchEditorConfiguration>().workbench.editor.enablePreviewFromQuickOpen || context.keymods.alt;
|
||||
|
||||
if (this.input instanceof EditorInput) {
|
||||
this.editorService.openEditor(this.input, { pinned }, sideBySide).done(null, errors.onUnexpectedError);
|
||||
@@ -1351,8 +1331,8 @@ function resourceForEditorHistory(input: EditorInput, fileService: IFileService)
|
||||
|
||||
export class RemoveFromEditorHistoryAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.removeFromEditorHistory';
|
||||
public static LABEL = nls.localize('removeFromEditorHistory', "Remove From History");
|
||||
public static readonly ID = 'workbench.action.removeFromEditorHistory';
|
||||
public static readonly LABEL = nls.localize('removeFromEditorHistory', "Remove From History");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
|
||||
@@ -75,8 +75,8 @@ export function getQuickNavigateHandler(id: string, next?: boolean): ICommandHan
|
||||
|
||||
export class QuickOpenNavigateNextAction extends BaseQuickOpenNavigateAction {
|
||||
|
||||
public static ID = 'workbench.action.quickOpenNavigateNext';
|
||||
public static LABEL = nls.localize('quickNavigateNext', "Navigate Next in Quick Open");
|
||||
public static readonly ID = 'workbench.action.quickOpenNavigateNext';
|
||||
public static readonly LABEL = nls.localize('quickNavigateNext', "Navigate Next in Quick Open");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -90,8 +90,8 @@ export class QuickOpenNavigateNextAction extends BaseQuickOpenNavigateAction {
|
||||
|
||||
export class QuickOpenNavigatePreviousAction extends BaseQuickOpenNavigateAction {
|
||||
|
||||
public static ID = 'workbench.action.quickOpenNavigatePrevious';
|
||||
public static LABEL = nls.localize('quickNavigatePrevious', "Navigate Previous in Quick Open");
|
||||
public static readonly ID = 'workbench.action.quickOpenNavigatePrevious';
|
||||
public static readonly LABEL = nls.localize('quickNavigatePrevious', "Navigate Previous in Quick Open");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -105,8 +105,8 @@ export class QuickOpenNavigatePreviousAction extends BaseQuickOpenNavigateAction
|
||||
|
||||
export class QuickOpenSelectNextAction extends BaseQuickOpenNavigateAction {
|
||||
|
||||
public static ID = 'workbench.action.quickOpenSelectNext';
|
||||
public static LABEL = nls.localize('quickSelectNext', "Select Next in Quick Open");
|
||||
public static readonly ID = 'workbench.action.quickOpenSelectNext';
|
||||
public static readonly LABEL = nls.localize('quickSelectNext', "Select Next in Quick Open");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -120,8 +120,8 @@ export class QuickOpenSelectNextAction extends BaseQuickOpenNavigateAction {
|
||||
|
||||
export class QuickOpenSelectPreviousAction extends BaseQuickOpenNavigateAction {
|
||||
|
||||
public static ID = 'workbench.action.quickOpenSelectPrevious';
|
||||
public static LABEL = nls.localize('quickSelectPrevious', "Select Previous in Quick Open");
|
||||
public static readonly ID = 'workbench.action.quickOpenSelectPrevious';
|
||||
public static readonly LABEL = nls.localize('quickSelectPrevious', "Select Previous in Quick Open");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
|
||||
@@ -29,10 +29,11 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { SIDE_BAR_TITLE_FOREGROUND, SIDE_BAR_BACKGROUND, SIDE_BAR_FOREGROUND, SIDE_BAR_BORDER } from 'vs/workbench/common/theme';
|
||||
import { ToggleSidebarVisibilityAction } from 'vs/workbench/browser/actions/toggleSidebarVisibility';
|
||||
import { Dimension } from 'vs/base/browser/builder';
|
||||
|
||||
export class SidebarPart extends CompositePart<Viewlet> {
|
||||
|
||||
public static activeViewletSettingsKey = 'workbench.sidebar.activeviewletid';
|
||||
public static readonly activeViewletSettingsKey = 'workbench.sidebar.activeviewletid';
|
||||
|
||||
public _serviceBrand: any;
|
||||
|
||||
@@ -103,7 +104,7 @@ export class SidebarPart extends CompositePart<Viewlet> {
|
||||
}
|
||||
|
||||
// First check if sidebar is hidden and show if so
|
||||
let promise = TPromise.as<void>(null);
|
||||
let promise = TPromise.wrap<void>(null);
|
||||
if (!this.partService.isVisible(Parts.SIDEBAR_PART)) {
|
||||
try {
|
||||
this.blockOpeningViewlet = true;
|
||||
@@ -128,6 +129,14 @@ export class SidebarPart extends CompositePart<Viewlet> {
|
||||
return this.hideActiveComposite().then(composite => void 0);
|
||||
}
|
||||
|
||||
public layout(dimension: Dimension): Dimension[] {
|
||||
if (!this.partService.isVisible(Parts.SIDEBAR_PART)) {
|
||||
return [dimension];
|
||||
}
|
||||
|
||||
return super.layout(dimension);
|
||||
}
|
||||
|
||||
protected getTitleAreaContextMenuActions(): IAction[] {
|
||||
const contextMenuActions = super.getTitleAreaContextMenuActions();
|
||||
if (contextMenuActions.length) {
|
||||
@@ -150,8 +159,8 @@ export class SidebarPart extends CompositePart<Viewlet> {
|
||||
|
||||
class FocusSideBarAction extends Action {
|
||||
|
||||
public static ID = 'workbench.action.focusSideBar';
|
||||
public static LABEL = nls.localize('focusSideBar', "Focus into Side Bar");
|
||||
public static readonly ID = 'workbench.action.focusSideBar';
|
||||
public static readonly LABEL = nls.localize('focusSideBar', "Focus into Side Bar");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
|
||||
@@ -22,7 +22,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { IStatusbarService, IStatusbarEntry } from 'vs/platform/statusbar/common/statusbar';
|
||||
import { getCodeEditor } from 'vs/editor/common/services/codeEditorService';
|
||||
import { getCodeEditor } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IThemeService, registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
|
||||
@@ -36,8 +36,8 @@ export class StatusbarPart extends Part implements IStatusbarService {
|
||||
|
||||
public _serviceBrand: any;
|
||||
|
||||
private static PRIORITY_PROP = 'priority';
|
||||
private static ALIGNMENT_PROP = 'alignment';
|
||||
private static readonly PRIORITY_PROP = 'priority';
|
||||
private static readonly ALIGNMENT_PROP = 'alignment';
|
||||
|
||||
private statusItemsContainer: Builder;
|
||||
private statusMsgDispose: IDisposable;
|
||||
|
||||
@@ -31,18 +31,18 @@ import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/
|
||||
import { Verbosity } from 'vs/platform/editor/common/editor';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { TITLE_BAR_ACTIVE_BACKGROUND, TITLE_BAR_ACTIVE_FOREGROUND, TITLE_BAR_INACTIVE_FOREGROUND, TITLE_BAR_INACTIVE_BACKGROUND, TITLE_BAR_BORDER } from 'vs/workbench/common/theme';
|
||||
import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
import { isMacintosh } from 'vs/base/common/platform';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
|
||||
export class TitlebarPart extends Part implements ITitleService {
|
||||
|
||||
public _serviceBrand: any;
|
||||
|
||||
private static NLS_UNSUPPORTED = nls.localize('patchedWindowTitle', "[Unsupported]");
|
||||
private static NLS_EXTENSION_HOST = nls.localize('devExtensionWindowTitlePrefix', "[Extension Development Host]");
|
||||
private static TITLE_DIRTY = '\u25cf ';
|
||||
private static TITLE_SEPARATOR = isMacintosh ? ' — ' : ' - '; // macOS uses special - separator
|
||||
private static readonly NLS_UNSUPPORTED = nls.localize('patchedWindowTitle', "[Unsupported]");
|
||||
private static readonly NLS_EXTENSION_HOST = nls.localize('devExtensionWindowTitlePrefix', "[Extension Development Host]");
|
||||
private static readonly TITLE_DIRTY = '\u25cf ';
|
||||
private static readonly TITLE_SEPARATOR = isMacintosh ? ' — ' : ' - '; // macOS uses special - separator
|
||||
|
||||
private titleContainer: Builder;
|
||||
private title: Builder;
|
||||
@@ -67,7 +67,7 @@ export class TitlebarPart extends Part implements ITitleService {
|
||||
@IEnvironmentService private environmentService: IEnvironmentService,
|
||||
@IWorkspaceContextService private contextService: IWorkspaceContextService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IPartService private partService: IPartService
|
||||
@ILifecycleService private lifecycleService: ILifecycleService
|
||||
) {
|
||||
super(id, { hasTitle: false }, themeService);
|
||||
|
||||
@@ -82,7 +82,7 @@ export class TitlebarPart extends Part implements ITitleService {
|
||||
private init(): void {
|
||||
|
||||
// Initial window title when loading is done
|
||||
this.partService.joinCreation().done(() => this.setTitle(this.getWindowTitle()));
|
||||
this.lifecycleService.when(LifecyclePhase.Running).then(() => this.setTitle(this.getWindowTitle()));
|
||||
|
||||
// Integrity for window title
|
||||
this.integrityService.isPure().then(r => {
|
||||
@@ -307,9 +307,11 @@ export class TitlebarPart extends Part implements ITitleService {
|
||||
|
||||
const path = segments.slice(0, pathOffset).join(paths.sep);
|
||||
|
||||
let label = paths.basename(path);
|
||||
let label: string;
|
||||
if (!isFile) {
|
||||
label = paths.basename(paths.dirname(path));
|
||||
label = labels.getBaseLabel(paths.dirname(path));
|
||||
} else {
|
||||
label = labels.getBaseLabel(path);
|
||||
}
|
||||
|
||||
actions.push(new ShowItemInFolderAction(path, label || paths.sep, this.windowsService));
|
||||
|
||||
@@ -70,7 +70,7 @@ export abstract class ViewletPanel extends Panel {
|
||||
|
||||
const focusTracker = trackFocus(container);
|
||||
this.disposables.push(focusTracker);
|
||||
this.disposables.push(focusTracker.addFocusListener(() => this._onDidFocus.fire()));
|
||||
this.disposables.push(focusTracker.onDidFocus(() => this._onDidFocus.fire()));
|
||||
}
|
||||
|
||||
protected renderHeader(container: HTMLElement): void {
|
||||
|
||||
@@ -14,34 +14,32 @@ import { IAction, IActionItem, ActionRunner } from 'vs/base/common/actions';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IListService } from 'vs/platform/list/browser/listService';
|
||||
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
|
||||
import { ClickBehavior, DefaultController } from 'vs/base/parts/tree/browser/treeDefaults';
|
||||
import { IMenuService, MenuId, MenuItemAction } from 'vs/platform/actions/common/actions';
|
||||
import { attachListStyler } from 'vs/platform/theme/common/styler';
|
||||
import { IThemeService, LIGHT } from 'vs/platform/theme/common/themeService';
|
||||
import { createActionItem, fillInActions } from 'vs/platform/actions/browser/menuItemActionItem';
|
||||
import { IProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { ITree, IDataSource, IRenderer, ContextMenuEvent } from 'vs/base/parts/tree/browser/tree';
|
||||
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { ViewsRegistry } from 'vs/workbench/browser/parts/views/viewsRegistry';
|
||||
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
|
||||
import { ViewsViewletPanel, IViewletViewOptions, IViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||
import { TreeViewsViewletPanel, IViewletViewOptions, IViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { TreeItemCollapsibleState, ITreeItem, ITreeViewDataProvider, TreeViewItemHandleArg } from 'vs/workbench/common/views';
|
||||
import { WorkbenchTree, IListService } from 'vs/platform/list/browser/listService';
|
||||
|
||||
export class TreeView extends ViewsViewletPanel {
|
||||
export class TreeView extends TreeViewsViewletPanel {
|
||||
|
||||
private menus: Menus;
|
||||
private viewFocusContext: IContextKey<boolean>;
|
||||
private activated: boolean = false;
|
||||
private treeInputPromise: TPromise<void>;
|
||||
|
||||
private dataProviderElementChangeListener: IDisposable;
|
||||
private elementsToRefresh: ITreeItem[] = [];
|
||||
|
||||
constructor(
|
||||
private options: IViewletViewOptions,
|
||||
options: IViewletViewOptions,
|
||||
@IMessageService private messageService: IMessageService,
|
||||
@IKeybindingService keybindingService: IKeybindingService,
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
@@ -54,7 +52,6 @@ export class TreeView extends ViewsViewletPanel {
|
||||
) {
|
||||
super({ ...(options as IViewOptions), ariaHeaderLabel: options.name }, keybindingService, contextMenuService);
|
||||
this.menus = this.instantiationService.createInstance(Menus, this.id);
|
||||
this.viewFocusContext = this.contextKeyService.createKey<boolean>(this.id, void 0);
|
||||
this.menus.onDidChangeTitle(() => this.updateActions(), this, this.disposables);
|
||||
this.themeService.onThemeChange(() => this.tree.refresh() /* soft refresh */, this, this.disposables);
|
||||
if (options.expanded) {
|
||||
@@ -86,21 +83,22 @@ export class TreeView extends ViewsViewletPanel {
|
||||
}
|
||||
}
|
||||
|
||||
public createViewer(container: Builder): ITree {
|
||||
public createViewer(container: Builder): WorkbenchTree {
|
||||
const dataSource = this.instantiationService.createInstance(TreeDataSource, this.id);
|
||||
const renderer = this.instantiationService.createInstance(TreeRenderer);
|
||||
const controller = this.instantiationService.createInstance(TreeController, this.id, this.menus);
|
||||
const tree = new Tree(container.getHTMLElement(), {
|
||||
dataSource,
|
||||
renderer,
|
||||
controller
|
||||
}, {
|
||||
keyboardSupport: false
|
||||
});
|
||||
const tree = new WorkbenchTree(
|
||||
container.getHTMLElement(),
|
||||
{ dataSource, renderer, controller },
|
||||
{ keyboardSupport: false },
|
||||
this.contextKeyService,
|
||||
this.listService,
|
||||
this.themeService
|
||||
);
|
||||
|
||||
tree.contextKeyService.createKey<boolean>(this.id, true);
|
||||
this.disposables.push(tree.onDidChangeSelection(() => this.onSelection()));
|
||||
|
||||
this.disposables.push(attachListStyler(tree, this.themeService));
|
||||
this.disposables.push(this.listService.register(tree, [this.viewFocusContext]));
|
||||
tree.addListener('selection', (event: any) => this.onSelection());
|
||||
return tree;
|
||||
}
|
||||
|
||||
@@ -116,10 +114,6 @@ export class TreeView extends ViewsViewletPanel {
|
||||
return createActionItem(action, this.keybindingService, this.messageService);
|
||||
}
|
||||
|
||||
public setVisible(visible: boolean): TPromise<void> {
|
||||
return super.setVisible(visible);
|
||||
}
|
||||
|
||||
private setInput(): TPromise<void> {
|
||||
if (this.tree) {
|
||||
if (!this.treeInputPromise) {
|
||||
@@ -175,10 +169,29 @@ export class TreeView extends ViewsViewletPanel {
|
||||
}
|
||||
}
|
||||
|
||||
protected updateTreeVisibility(tree: WorkbenchTree, isVisible: boolean): void {
|
||||
super.updateTreeVisibility(tree, isVisible);
|
||||
if (isVisible && this.elementsToRefresh.length) {
|
||||
this.doRefresh(this.elementsToRefresh);
|
||||
this.elementsToRefresh = [];
|
||||
}
|
||||
}
|
||||
|
||||
private refresh(elements: ITreeItem[]): void {
|
||||
elements = elements ? elements : [this.tree.getInput()];
|
||||
if (!elements) {
|
||||
const root: ITreeItem = this.tree.getInput();
|
||||
root.children = null; // reset children
|
||||
elements = [root];
|
||||
}
|
||||
if (this.isVisible() && this.isExpanded()) {
|
||||
this.doRefresh(elements);
|
||||
} else {
|
||||
this.elementsToRefresh.push(...elements);
|
||||
}
|
||||
}
|
||||
|
||||
private doRefresh(elements: ITreeItem[]): void {
|
||||
for (const element of elements) {
|
||||
element.children = null;
|
||||
this.tree.refresh(element);
|
||||
}
|
||||
}
|
||||
@@ -195,7 +208,8 @@ export class TreeView extends ViewsViewletPanel {
|
||||
|
||||
class Root implements ITreeItem {
|
||||
label = 'root';
|
||||
handle = -1;
|
||||
handle = '0';
|
||||
parentHandle = null;
|
||||
collapsibleState = TreeItemCollapsibleState.Expanded;
|
||||
}
|
||||
|
||||
@@ -208,7 +222,7 @@ class TreeDataSource implements IDataSource {
|
||||
}
|
||||
|
||||
public getId(tree: ITree, node: ITreeItem): string {
|
||||
return '' + node.handle;
|
||||
return node.handle;
|
||||
}
|
||||
|
||||
public hasChildren(tree: ITree, node: ITreeItem): boolean {
|
||||
@@ -255,8 +269,8 @@ interface ITreeExplorerTemplateData {
|
||||
|
||||
class TreeRenderer implements IRenderer {
|
||||
|
||||
private static ITEM_HEIGHT = 22;
|
||||
private static TREE_TEMPLATE_ID = 'treeExplorer';
|
||||
private static readonly ITEM_HEIGHT = 22;
|
||||
private static readonly TREE_TEMPLATE_ID = 'treeExplorer';
|
||||
|
||||
constructor( @IThemeService private themeService: IThemeService) {
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ export class ViewLocation {
|
||||
static readonly Explorer = new ViewLocation('explorer');
|
||||
static readonly Debug = new ViewLocation('debug');
|
||||
static readonly Extensions = new ViewLocation('extensions');
|
||||
static readonly SCM = new ViewLocation('scm');
|
||||
|
||||
constructor(private _id: string) {
|
||||
}
|
||||
@@ -75,7 +74,7 @@ export interface IViewsRegistry {
|
||||
|
||||
}
|
||||
|
||||
export const ViewsRegistry: IViewsRegistry = new class {
|
||||
export const ViewsRegistry: IViewsRegistry = new class implements IViewsRegistry {
|
||||
|
||||
private _onViewsRegistered: Emitter<IViewDescriptor[]> = new Emitter<IViewDescriptor[]>();
|
||||
readonly onViewsRegistered: Event<IViewDescriptor[]> = this._onViewsRegistered.event;
|
||||
@@ -122,7 +121,7 @@ export const ViewsRegistry: IViewsRegistry = new class {
|
||||
this._onViewsDeregistered.fire(viewsToDeregister);
|
||||
}
|
||||
|
||||
registerTreeViewDataProvider<T>(id: string, factory: ITreeViewDataProvider) {
|
||||
registerTreeViewDataProvider(id: string, factory: ITreeViewDataProvider) {
|
||||
if (!this.isDataProviderRegistered(id)) {
|
||||
// TODO: throw error
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import { Scope } from 'vs/workbench/common/memento';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IAction, IActionRunner } from 'vs/base/common/actions';
|
||||
import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { ITree } from 'vs/base/parts/tree/browser/tree';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
import { DelayedDragHandler } from 'vs/base/browser/dnd';
|
||||
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
|
||||
@@ -24,10 +23,11 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IContextKeyService, IContextKeyChangeEvent } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { PanelViewlet, ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet';
|
||||
import { IPanelOptions } from 'vs/base/browser/ui/splitview/panelview';
|
||||
import { WorkbenchTree } from 'vs/platform/list/browser/listService';
|
||||
|
||||
export interface IViewOptions extends IPanelOptions {
|
||||
id: string;
|
||||
@@ -35,21 +35,12 @@ export interface IViewOptions extends IPanelOptions {
|
||||
actionRunner: IActionRunner;
|
||||
}
|
||||
|
||||
export interface IViewConstructorSignature<T extends ViewsViewletPanel> {
|
||||
new(options: IViewOptions, ...services: { _serviceBrand: any; }[]): T;
|
||||
}
|
||||
|
||||
export abstract class ViewsViewletPanel extends ViewletPanel {
|
||||
|
||||
private _isVisible: boolean;
|
||||
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
protected treeContainer: HTMLElement;
|
||||
|
||||
// TODO@sandeep why is tree here? isn't this coming only from TreeView
|
||||
protected tree: ITree;
|
||||
protected isDisposed: boolean;
|
||||
private _isVisible: boolean;
|
||||
private dragHandler: DelayedDragHandler;
|
||||
|
||||
constructor(
|
||||
options: IViewOptions,
|
||||
@@ -63,6 +54,72 @@ export abstract class ViewsViewletPanel extends ViewletPanel {
|
||||
this._expanded = options.expanded;
|
||||
}
|
||||
|
||||
setVisible(visible: boolean): TPromise<void> {
|
||||
if (this._isVisible !== visible) {
|
||||
this._isVisible = visible;
|
||||
}
|
||||
|
||||
return TPromise.wrap(null);
|
||||
}
|
||||
|
||||
isVisible(): boolean {
|
||||
return this._isVisible;
|
||||
}
|
||||
|
||||
getActions(): IAction[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
getSecondaryActions(): IAction[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
getActionItem(action: IAction): IActionItem {
|
||||
return null;
|
||||
}
|
||||
|
||||
getActionsContext(): any {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
getOptimalWidth(): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
create(): TPromise<void> {
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
shutdown(): void {
|
||||
// Subclass to implement
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO@isidor @sandeep remove this class
|
||||
export abstract class TreeViewsViewletPanel extends ViewsViewletPanel {
|
||||
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
protected treeContainer: HTMLElement;
|
||||
|
||||
// TODO@sandeep why is tree here? isn't this coming only from TreeView
|
||||
protected tree: WorkbenchTree;
|
||||
protected isDisposed: boolean;
|
||||
private dragHandler: DelayedDragHandler;
|
||||
|
||||
constructor(
|
||||
options: IViewOptions,
|
||||
protected keybindingService: IKeybindingService,
|
||||
protected contextMenuService: IContextMenuService
|
||||
) {
|
||||
super(options, keybindingService, contextMenuService);
|
||||
|
||||
this.id = options.id;
|
||||
this.name = options.name;
|
||||
this._expanded = options.expanded;
|
||||
}
|
||||
|
||||
setExpanded(expanded: boolean): void {
|
||||
this.updateTreeVisibility(this.tree, expanded);
|
||||
super.setExpanded(expanded);
|
||||
@@ -81,21 +138,17 @@ export abstract class ViewsViewletPanel extends ViewletPanel {
|
||||
return treeContainer;
|
||||
}
|
||||
|
||||
getViewer(): ITree {
|
||||
getViewer(): WorkbenchTree {
|
||||
return this.tree;
|
||||
}
|
||||
|
||||
isVisible(): boolean {
|
||||
return this._isVisible;
|
||||
}
|
||||
|
||||
setVisible(visible: boolean): TPromise<void> {
|
||||
if (this._isVisible !== visible) {
|
||||
this._isVisible = visible;
|
||||
this.updateTreeVisibility(this.tree, visible && this.isExpanded());
|
||||
if (this.isVisible() !== visible) {
|
||||
return super.setVisible(visible)
|
||||
.then(() => this.updateTreeVisibility(this.tree, visible && this.isExpanded()));
|
||||
}
|
||||
|
||||
return TPromise.as(null);
|
||||
return TPromise.wrap(null);
|
||||
}
|
||||
|
||||
focus(): void {
|
||||
@@ -161,7 +214,7 @@ export abstract class ViewsViewletPanel extends ViewletPanel {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
private updateTreeVisibility(tree: ITree, isVisible: boolean): void {
|
||||
protected updateTreeVisibility(tree: WorkbenchTree, isVisible: boolean): void {
|
||||
if (!tree) {
|
||||
return;
|
||||
}
|
||||
@@ -239,10 +292,10 @@ export class ViewsViewlet extends PanelViewlet {
|
||||
this._register(this.onDidSashChange(() => this.updateAllViewsSizes()));
|
||||
this._register(ViewsRegistry.onViewsRegistered(this.onViewsRegistered, this));
|
||||
this._register(ViewsRegistry.onViewsDeregistered(this.onViewsDeregistered, this));
|
||||
this._register(this.contextKeyService.onDidChangeContext(keys => this.onContextChanged(keys)));
|
||||
this._register(this.contextKeyService.onDidChangeContext(this.onContextChanged, this));
|
||||
|
||||
// Update headers after and title contributed views after available, since we read from cache in the beginning to know if the viewlet has single view or not. Ref #29609
|
||||
this.extensionService.onReady().then(() => {
|
||||
this.extensionService.whenInstalledExtensionsRegistered().then(() => {
|
||||
this.areExtensionsReady = true;
|
||||
this.updateHeaders();
|
||||
});
|
||||
@@ -328,20 +381,8 @@ export class ViewsViewlet extends PanelViewlet {
|
||||
return this.updateViews(views);
|
||||
}
|
||||
|
||||
private onContextChanged(keys: string[]): void {
|
||||
if (!keys) {
|
||||
return;
|
||||
}
|
||||
|
||||
let hasToUpdate: boolean = false;
|
||||
for (const key of keys) {
|
||||
if (this.viewsContextKeys.has(key)) {
|
||||
hasToUpdate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasToUpdate) {
|
||||
private onContextChanged(event: IContextKeyChangeEvent): void {
|
||||
if (event.affectsSome(this.viewsContextKeys)) {
|
||||
this.updateViews();
|
||||
}
|
||||
}
|
||||
@@ -378,16 +419,14 @@ export class ViewsViewlet extends PanelViewlet {
|
||||
for (const view of panels) {
|
||||
let viewState = this.viewsStates.get(view.id);
|
||||
if (!viewState || typeof viewState.size === 'undefined' || !view.isExpanded() !== viewState.collapsed) {
|
||||
viewState = this.updateViewStateSize(view);
|
||||
this.viewsStates.set(view.id, viewState);
|
||||
this.updateViewStateSize(view);
|
||||
}
|
||||
}
|
||||
|
||||
if (toRemove.length) {
|
||||
for (const viewDescriptor of toRemove) {
|
||||
let view = this.getView(viewDescriptor.id);
|
||||
const viewState = this.updateViewStateSize(view);
|
||||
this.viewsStates.set(view.id, viewState);
|
||||
this.updateViewStateSize(view);
|
||||
this.removePanel(view);
|
||||
this.viewsViewletPanels.splice(this.viewsViewletPanels.indexOf(view), 1);
|
||||
}
|
||||
@@ -410,7 +449,7 @@ export class ViewsViewlet extends PanelViewlet {
|
||||
this.addPanel(view, size, index);
|
||||
this.viewsViewletPanels.splice(index, 0, view);
|
||||
|
||||
this.viewsStates.set(view.id, this.updateViewStateSize(view));
|
||||
this.updateViewStateSize(view);
|
||||
}
|
||||
|
||||
return TPromise.join(toCreate.map(view => view.create()))
|
||||
@@ -424,8 +463,7 @@ export class ViewsViewlet extends PanelViewlet {
|
||||
|
||||
private updateAllViewsSizes(): void {
|
||||
for (const view of this.viewsViewletPanels) {
|
||||
let viewState = this.updateViewStateSize(view);
|
||||
this.viewsStates.set(view.id, viewState);
|
||||
this.updateViewStateSize(view);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,10 +507,6 @@ export class ViewsViewlet extends PanelViewlet {
|
||||
}
|
||||
}
|
||||
|
||||
protected getDefaultViewSize(): number | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
private isCurrentlyVisible(viewDescriptor: IViewDescriptor): boolean {
|
||||
return !!this.getView(viewDescriptor.id);
|
||||
}
|
||||
@@ -582,10 +616,16 @@ export class ViewsViewlet extends PanelViewlet {
|
||||
return this.viewsViewletPanels.filter(view => view.id === id)[0];
|
||||
}
|
||||
|
||||
private updateViewStateSize(view: ViewsViewletPanel): IViewState {
|
||||
private updateViewStateSize(view: ViewsViewletPanel): void {
|
||||
const currentState = this.viewsStates.get(view.id);
|
||||
if (currentState && !this.didLayout) {
|
||||
// Do not update to new state if the layout has not happened yet
|
||||
return;
|
||||
}
|
||||
|
||||
const newViewState = this.createViewState(view);
|
||||
return currentState ? { ...currentState, collapsed: newViewState.collapsed, size: newViewState.size } : newViewState;
|
||||
const stateToUpdate = currentState ? { ...currentState, collapsed: newViewState.collapsed, size: newViewState.size } : newViewState;
|
||||
this.viewsStates.set(view.id, stateToUpdate);
|
||||
}
|
||||
|
||||
protected createViewState(view: ViewsViewletPanel): IViewState {
|
||||
@@ -650,4 +690,4 @@ export class PersistentViewsViewlet extends ViewsViewlet {
|
||||
const viewsStates = JSON.parse(this.storageService.get(this.viewletStateStorageId, this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY ? StorageScope.WORKSPACE : StorageScope.GLOBAL, '{}'));
|
||||
Object.keys(viewsStates).forEach(id => this.viewsStates.set(id, <IViewState>viewsStates[id]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,8 @@ import types = require('vs/base/common/types');
|
||||
import errors = require('vs/base/common/errors');
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { KeyMod } from 'vs/base/common/keyCodes';
|
||||
import { Mode, IEntryRunContext, IAutoFocus, IModel, IQuickNavigateConfiguration } from 'vs/base/parts/quickopen/common/quickOpen';
|
||||
import { QuickOpenEntry, IHighlight, QuickOpenEntryGroup } from 'vs/base/parts/quickopen/browser/quickOpenModel';
|
||||
import { QuickOpenEntry, QuickOpenEntryGroup } from 'vs/base/parts/quickopen/browser/quickOpenModel';
|
||||
import { EditorOptions, EditorInput } from 'vs/workbench/common/editor';
|
||||
import { IResourceInput, IEditorInput, IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -131,7 +130,6 @@ export class QuickOpenHandlerDescriptor {
|
||||
public prefix: string;
|
||||
public description: string;
|
||||
public contextKey: string;
|
||||
public isDefault: boolean;
|
||||
public helpEntries: QuickOpenHandlerHelpEntry[];
|
||||
public instantProgress: boolean;
|
||||
|
||||
@@ -268,28 +266,30 @@ export class EditorQuickOpenEntry extends QuickOpenEntry implements IEditorQuick
|
||||
const hideWidget = (mode === Mode.OPEN);
|
||||
|
||||
if (mode === Mode.OPEN || mode === Mode.OPEN_IN_BACKGROUND) {
|
||||
let sideBySide = context.keymods.indexOf(KeyMod.CtrlCmd) >= 0;
|
||||
const sideBySide = context.keymods.ctrlCmd;
|
||||
|
||||
let openInBackgroundOptions: IEditorOptions;
|
||||
let openOptions: IEditorOptions;
|
||||
if (mode === Mode.OPEN_IN_BACKGROUND) {
|
||||
openInBackgroundOptions = { pinned: true, preserveFocus: true };
|
||||
openOptions = { pinned: true, preserveFocus: true };
|
||||
} else if (context.keymods.alt) {
|
||||
openOptions = { pinned: true };
|
||||
}
|
||||
|
||||
let input = this.getInput();
|
||||
const input = this.getInput();
|
||||
if (input instanceof EditorInput) {
|
||||
let opts = this.getOptions();
|
||||
if (opts) {
|
||||
opts = objects.mixin(opts, openInBackgroundOptions, true);
|
||||
} else if (openInBackgroundOptions) {
|
||||
opts = EditorOptions.create(openInBackgroundOptions);
|
||||
opts = objects.mixin(opts, openOptions, true);
|
||||
} else if (openOptions) {
|
||||
opts = EditorOptions.create(openOptions);
|
||||
}
|
||||
|
||||
this.editorService.openEditor(input, opts, sideBySide).done(null, errors.onUnexpectedError);
|
||||
} else {
|
||||
const resourceInput = <IResourceInput>input;
|
||||
|
||||
if (openInBackgroundOptions) {
|
||||
resourceInput.options = objects.assign(resourceInput.options || Object.create(null), openInBackgroundOptions);
|
||||
if (openOptions) {
|
||||
resourceInput.options = objects.assign(resourceInput.options || Object.create(null), openOptions);
|
||||
}
|
||||
|
||||
this.editorService.openEditor(resourceInput, sideBySide).done(null, errors.onUnexpectedError);
|
||||
@@ -314,50 +314,6 @@ export class EditorQuickOpenEntryGroup extends QuickOpenEntryGroup implements IE
|
||||
}
|
||||
}
|
||||
|
||||
// Infrastructure for quick open commands
|
||||
|
||||
export interface ICommand {
|
||||
aliases: string[];
|
||||
getResults(input: string): TPromise<QuickOpenEntry[]>;
|
||||
getEmptyLabel(input: string): string;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
class CommandEntry extends QuickOpenEntry {
|
||||
|
||||
constructor(private quickOpenService: IQuickOpenService, private prefix: string, private command: ICommand, highlights: IHighlight[]) {
|
||||
super(highlights);
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
public getIcon(): string {
|
||||
return this.command.icon || null;
|
||||
}
|
||||
|
||||
public getLabel(): string {
|
||||
return this.command.aliases[0];
|
||||
}
|
||||
|
||||
public getAriaLabel(): string {
|
||||
return nls.localize('entryAriaLabel', "{0}, command", this.getLabel());
|
||||
}
|
||||
|
||||
public run(mode: Mode, context: IEntryRunContext): boolean {
|
||||
if (mode === Mode.PREVIEW) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.quickOpenService.show(`${this.prefix} ${this.command.aliases[0]} `);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ICommandQuickOpenHandlerOptions {
|
||||
prefix: string;
|
||||
commands: ICommand[];
|
||||
defaultCommand?: ICommand;
|
||||
}
|
||||
|
||||
export class QuickOpenAction extends Action {
|
||||
private prefix: string;
|
||||
|
||||
|
||||
@@ -6,11 +6,9 @@
|
||||
import nls = require('vs/nls');
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import DOM = require('vs/base/browser/dom');
|
||||
import errors = require('vs/base/common/errors');
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Dimension, Builder } from 'vs/base/browser/builder';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { ITree, IFocusEvent, ISelectionEvent } from 'vs/base/parts/tree/browser/tree';
|
||||
import { ITree } from 'vs/base/parts/tree/browser/tree';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IViewlet } from 'vs/workbench/common/viewlet';
|
||||
@@ -24,122 +22,6 @@ export abstract class Viewlet extends Composite implements IViewlet {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper subtype of viewlet for those that use a tree inside.
|
||||
*/
|
||||
export abstract class ViewerViewlet extends Viewlet {
|
||||
|
||||
protected viewer: ITree;
|
||||
|
||||
private viewerContainer: Builder;
|
||||
private wasLayouted: boolean;
|
||||
|
||||
public create(parent: Builder): TPromise<void> {
|
||||
super.create(parent);
|
||||
|
||||
// Container for Viewer
|
||||
this.viewerContainer = parent.div();
|
||||
|
||||
// Viewer
|
||||
this.viewer = this.createViewer(this.viewerContainer);
|
||||
|
||||
// Eventing
|
||||
this.toUnbind.push(this.viewer.addListener('selection', (e: ISelectionEvent) => this.onSelection(e)));
|
||||
this.toUnbind.push(this.viewer.addListener('focus', (e: IFocusEvent) => this.onFocus(e)));
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an element in the viewer receives selection.
|
||||
*/
|
||||
public abstract onSelection(e: ISelectionEvent): void;
|
||||
|
||||
/**
|
||||
* Called when an element in the viewer receives focus.
|
||||
*/
|
||||
public abstract onFocus(e: IFocusEvent): void;
|
||||
|
||||
/**
|
||||
* Returns true if this viewlet is currently visible and false otherwise.
|
||||
*/
|
||||
public abstract createViewer(viewerContainer: Builder): ITree;
|
||||
|
||||
/**
|
||||
* Returns the viewer that is contained in this viewlet.
|
||||
*/
|
||||
public getViewer(): ITree {
|
||||
return this.viewer;
|
||||
}
|
||||
|
||||
public setVisible(visible: boolean): TPromise<void> {
|
||||
let promise: TPromise<void>;
|
||||
|
||||
if (visible) {
|
||||
promise = super.setVisible(visible);
|
||||
this.getViewer().onVisible();
|
||||
} else {
|
||||
this.getViewer().onHidden();
|
||||
promise = super.setVisible(visible);
|
||||
}
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
public focus(): void {
|
||||
if (!this.viewer) {
|
||||
return; // return early if viewlet has not yet been created
|
||||
}
|
||||
|
||||
// Make sure the current selected element is revealed
|
||||
const selection = this.viewer.getSelection();
|
||||
if (selection.length > 0) {
|
||||
this.reveal(selection[0], 0.5).done(null, errors.onUnexpectedError);
|
||||
}
|
||||
|
||||
// Pass Focus to Viewer
|
||||
this.viewer.DOMFocus();
|
||||
}
|
||||
|
||||
public reveal(element: any, relativeTop?: number): TPromise<void> {
|
||||
if (!this.viewer) {
|
||||
return TPromise.as(null); // return early if viewlet has not yet been created
|
||||
}
|
||||
|
||||
// The viewer cannot properly reveal without being layed out, so force it if not yet done
|
||||
if (!this.wasLayouted) {
|
||||
this.viewer.layout();
|
||||
}
|
||||
|
||||
// Now reveal
|
||||
return this.viewer.reveal(element, relativeTop);
|
||||
}
|
||||
|
||||
public layout(dimension: Dimension): void {
|
||||
if (!this.viewer) {
|
||||
return; // return early if viewlet has not yet been created
|
||||
}
|
||||
|
||||
// Pass on to Viewer
|
||||
this.wasLayouted = true;
|
||||
this.viewer.layout(dimension.height);
|
||||
}
|
||||
|
||||
public getControl(): ITree {
|
||||
return this.viewer;
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
|
||||
// Dispose Viewer
|
||||
if (this.viewer) {
|
||||
this.viewer.dispose();
|
||||
}
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A viewlet descriptor is a leightweight descriptor of a viewlet in the workbench.
|
||||
*/
|
||||
|
||||