提交 62a1155a 编写于 作者: B Benjamin Pasero

debt - code style 💄

上级 f8432f8d
......@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.quick-input-list .quick-input-list-entry.has-actions:hover .quick-input-list-entry-action-bar .action-label.dirty-workspace::before {
.monaco-workbench .quick-input-list .quick-input-list-entry.has-actions:hover .quick-input-list-entry-action-bar .action-label.dirty-workspace::before {
content: "\ea76"; /* Close icon flips between black dot and "X" for dirty workspaces */
}
......
......@@ -8,7 +8,6 @@
overflow: hidden;
}
.monaco-workbench .part > .drop-block-overlay.visible {
display: block;
backdrop-filter: brightness(97%) blur(2px);
......
......@@ -18,7 +18,9 @@ import { IPaneComposite } from 'vs/workbench/common/panecomposite';
import { IAction, IActionViewItem } from 'vs/base/common/actions';
export class PaneComposite extends Composite implements IPaneComposite {
constructor(id: string,
constructor(
id: string,
protected readonly viewPaneContainer: ViewPaneContainer,
@ITelemetryService
telemetryService: ITelemetryService,
......@@ -33,24 +35,30 @@ export class PaneComposite extends Composite implements IPaneComposite {
@IExtensionService
protected extensionService: IExtensionService,
@IWorkspaceContextService
protected contextService: IWorkspaceContextService) {
protected contextService: IWorkspaceContextService
) {
super(id, telemetryService, themeService, storageService);
this._register(this.viewPaneContainer.onTitleAreaUpdate(() => this.updateTitleArea()));
}
create(parent: HTMLElement): void {
this.viewPaneContainer.create(parent);
}
setVisible(visible: boolean): void {
super.setVisible(visible);
this.viewPaneContainer.setVisible(visible);
}
layout(dimension: Dimension): void {
this.viewPaneContainer.layout(dimension);
}
getOptimalWidth(): number {
return this.viewPaneContainer.getOptimalWidth();
}
openView(id: string, focus?: boolean): IView {
return this.viewPaneContainer.openView(id, focus);
}
......
......@@ -196,8 +196,8 @@ export class GlobalActivityActionViewItem extends ActivityActionViewItem {
colors: (theme: IColorTheme) => ICompositeBarColors,
@IThemeService themeService: IThemeService,
@IMenuService private readonly menuService: IMenuService,
@IContextMenuService protected contextMenuService: IContextMenuService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IContextMenuService protected readonly contextMenuService: IContextMenuService,
@IContextKeyService private readonly contextKeyService: IContextKeyService
) {
super(action, { draggable: false, colors, icon: true }, themeService);
}
......
......@@ -87,18 +87,18 @@ export class ActivitybarPart extends Part implements IActivityBarService {
private globalActivityAction: ActivityAction | undefined;
private globalActivityActionBar: ActionBar | undefined;
private globalActivity: ICompositeActivity[] = [];
private readonly globalActivity: ICompositeActivity[] = [];
private customMenubar: CustomMenubarControl | undefined;
private menubar: HTMLElement | undefined;
private content: HTMLElement | undefined;
private cachedViewlets: ICachedViewlet[] = [];
private readonly cachedViewlets: ICachedViewlet[] = [];
private compositeBar: CompositeBar;
private readonly compositeActions: Map<string, { activityAction: ViewletActivityAction, pinnedAction: ToggleCompositePinnedAction }> = new Map();
private readonly compositeActions = new Map<string, { activityAction: ViewletActivityAction, pinnedAction: ToggleCompositePinnedAction }>();
private readonly viewletDisposables: Map<string, IDisposable> = new Map<string, IDisposable>();
private readonly viewletDisposables = new Map<string, IDisposable>();
constructor(
@IViewletService private readonly viewletService: IViewletService,
......@@ -116,6 +116,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
@IProductService private readonly productService: IProductService
) {
super(Parts.ACTIVITYBAR_PART, { hasTitle: false }, themeService, storageService, layoutService);
storageKeysSyncRegistryService.registerStorageKey({ key: ActivitybarPart.PINNED_VIEWLETS, version: 1 });
this.migrateFromOldCachedViewletsValue();
......
......@@ -41,6 +41,7 @@ export class CompositeDragAndDrop implements ICompositeDragAndDrop {
private openComposite: (id: string, focus?: boolean) => Promise<IPaneComposite | undefined>,
private moveComposite: (from: string, to: string, before?: Before2D) => void,
) { }
drop(data: CompositeDragAndDropData, targetCompositeId: string | undefined, originalEvent: DragEvent, before?: Before2D): void {
const dragData = data.getData();
const viewContainerRegistry = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry);
......@@ -150,6 +151,7 @@ export class CompositeDragAndDrop implements ICompositeDragAndDrop {
}
export interface ICompositeBarOptions {
readonly icon: boolean;
readonly orientation: ActionsOrientation;
readonly colors: (theme: IColorTheme) => ICompositeBarColors;
......@@ -169,6 +171,9 @@ export interface ICompositeBarOptions {
export class CompositeBar extends Widget implements ICompositeBar {
private readonly _onDidChange = this._register(new Emitter<void>());
readonly onDidChange = this._onDidChange.event;
private dimension: Dimension | undefined;
private compositeSwitcherBar: ActionBar | undefined;
......@@ -179,12 +184,9 @@ export class CompositeBar extends Widget implements ICompositeBar {
private visibleComposites: string[];
private compositeSizeInBar: Map<string, number>;
private readonly _onDidChange: Emitter<void> = this._register(new Emitter<void>());
readonly onDidChange = this._onDidChange.event;
constructor(
items: ICompositeBarItem[],
private options: ICompositeBarOptions,
private readonly options: ICompositeBarOptions,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IContextMenuService private readonly contextMenuService: IContextMenuService
) {
......
......@@ -138,7 +138,7 @@ export class ActivityActionViewItem extends BaseActionViewItem {
constructor(
action: ActivityAction,
options: IActivityActionViewItemOptions,
@IThemeService protected themeService: IThemeService
@IThemeService protected readonly themeService: IThemeService
) {
super(null, action, options);
......
......@@ -60,11 +60,11 @@ export abstract class CompositePart<T extends Composite> extends Part {
protected toolBar: ToolBar | undefined;
protected titleLabelElement: HTMLElement | undefined;
private mapCompositeToCompositeContainer = new Map<string, HTMLElement>();
private mapActionsBindingToComposite = new Map<string, () => void>();
private readonly mapCompositeToCompositeContainer = new Map<string, HTMLElement>();
private readonly mapActionsBindingToComposite = new Map<string, () => void>();
private activeComposite: Composite | undefined;
private lastActiveCompositeId: string;
private instantiatedCompositeItems: Map<string, CompositeItem>;
private readonly instantiatedCompositeItems = new Map<string, CompositeItem>();
private titleLabel: ICompositeTitleLabel | undefined;
private progressBar: ProgressBar | undefined;
private contentAreaSize: Dimension | undefined;
......@@ -72,26 +72,25 @@ export abstract class CompositePart<T extends Composite> extends Part {
private currentCompositeOpenToken: string | undefined;
constructor(
private notificationService: INotificationService,
protected storageService: IStorageService,
private telemetryService: ITelemetryService,
protected contextMenuService: IContextMenuService,
protected layoutService: IWorkbenchLayoutService,
protected keybindingService: IKeybindingService,
protected instantiationService: IInstantiationService,
private readonly notificationService: INotificationService,
protected readonly storageService: IStorageService,
private readonly telemetryService: ITelemetryService,
protected readonly contextMenuService: IContextMenuService,
protected readonly layoutService: IWorkbenchLayoutService,
protected readonly keybindingService: IKeybindingService,
protected readonly instantiationService: IInstantiationService,
themeService: IThemeService,
protected readonly registry: CompositeRegistry<T>,
private activeCompositeSettingsKey: string,
private defaultCompositeId: string,
private nameForTelemetry: string,
private compositeCSSClass: string,
private titleForegroundColor: string | undefined,
private readonly activeCompositeSettingsKey: string,
private readonly defaultCompositeId: string,
private readonly nameForTelemetry: string,
private readonly compositeCSSClass: string,
private readonly titleForegroundColor: string | undefined,
id: string,
options: IPartOptions
) {
super(id, options, themeService, storageService, layoutService);
this.instantiatedCompositeItems = new Map<string, CompositeItem>();
this.lastActiveCompositeId = storageService.get(activeCompositeSettingsKey, StorageScope.WORKSPACE, this.defaultCompositeId);
}
......
......@@ -99,7 +99,6 @@ export class NoTabsTitleControl extends TitleControl {
}
private onTitleClick(e: MouseEvent | GestureEvent): void {
if (e instanceof MouseEvent) {
// Close editor on middle mouse click
if (e.button === 1 /* Middle Button */) {
......
......@@ -85,12 +85,12 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
private panelFocusContextKey: IContextKey<boolean>;
private compositeBar: CompositeBar;
private compositeActions: Map<string, { activityAction: PanelActivityAction, pinnedAction: ToggleCompositePinnedAction; }> = new Map();
private readonly compositeActions = new Map<string, { activityAction: PanelActivityAction, pinnedAction: ToggleCompositePinnedAction; }>();
private readonly panelDisposables: Map<string, IDisposable> = new Map<string, IDisposable>();
private blockOpeningPanel = false;
private _contentDimension: Dimension | undefined;
private contentDimension: Dimension | undefined;
private panelRegistry: PanelRegistry;
......@@ -473,21 +473,21 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
}
if (this.layoutService.getPanelPosition() === Position.RIGHT) {
this._contentDimension = new Dimension(width - 1, height); // Take into account the 1px border when layouting
this.contentDimension = new Dimension(width - 1, height); // Take into account the 1px border when layouting
} else {
this._contentDimension = new Dimension(width, height);
this.contentDimension = new Dimension(width, height);
}
// Layout contents
super.layout(this._contentDimension.width, this._contentDimension.height);
super.layout(this.contentDimension.width, this.contentDimension.height);
// Layout composite bar
this.layoutCompositeBar();
}
private layoutCompositeBar(): void {
if (this._contentDimension && this.dimension) {
let availableWidth = this._contentDimension.width - 40; // take padding into account
if (this.contentDimension && this.dimension) {
let availableWidth = this.contentDimension.width - 40; // take padding into account
if (this.toolBar) {
availableWidth = Math.max(PanelPart.MIN_COMPOSITE_BAR_WIDTH, availableWidth - this.getToolbarWidth()); // adjust height for global actions showing
}
......
......@@ -27,7 +27,7 @@ import { SIDE_BAR_TITLE_FOREGROUND, SIDE_BAR_BACKGROUND, SIDE_BAR_FOREGROUND, SI
import { INotificationService } from 'vs/platform/notification/common/notification';
import { EventType, addDisposableListener, trackFocus } from 'vs/base/browser/dom';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
......@@ -77,9 +77,11 @@ export class SidebarPart extends CompositePart<Viewlet> implements IViewletServi
get onDidViewletOpen(): Event<IViewlet> { return Event.map(this.onDidCompositeOpen.event, compositeEvent => <IViewlet>compositeEvent.composite); }
get onDidViewletClose(): Event<IViewlet> { return this.onDidCompositeClose.event as Event<IViewlet>; }
private viewletRegistry: ViewletRegistry;
private sideBarFocusContextKey: IContextKey<boolean>;
private activeViewletContextKey: IContextKey<string>;
private readonly viewletRegistry = Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets);
private readonly sideBarFocusContextKey = SidebarFocusContext.bindTo(this.contextKeyService);
private readonly activeViewletContextKey = ActiveViewletContext.bindTo(this.contextKeyService);
private blockOpeningViewlet = false;
constructor(
......@@ -91,7 +93,7 @@ export class SidebarPart extends CompositePart<Viewlet> implements IViewletServi
@IKeybindingService keybindingService: IKeybindingService,
@IInstantiationService instantiationService: IInstantiationService,
@IThemeService themeService: IThemeService,
@IContextKeyService contextKeyService: IContextKeyService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IExtensionService private readonly extensionService: IExtensionService
) {
super(
......@@ -113,11 +115,6 @@ export class SidebarPart extends CompositePart<Viewlet> implements IViewletServi
{ hasTitle: true, borderWidth: () => (this.getColor(SIDE_BAR_BORDER) || this.getColor(contrastBorder)) ? 1 : 0 }
);
this.viewletRegistry = Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets);
this.sideBarFocusContextKey = SidebarFocusContext.bindTo(contextKeyService);
this.activeViewletContextKey = ActiveViewletContext.bindTo(contextKeyService);
this.registerListeners();
}
......
......@@ -32,7 +32,7 @@ import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { ToggleStatusbarVisibilityAction } from 'vs/workbench/browser/actions/layoutActions';
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { assertIsDefined } from 'vs/base/common/types';
import { Emitter, Event } from 'vs/base/common/event';
import { Emitter } from 'vs/base/common/event';
import { Command } from 'vs/editor/common/modes';
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
......@@ -65,7 +65,7 @@ class StatusbarViewModel extends Disposable {
private readonly _onDidChangeEntryVisibility = this._register(new Emitter<{ id: string, visible: boolean }>());
readonly onDidChangeEntryVisibility = this._onDidChangeEntryVisibility.event;
constructor(private storageService: IStorageService) {
constructor(private readonly storageService: IStorageService) {
super();
this.restoreState();
......@@ -341,18 +341,18 @@ export class StatusbarPart extends Part implements IStatusbarService {
private pendingEntries: IPendingStatusbarEntry[] = [];
private readonly viewModel: StatusbarViewModel;
private readonly viewModel = this._register(new StatusbarViewModel(this.storageService));
readonly onDidChangeEntryVisibility = this.viewModel.onDidChangeEntryVisibility;
private leftItemsContainer: HTMLElement | undefined;
private rightItemsContainer: HTMLElement | undefined;
readonly onDidChangeEntryVisibility: Event<{ id: string, visible: boolean }>;
constructor(
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IThemeService themeService: IThemeService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IStorageService storageService: IStorageService,
@IStorageService private readonly storageService: IStorageService,
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
@IContextMenuService private contextMenuService: IContextMenuService,
@IStorageKeysSyncRegistryService storageKeysSyncRegistryService: IStorageKeysSyncRegistryService,
......@@ -360,8 +360,6 @@ export class StatusbarPart extends Part implements IStatusbarService {
super(Parts.STATUSBAR_PART, { hasTitle: false }, themeService, storageService, layoutService);
storageKeysSyncRegistryService.registerStorageKey({ key: StatusbarViewModel.HIDDEN_ENTRIES_KEY, version: 1 });
this.viewModel = this._register(new StatusbarViewModel(storageService));
this.onDidChangeEntryVisibility = this.viewModel.onDidChangeEntryVisibility;
this.registerListeners();
}
......@@ -639,6 +637,7 @@ export class StatusbarPart extends Part implements IStatusbarService {
}
class StatusbarEntryItem extends Disposable {
private entry!: IStatusbarEntry;
private labelContainer!: HTMLElement;
......
......@@ -8,6 +8,7 @@ import { IThemeService, Themable } from 'vs/platform/theme/common/themeService';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
export class Component extends Themable {
private readonly memento: Memento;
constructor(
......
......@@ -61,6 +61,7 @@ export class Memento {
}
class ScopedMemento {
private readonly mementoObj: MementoObject;
constructor(private id: string, private scope: StorageScope, private storageService: IStorageService) {
......
......@@ -3,6 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.quick-input-list .quick-input-list-entry.has-actions:hover .quick-input-list-entry-action-bar .action-label.dirty-window::before {
.monaco-workbench .quick-input-list .quick-input-list-entry.has-actions:hover .quick-input-list-entry-action-bar .action-label.dirty-window::before {
content: "\ea76"; /* Close icon flips between black dot and "X" for dirty windows */
}
......@@ -168,12 +168,12 @@ export abstract class BaseSwitchWindow extends Action {
constructor(
id: string,
label: string,
private environmentService: INativeWorkbenchEnvironmentService,
private quickInputService: IQuickInputService,
private keybindingService: IKeybindingService,
private modelService: IModelService,
private modeService: IModeService,
private electronService: IElectronService
private readonly environmentService: INativeWorkbenchEnvironmentService,
private readonly quickInputService: IQuickInputService,
private readonly keybindingService: IKeybindingService,
private readonly modelService: IModelService,
private readonly modeService: IModeService,
private readonly electronService: IElectronService
) {
super(id, label);
}
......
......@@ -53,13 +53,11 @@ import { IResourceIdentityService } from 'vs/platform/resource/common/resourceId
class DesktopMain extends Disposable {
private readonly environmentService: NativeWorkbenchEnvironmentService;
private readonly environmentService = new NativeWorkbenchEnvironmentService(this.configuration, this.configuration.execPath);
constructor(private configuration: INativeWindowConfiguration) {
super();
this.environmentService = new NativeWorkbenchEnvironmentService(configuration, configuration.execPath);
this.init();
}
......
......@@ -77,7 +77,7 @@ export class NativeWindow extends Disposable {
private readonly addFoldersScheduler = this._register(new RunOnceScheduler(() => this.doAddFolders(), 100));
private pendingFoldersToAdd: URI[] = [];
private readonly closeEmptyWindowScheduler: RunOnceScheduler = this._register(new RunOnceScheduler(() => this.onAllEditorsClosed(), 50));
private readonly closeEmptyWindowScheduler = this._register(new RunOnceScheduler(() => this.onAllEditorsClosed(), 50));
private isDocumentedEdited = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册