Merge from vscode 2a36b7d0d527bf408bae4f96b8386db9d9455113 (#10237)

This commit is contained in:
Anthony Dresser
2020-04-30 23:41:35 -07:00
committed by GitHub
parent d7a425239b
commit cebbd04d10
60 changed files with 361 additions and 240 deletions

View File

@@ -576,6 +576,15 @@ export class CompositeDragAndDropObserver extends Disposable {
private constructor() {
super();
this.transferData = LocalSelectionTransfer.getInstance<DraggedCompositeIdentifier | DraggedViewIdentifier>();
this._register(this._onDragEnd.event(e => {
const id = e.dragAndDropData.getData().id;
const type = e.dragAndDropData.getData().type;
const data = this.readDragData(type);
if (data && data.getData().id === id) {
this.transferData.clearData(type === 'view' ? DraggedViewIdentifier.prototype : DraggedCompositeIdentifier.prototype);
}
}));
}
private readDragData(type: ViewType): CompositeDragAndDropData | undefined {
if (this.transferData.hasData(type === 'view' ? DraggedViewIdentifier.prototype : DraggedCompositeIdentifier.prototype)) {
@@ -658,12 +667,8 @@ export class CompositeDragAndDropObserver extends Disposable {
}));
disposableStore.add(new DragAndDropObserver(element, {
onDragEnd: e => {
const { id, type } = draggedItemProvider();
const { type } = draggedItemProvider();
const data = this.readDragData(type);
if (data && data.getData().id === id) {
this.transferData.clearData(type === 'view' ? DraggedViewIdentifier.prototype : DraggedCompositeIdentifier.prototype);
}
if (!data) {
return;

View File

@@ -44,7 +44,7 @@ import { LineNumbersType } from 'vs/editor/common/config/editorOptions';
import { ActivitybarPart } from 'vs/workbench/browser/parts/activitybar/activitybarPart';
import { URI } from 'vs/base/common/uri';
enum Settings {
export enum Settings {
ACTIVITYBAR_VISIBLE = 'workbench.activityBar.visible',
STATUSBAR_VISIBLE = 'workbench.statusBar.visible',
@@ -52,6 +52,7 @@ enum Settings {
PANEL_POSITION = 'workbench.panel.defaultLocation',
ZEN_MODE_RESTORE = 'zenMode.restore',
WORKSPACE_FIRST_OPEN = 'workbench.workspaceFirstOpen'
}
enum Storage {
@@ -547,7 +548,12 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
private applyDefaultLayout(environmentService: IWorkbenchEnvironmentService, storageService: IStorageService) {
const defaultLayout = environmentService.options?.defaultLayout;
if (!defaultLayout || !defaultLayout.firstRun) {
if (!defaultLayout) {
return;
}
const firstOpen = storageService.getBoolean(Settings.WORKSPACE_FIRST_OPEN, StorageScope.WORKSPACE);
if (!firstOpen) {
return;
}
@@ -752,14 +758,25 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
return [];
}
private _openedDefaultEditors: boolean = false;
get openedDefaultEditors() {
return this._openedDefaultEditors;
}
private getInitialFilesToOpen(): { filesToOpenOrCreate?: IPath[], filesToDiff?: IPath[] } | undefined {
const defaultLayout = this.environmentService.options?.defaultLayout;
if (defaultLayout?.firstRun && defaultLayout?.editors?.length) {
//
if (defaultLayout?.editors?.length && this.storageService.getBoolean(Settings.WORKSPACE_FIRST_OPEN, StorageScope.WORKSPACE)) {
this._openedDefaultEditors = true;
return {
filesToOpenOrCreate: defaultLayout.editors
.sort((a, b) => (a.active ? -1 : 1) - (b.active ? -1 : 1))
.map(f => ({ fileUri: URI.file(f.path).with({ scheme: f.scheme }), inactive: !f.active }))
.map<IPath>(f => {
// Support the old path+scheme api until embedders can migrate
if ('path' in f && 'scheme' in f) {
return { fileUri: URI.file((f as any).path).with({ scheme: (f as any).scheme }) };
}
return { fileUri: URI.revive(f.uri), openOnlyIfExists: f.openOnlyIfExists };
})
};
}

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@@ -22,7 +22,7 @@ import { ActivityAction, ActivityActionViewItem, ICompositeBar, ICompositeBarCol
import { ViewletDescriptor } from 'vs/workbench/browser/viewlet';
import { Extensions as ActionExtensions, IWorkbenchActionRegistry } from 'vs/workbench/common/actions';
import { IActivity } from 'vs/workbench/common/activity';
import { ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_ACTIVE_FOCUS_BORDER, ACTIVITY_BAR_ACTIVE_BACKGROUND } from 'vs/workbench/common/theme';
import { ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_ACTIVE_FOCUS_BORDER, ACTIVITY_BAR_ACTIVE_BACKGROUND, ACTIVITY_BAR_BACKGROUND } from 'vs/workbench/common/theme';
import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
@@ -362,35 +362,43 @@ export class HomeAction extends Action {
}
registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) => {
const activityBarBackgroundColor = theme.getColor(ACTIVITY_BAR_BACKGROUND);
if (activityBarBackgroundColor) {
collector.addRule(`
.monaco-workbench .activitybar > .content > .home-bar > .home-bar-icon-badge {
background-color: ${activityBarBackgroundColor};
}
`);
}
const activeForegroundColor = theme.getColor(ACTIVITY_BAR_FOREGROUND);
if (activeForegroundColor) {
const activityBarForegroundColor = theme.getColor(ACTIVITY_BAR_FOREGROUND);
if (activityBarForegroundColor) {
collector.addRule(`
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.active .action-label:not(.codicon),
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:focus .action-label:not(.codicon),
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:hover .action-label:not(.codicon) {
background-color: ${activeForegroundColor} !important;
background-color: ${activityBarForegroundColor} !important;
}
.monaco-workbench .activitybar > .content .home-bar > .monaco-action-bar .action-item .action-label.codicon,
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.active .action-label.codicon,
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:focus .action-label.codicon,
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:hover .action-label.codicon {
color: ${activeForegroundColor} !important;
color: ${activityBarForegroundColor} !important;
}
`);
}
const activeBorderColor = theme.getColor(ACTIVITY_BAR_ACTIVE_BORDER);
if (activeBorderColor) {
const activityBarActiveBorderColor = theme.getColor(ACTIVITY_BAR_ACTIVE_BORDER);
if (activityBarActiveBorderColor) {
collector.addRule(`
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked .active-item-indicator:before {
border-left-color: ${activeBorderColor};
border-left-color: ${activityBarActiveBorderColor};
}
`);
}
const activeFocusBorderColor = theme.getColor(ACTIVITY_BAR_ACTIVE_FOCUS_BORDER);
if (activeFocusBorderColor) {
const activityBarActiveFocusBorderColor = theme.getColor(ACTIVITY_BAR_ACTIVE_FOCUS_BORDER);
if (activityBarActiveFocusBorderColor) {
collector.addRule(`
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked:focus::before {
visibility: hidden;
@@ -398,17 +406,17 @@ registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) =
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked:focus .active-item-indicator:before {
visibility: visible;
border-left-color: ${activeFocusBorderColor};
border-left-color: ${activityBarActiveFocusBorderColor};
}
`);
}
const activeBackgroundColor = theme.getColor(ACTIVITY_BAR_ACTIVE_BACKGROUND);
if (activeBackgroundColor) {
const activityBarActiveBackgroundColor = theme.getColor(ACTIVITY_BAR_ACTIVE_BACKGROUND);
if (activityBarActiveBackgroundColor) {
collector.addRule(`
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked .active-item-indicator {
z-index: 0;
background-color: ${activeBackgroundColor};
background-color: ${activityBarActiveBackgroundColor};
}
`);
}

View File

@@ -366,6 +366,10 @@ export class ActivitybarPart extends Part implements IActivityBarService {
animated: false
}));
const homeBarIconBadge = document.createElement('div');
addClass(homeBarIconBadge, 'home-bar-icon-badge');
this.homeBarContainer.appendChild(homeBarIconBadge);
this.homeBar.push(this._register(this.instantiationService.createInstance(HomeAction, command, title, icon)), { icon: true, label: false });
const content = assertIsDefined(this.content);
@@ -424,7 +428,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
this.globalActivityAction = new ActivityAction({
id: 'workbench.actions.manage',
name: nls.localize('manage', "Manage"),
cssClass: Codicon.gear.classNames
cssClass: Codicon.settingsGear.classNames
});
if (getUserDataSyncStore(this.productService, this.configurationService)) {

View File

@@ -26,6 +26,7 @@
/** Home Bar */
.monaco-workbench .activitybar > .content > .home-bar {
position: relative;
width: 100%;
height: 48px;
display: flex;
@@ -34,6 +35,22 @@
order: -1;
}
.monaco-workbench .activitybar > .content > .home-bar > .home-bar-icon-badge {
position: absolute;
right: 10px;
bottom: 9px;
width: 14px;
height: 14px;
z-index: 1; /* on top of home indicator */
background-image: url('../../../media/code-icon.svg');
background-repeat: no-repeat;
background-position: center center;
background-size: 14px;
pointer-events: none;
border-top: 2px solid transparent;
border-left: 2px solid transparent;
}
/** Viewlet Switcher */
.monaco-workbench .activitybar > .content .monaco-action-bar {

View File

@@ -85,7 +85,7 @@
height: 100%;
position: relative;
z-index: 3000;
background-image: url('code-icon.svg');
background-image: url('../../../media/code-icon.svg');
background-repeat: no-repeat;
background-position: center center;
background-size: 16px;

View File

@@ -38,7 +38,7 @@ import { FileUserDataProvider } from 'vs/workbench/services/userData/common/file
import { BACKUPS } from 'vs/platform/environment/common/environment';
import { joinPath } from 'vs/base/common/resources';
import { BrowserStorageService } from 'vs/platform/storage/browser/storageService';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { getThemeTypeSelector, DARK, HIGH_CONTRAST, LIGHT } from 'vs/platform/theme/common/themeService';
import { registerWindowDriver } from 'vs/platform/driver/browser/driver';
import { BufferLogService } from 'vs/platform/log/common/bufferLog';
@@ -52,6 +52,7 @@ import { coalesce } from 'vs/base/common/arrays';
import { InMemoryFileSystemProvider } from 'vs/platform/files/common/inMemoryFilesystemProvider';
import { WebResourceIdentityService, IResourceIdentityService } from 'vs/platform/resource/common/resourceIdentityService';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { Settings } from 'vs/workbench/browser/layout';
class BrowserMain extends Disposable {
@@ -65,12 +66,12 @@ class BrowserMain extends Disposable {
async open(): Promise<IWorkbench> {
const services = await this.initServices();
// const defaultLayout = this.configuration?.defaultLayout;
// if (defaultLayout) {
// defaultLayout.firstRun = services.storageService.get(firstSessionDateStorageKey, StorageScope.GLOBAL) === undefined;
// }
const firstOpen = services.storageService.getBoolean(Settings.WORKSPACE_FIRST_OPEN, StorageScope.WORKSPACE);
if (firstOpen === undefined || firstOpen) {
services.storageService.store(Settings.WORKSPACE_FIRST_OPEN, !(firstOpen ?? false), StorageScope.WORKSPACE);
}
await domContentLoaded();
{ await domContentLoaded(); }
mark('willStartWorkbench');
// Base Theme

View File

@@ -103,7 +103,7 @@ import { workbenchConfigurationNodeBase } from 'vs/workbench/common/configuratio
},
'workbench.editor.showIcons': {
'type': 'boolean',
'description': nls.localize('showIcons', "Controls whether opened editors should show with an icon or not. This requires an file icon theme to be enabled as well."),
'description': nls.localize('showIcons', "Controls whether opened editors should show with an icon or not. This requires a file icon theme to be enabled as well."),
'default': true
},
'workbench.editor.enablePreview': {