mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-14 12:08:36 -05:00
Merge from vscode 2f984aad710215f4e4684a035bb02f55d1a9e2cc (#9819)
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./media/screencast';
|
||||
import 'vs/css!./media/actions';
|
||||
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./media/actions';
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
@@ -27,8 +25,8 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
|
||||
import { IViewDescriptorService, IViewContainersRegistry, Extensions as ViewContainerExtensions, IViewsService, FocusedViewContext, ViewContainerLocation, IViewDescriptor } from 'vs/workbench/common/views';
|
||||
import { IQuickInputService, IQuickPickItem, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService';
|
||||
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
|
||||
|
||||
const registry = Registry.as<IWorkbenchActionRegistry>(WorkbenchExtensions.WorkbenchActions);
|
||||
const viewCategory = nls.localize('view', "View");
|
||||
@@ -520,7 +518,7 @@ export class MoveFocusedViewAction extends Action {
|
||||
@IContextKeyService private contextKeyService: IContextKeyService,
|
||||
@INotificationService private notificationService: INotificationService,
|
||||
@IActivityBarService private activityBarService: IActivityBarService,
|
||||
@IViewletService private viewletService: IViewletService
|
||||
@IPanelService private panelService: IPanelService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
@@ -544,36 +542,58 @@ export class MoveFocusedViewAction extends Action {
|
||||
const quickPick = this.quickInputService.createQuickPick();
|
||||
quickPick.placeholder = nls.localize('moveFocusedView.selectDestination', "Select a Destination for the View");
|
||||
|
||||
const items: Array<IQuickPickItem | IQuickPickSeparator> = [];
|
||||
|
||||
items.push({
|
||||
type: 'separator',
|
||||
label: nls.localize('sidebar', "Side Bar")
|
||||
});
|
||||
|
||||
items.push({
|
||||
id: '_.sidebar.newcontainer',
|
||||
label: nls.localize('moveFocusedView.newContainerInSidebar', "New Container in Side Bar")
|
||||
});
|
||||
|
||||
const pinnedViewlets = this.activityBarService.getPinnedViewletIds();
|
||||
const items: Array<IQuickPickItem | IQuickPickSeparator> = this.viewletService.getViewlets()
|
||||
.filter(viewlet => {
|
||||
if (viewlet.id === this.viewDescriptorService.getViewContainer(focusedViewId)!.id) {
|
||||
items.push(...pinnedViewlets
|
||||
.filter(viewletId => {
|
||||
if (viewletId === this.viewDescriptorService.getViewContainer(focusedViewId)!.id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !viewContainerRegistry.get(viewlet.id)!.rejectAddedViews && pinnedViewlets.indexOf(viewlet.id) !== -1;
|
||||
return !viewContainerRegistry.get(viewletId)!.rejectAddedViews;
|
||||
})
|
||||
.map(viewlet => {
|
||||
.map(viewletId => {
|
||||
return {
|
||||
id: viewlet.id,
|
||||
label: viewlet.name,
|
||||
id: viewletId,
|
||||
label: viewContainerRegistry.get(viewletId)!.name
|
||||
};
|
||||
});
|
||||
}));
|
||||
|
||||
if (this.viewDescriptorService.getViewLocation(focusedViewId) !== ViewContainerLocation.Panel) {
|
||||
items.unshift({
|
||||
type: 'separator',
|
||||
label: nls.localize('sidebar', "Side Bar")
|
||||
});
|
||||
items.push({
|
||||
type: 'separator',
|
||||
label: nls.localize('panel', "Panel")
|
||||
});
|
||||
items.push({
|
||||
id: '_.panel.newcontainer',
|
||||
label: nls.localize('moveFocusedView.newContainerInPanel', "New Container in Panel"),
|
||||
});
|
||||
}
|
||||
items.push({
|
||||
type: 'separator',
|
||||
label: nls.localize('panel', "Panel")
|
||||
});
|
||||
items.push({
|
||||
id: '_.panel.newcontainer',
|
||||
label: nls.localize('moveFocusedView.newContainerInPanel', "New Container in Panel"),
|
||||
});
|
||||
|
||||
const pinnedPanels = this.panelService.getPinnedPanels();
|
||||
items.push(...pinnedPanels
|
||||
.filter(panel => {
|
||||
if (panel.id === this.viewDescriptorService.getViewContainer(focusedViewId)!.id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !viewContainerRegistry.get(panel.id)!.rejectAddedViews;
|
||||
})
|
||||
.map(panel => {
|
||||
return {
|
||||
id: panel.id,
|
||||
label: viewContainerRegistry.get(panel.id)!.name
|
||||
};
|
||||
}));
|
||||
|
||||
quickPick.items = items;
|
||||
|
||||
@@ -583,6 +603,9 @@ export class MoveFocusedViewAction extends Action {
|
||||
if (destination.id === '_.panel.newcontainer') {
|
||||
this.viewDescriptorService.moveViewToLocation(viewDescriptor!, ViewContainerLocation.Panel);
|
||||
this.viewsService.openView(focusedViewId, true);
|
||||
} else if (destination.id === '_.sidebar.newcontainer') {
|
||||
this.viewDescriptorService.moveViewToLocation(viewDescriptor!, ViewContainerLocation.Sidebar);
|
||||
this.viewsService.openView(focusedViewId, true);
|
||||
} else if (destination.id) {
|
||||
this.viewDescriptorService.moveViewsToContainer([viewDescriptor], viewContainerRegistry.get(destination.id)!);
|
||||
this.viewsService.openView(focusedViewId, true);
|
||||
|
||||
@@ -901,7 +901,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
});
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: '84256',
|
||||
id: 'list.scrollLeft',
|
||||
weight: KeybindingWeight.WorkbenchContrib,
|
||||
when: WorkbenchListFocusContextKey,
|
||||
handler: accessor => {
|
||||
|
||||
@@ -2,3 +2,53 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. 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 {
|
||||
content: "\ea76"; /* Close icon flips between black dot and "X" for dirty workspaces */
|
||||
}
|
||||
|
||||
.monaco-workbench .screencast-mouse {
|
||||
position: absolute;
|
||||
border: 2px solid red;
|
||||
border-radius: 20px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 100000;
|
||||
content: ' ';
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.monaco-workbench .screencast-keyboard {
|
||||
position: absolute;
|
||||
background-color: rgba(0, 0, 0 ,0.5);
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
bottom: 20%;
|
||||
left: 0;
|
||||
z-index: 100000;
|
||||
pointer-events: none;
|
||||
color: #eee;
|
||||
line-height: 100px;
|
||||
text-align: center;
|
||||
font-size: 56px;
|
||||
transition: opacity 0.3s ease-out;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.monaco-workbench .screencast-keyboard:empty {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.monaco-workbench .screencast-keyboard > .key {
|
||||
padding: 0 8px;
|
||||
box-shadow: inset 0 -3px 0 hsla(0,0%,73%,.4);
|
||||
margin-right: 6px;
|
||||
border: 1px solid hsla(0,0%,80%,.4);
|
||||
border-radius: 5px;
|
||||
background-color: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.monaco-workbench .screencast-mouse {
|
||||
position: absolute;
|
||||
border: 2px solid red;
|
||||
border-radius: 20px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 100000;
|
||||
content: ' ';
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.monaco-workbench .screencast-keyboard {
|
||||
position: absolute;
|
||||
background-color: rgba(0, 0, 0 ,0.5);
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
bottom: 20%;
|
||||
left: 0;
|
||||
z-index: 100000;
|
||||
pointer-events: none;
|
||||
color: #eee;
|
||||
line-height: 100px;
|
||||
text-align: center;
|
||||
font-size: 56px;
|
||||
transition: opacity 0.3s ease-out;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.monaco-workbench .screencast-keyboard:empty {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.monaco-workbench .screencast-keyboard > .key {
|
||||
padding: 0 8px;
|
||||
box-shadow: inset 0 -3px 0 hsla(0,0%,73%,.4);
|
||||
margin-right: 6px;
|
||||
border: 1px solid hsla(0,0%,80%,.4);
|
||||
border-radius: 5px;
|
||||
background-color: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./media/actions';
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IWindowOpenable } from 'vs/platform/windows/common/windows';
|
||||
@@ -16,13 +14,13 @@ import { IsFullscreenContext } from 'vs/workbench/browser/contextkeys';
|
||||
import { IsMacNativeContext, IsDevelopmentContext } from 'vs/platform/contextkey/common/contextkeys';
|
||||
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
|
||||
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { IQuickInputButton, IQuickInputService, IQuickPickSeparator, IKeyMods } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { IQuickInputButton, IQuickInputService, IQuickPickSeparator, IKeyMods, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { IRecentWorkspace, IRecentFolder, IRecentFile, IRecent, isRecentFolder, isRecentWorkspace, IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IRecent, isRecentFolder, isRecentWorkspace, IWorkspacesService, IWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { getIconClasses } from 'vs/editor/common/services/getIconClasses';
|
||||
import { FileKind } from 'vs/platform/files/common/files';
|
||||
@@ -31,9 +29,15 @@ import { isMacintosh } from 'vs/base/common/platform';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { inQuickPickContext, getQuickNavigateHandler } from 'vs/workbench/browser/quickaccess';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
import { ResourceMap } from 'vs/base/common/map';
|
||||
|
||||
export const inRecentFilesPickerContextKey = 'inRecentFilesPicker';
|
||||
|
||||
interface IRecentlyOpenedPick extends IQuickPickItem {
|
||||
resource: URI,
|
||||
openable: IWindowOpenable;
|
||||
}
|
||||
|
||||
abstract class BaseOpenRecentAction extends Action {
|
||||
|
||||
private readonly removeFromRecentlyOpened: IQuickInputButton = {
|
||||
@@ -41,6 +45,12 @@ abstract class BaseOpenRecentAction extends Action {
|
||||
tooltip: nls.localize('remove', "Remove from Recently Opened")
|
||||
};
|
||||
|
||||
private readonly dirtyRecentlyOpened: IQuickInputButton = {
|
||||
iconClass: 'dirty-workspace codicon-circle-filled',
|
||||
tooltip: nls.localize('dirtyRecentlyOpened', "Workspace With Dirty Files"),
|
||||
alwaysVisible: true
|
||||
};
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@@ -51,7 +61,8 @@ abstract class BaseOpenRecentAction extends Action {
|
||||
private keybindingService: IKeybindingService,
|
||||
private modelService: IModelService,
|
||||
private modeService: IModeService,
|
||||
private hostService: IHostService
|
||||
private hostService: IHostService,
|
||||
private dialogService: IDialogService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
@@ -59,61 +70,53 @@ abstract class BaseOpenRecentAction extends Action {
|
||||
protected abstract isQuickNavigate(): boolean;
|
||||
|
||||
async run(): Promise<void> {
|
||||
const { workspaces, files } = await this.workspacesService.getRecentlyOpened();
|
||||
const recentlyOpened = await this.workspacesService.getRecentlyOpened();
|
||||
const dirtyWorkspacesAndFolders = await this.workspacesService.getDirtyWorkspaces();
|
||||
|
||||
this.openRecent(workspaces, files);
|
||||
}
|
||||
// Identify all folders and workspaces with dirty files
|
||||
const dirtyFolders = new ResourceMap<boolean>();
|
||||
const dirtyWorkspaces = new ResourceMap<IWorkspaceIdentifier>();
|
||||
for (const dirtyWorkspace of dirtyWorkspacesAndFolders) {
|
||||
if (URI.isUri(dirtyWorkspace)) {
|
||||
dirtyFolders.set(dirtyWorkspace, true);
|
||||
} else {
|
||||
dirtyWorkspaces.set(dirtyWorkspace.configPath, dirtyWorkspace);
|
||||
}
|
||||
}
|
||||
|
||||
private async openRecent(recentWorkspaces: Array<IRecentWorkspace | IRecentFolder>, recentFiles: IRecentFile[]): Promise<void> {
|
||||
|
||||
const toPick = (recent: IRecent, labelService: ILabelService, buttons: IQuickInputButton[] | undefined) => {
|
||||
let openable: IWindowOpenable | undefined;
|
||||
let iconClasses: string[];
|
||||
let fullLabel: string | undefined;
|
||||
let resource: URI | undefined;
|
||||
|
||||
// Folder
|
||||
// Identify all recently opened folders and workspaces
|
||||
const recentFolders = new ResourceMap<boolean>();
|
||||
const recentWorkspaces = new ResourceMap<IWorkspaceIdentifier>();
|
||||
for (const recent of recentlyOpened.workspaces) {
|
||||
if (isRecentFolder(recent)) {
|
||||
resource = recent.folderUri;
|
||||
iconClasses = getIconClasses(this.modelService, this.modeService, resource, FileKind.FOLDER);
|
||||
openable = { folderUri: resource };
|
||||
fullLabel = recent.label || labelService.getWorkspaceLabel(resource, { verbose: true });
|
||||
recentFolders.set(recent.folderUri, true);
|
||||
} else {
|
||||
recentWorkspaces.set(recent.workspace.configPath, recent.workspace);
|
||||
}
|
||||
}
|
||||
|
||||
// Workspace
|
||||
else if (isRecentWorkspace(recent)) {
|
||||
resource = recent.workspace.configPath;
|
||||
iconClasses = getIconClasses(this.modelService, this.modeService, resource, FileKind.ROOT_FOLDER);
|
||||
openable = { workspaceUri: resource };
|
||||
fullLabel = recent.label || labelService.getWorkspaceLabel(recent.workspace, { verbose: true });
|
||||
// Fill in all known recently opened workspaces
|
||||
const workspacePicks: IRecentlyOpenedPick[] = [];
|
||||
for (const recent of recentlyOpened.workspaces) {
|
||||
const isDirty = isRecentFolder(recent) ? dirtyFolders.has(recent.folderUri) : dirtyWorkspaces.has(recent.workspace.configPath);
|
||||
|
||||
workspacePicks.push(this.toQuickPick(recent, isDirty));
|
||||
}
|
||||
|
||||
// Fill any backup workspace that is not yet shown at the end
|
||||
for (const dirtyWorkspaceOrFolder of dirtyWorkspacesAndFolders) {
|
||||
if (URI.isUri(dirtyWorkspaceOrFolder) && !recentFolders.has(dirtyWorkspaceOrFolder)) {
|
||||
workspacePicks.push(this.toQuickPick({ folderUri: dirtyWorkspaceOrFolder }, true));
|
||||
} else if (isWorkspaceIdentifier(dirtyWorkspaceOrFolder) && !recentWorkspaces.has(dirtyWorkspaceOrFolder.configPath)) {
|
||||
workspacePicks.push(this.toQuickPick({ workspace: dirtyWorkspaceOrFolder }, true));
|
||||
}
|
||||
}
|
||||
|
||||
// File
|
||||
else {
|
||||
resource = recent.fileUri;
|
||||
iconClasses = getIconClasses(this.modelService, this.modeService, resource, FileKind.FILE);
|
||||
openable = { fileUri: resource };
|
||||
fullLabel = recent.label || labelService.getUriLabel(resource);
|
||||
}
|
||||
|
||||
const { name, parentPath } = splitName(fullLabel);
|
||||
|
||||
return {
|
||||
iconClasses,
|
||||
label: name,
|
||||
description: parentPath,
|
||||
buttons,
|
||||
openable,
|
||||
resource
|
||||
};
|
||||
};
|
||||
|
||||
const workspacePicks = recentWorkspaces.map(workspace => toPick(workspace, this.labelService, !this.isQuickNavigate() ? [this.removeFromRecentlyOpened] : undefined));
|
||||
const filePicks = recentFiles.map(p => toPick(p, this.labelService, !this.isQuickNavigate() ? [this.removeFromRecentlyOpened] : undefined));
|
||||
const filePicks = recentlyOpened.files.map(p => this.toQuickPick(p, false));
|
||||
|
||||
// focus second entry if the first recent workspace is the current workspace
|
||||
const firstEntry = recentWorkspaces[0];
|
||||
let autoFocusSecondEntry: boolean = firstEntry && this.contextService.isCurrentWorkspace(isRecentWorkspace(firstEntry) ? firstEntry.workspace : firstEntry.folderUri);
|
||||
const firstEntry = recentlyOpened.workspaces[0];
|
||||
const autoFocusSecondEntry: boolean = firstEntry && this.contextService.isCurrentWorkspace(isRecentWorkspace(firstEntry) ? firstEntry.workspace : firstEntry.folderUri);
|
||||
|
||||
let keyMods: IKeyMods | undefined;
|
||||
|
||||
@@ -129,8 +132,27 @@ abstract class BaseOpenRecentAction extends Action {
|
||||
onKeyMods: mods => keyMods = mods,
|
||||
quickNavigate: this.isQuickNavigate() ? { keybindings: this.keybindingService.lookupKeybindings(this.id) } : undefined,
|
||||
onDidTriggerItemButton: async context => {
|
||||
await this.workspacesService.removeRecentlyOpened([context.item.resource]);
|
||||
context.removeItem();
|
||||
|
||||
// Remove
|
||||
if (context.button === this.removeFromRecentlyOpened) {
|
||||
await this.workspacesService.removeRecentlyOpened([context.item.resource]);
|
||||
context.removeItem();
|
||||
}
|
||||
|
||||
// Dirty Workspace
|
||||
else if (context.button === this.dirtyRecentlyOpened) {
|
||||
const result = await this.dialogService.confirm({
|
||||
type: 'question',
|
||||
title: nls.localize('dirtyWorkspace', "Workspace with Dirty Files"),
|
||||
message: nls.localize('dirtyWorkspaceConfirm', "Do you want to open the workspace to review the dirty files?"),
|
||||
detail: nls.localize('dirtyWorkspaceConfirmDetail', "Workspaces with dirty files cannot be removed until all dirty files have been saved or reverted.")
|
||||
});
|
||||
|
||||
if (result.confirmed) {
|
||||
this.hostService.openWindow([context.item.openable]);
|
||||
this.quickInputService.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -138,6 +160,48 @@ abstract class BaseOpenRecentAction extends Action {
|
||||
return this.hostService.openWindow([pick.openable], { forceNewWindow: keyMods?.ctrlCmd, forceReuseWindow: keyMods?.alt });
|
||||
}
|
||||
}
|
||||
|
||||
private toQuickPick(recent: IRecent, isDirty: boolean): IRecentlyOpenedPick {
|
||||
let openable: IWindowOpenable | undefined;
|
||||
let iconClasses: string[];
|
||||
let fullLabel: string | undefined;
|
||||
let resource: URI | undefined;
|
||||
|
||||
// Folder
|
||||
if (isRecentFolder(recent)) {
|
||||
resource = recent.folderUri;
|
||||
iconClasses = getIconClasses(this.modelService, this.modeService, resource, FileKind.FOLDER);
|
||||
openable = { folderUri: resource };
|
||||
fullLabel = recent.label || this.labelService.getWorkspaceLabel(resource, { verbose: true });
|
||||
}
|
||||
|
||||
// Workspace
|
||||
else if (isRecentWorkspace(recent)) {
|
||||
resource = recent.workspace.configPath;
|
||||
iconClasses = getIconClasses(this.modelService, this.modeService, resource, FileKind.ROOT_FOLDER);
|
||||
openable = { workspaceUri: resource };
|
||||
fullLabel = recent.label || this.labelService.getWorkspaceLabel(recent.workspace, { verbose: true });
|
||||
}
|
||||
|
||||
// File
|
||||
else {
|
||||
resource = recent.fileUri;
|
||||
iconClasses = getIconClasses(this.modelService, this.modeService, resource, FileKind.FILE);
|
||||
openable = { fileUri: resource };
|
||||
fullLabel = recent.label || this.labelService.getUriLabel(resource);
|
||||
}
|
||||
|
||||
const { name, parentPath } = splitName(fullLabel);
|
||||
|
||||
return {
|
||||
iconClasses,
|
||||
label: name,
|
||||
description: parentPath,
|
||||
buttons: isDirty ? [this.dirtyRecentlyOpened] : [this.removeFromRecentlyOpened],
|
||||
openable,
|
||||
resource
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenRecentAction extends BaseOpenRecentAction {
|
||||
@@ -155,9 +219,10 @@ export class OpenRecentAction extends BaseOpenRecentAction {
|
||||
@IModelService modelService: IModelService,
|
||||
@IModeService modeService: IModeService,
|
||||
@ILabelService labelService: ILabelService,
|
||||
@IHostService hostService: IHostService
|
||||
@IHostService hostService: IHostService,
|
||||
@IDialogService dialogService: IDialogService
|
||||
) {
|
||||
super(id, label, workspacesService, quickInputService, contextService, labelService, keybindingService, modelService, modeService, hostService);
|
||||
super(id, label, workspacesService, quickInputService, contextService, labelService, keybindingService, modelService, modeService, hostService, dialogService);
|
||||
}
|
||||
|
||||
protected isQuickNavigate(): boolean {
|
||||
@@ -180,9 +245,10 @@ class QuickPickRecentAction extends BaseOpenRecentAction {
|
||||
@IModelService modelService: IModelService,
|
||||
@IModeService modeService: IModeService,
|
||||
@ILabelService labelService: ILabelService,
|
||||
@IHostService hostService: IHostService
|
||||
@IHostService hostService: IHostService,
|
||||
@IDialogService dialogService: IDialogService
|
||||
) {
|
||||
super(id, label, workspacesService, quickInputService, contextService, labelService, keybindingService, modelService, modeService, hostService);
|
||||
super(id, label, workspacesService, quickInputService, contextService, labelService, keybindingService, modelService, modeService, hostService, dialogService);
|
||||
}
|
||||
|
||||
protected isQuickNavigate(): boolean {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { IConstructorSignature0, IInstantiationService, BrandedService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { find, insert } from 'vs/base/common/arrays';
|
||||
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
export interface IEditorDescriptor {
|
||||
@@ -94,15 +94,11 @@ class EditorRegistry implements IEditorRegistry {
|
||||
registerEditor(descriptor: EditorDescriptor, inputDescriptors: readonly SyncDescriptor<EditorInput>[]): IDisposable {
|
||||
this.mapEditorToInputs.set(descriptor, inputDescriptors);
|
||||
|
||||
this.editors.push(descriptor);
|
||||
const remove = insert(this.editors, descriptor);
|
||||
|
||||
return toDisposable(() => {
|
||||
this.mapEditorToInputs.delete(descriptor);
|
||||
|
||||
const index = this.editors.indexOf(descriptor);
|
||||
if (index !== -1) {
|
||||
this.editors.splice(index, 1);
|
||||
}
|
||||
remove();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -115,8 +115,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {
|
||||
@IProductService private readonly productService: IProductService
|
||||
) {
|
||||
super(Parts.ACTIVITYBAR_PART, { hasTitle: false }, themeService, storageService, layoutService);
|
||||
this.migrateFromOldCachedViewletsValue();
|
||||
storageKeysSyncRegistryService.registerStorageKey({ key: ActivitybarPart.PINNED_VIEWLETS, version: 1 });
|
||||
this.migrateFromOldCachedViewletsValue();
|
||||
|
||||
this.cachedViewlets = this.getCachedViewlets();
|
||||
for (const cachedViewlet of this.cachedViewlets) {
|
||||
|
||||
@@ -275,7 +275,7 @@ quickAccessRegistry.registerQuickAccessProvider({
|
||||
prefix: ActiveGroupEditorsByMostRecentlyUsedQuickAccess.PREFIX,
|
||||
contextKey: editorPickerContextKey,
|
||||
placeholder: nls.localize('editorQuickAccessPlaceholder', "Type the name of an editor to open it."),
|
||||
helpEntries: [{ description: nls.localize('activeGroupEditorsByMostRecentlyUsedQuickAccess', "Show Editors in Active Group by Most Recently Used."), needsEditor: false }]
|
||||
helpEntries: [{ description: nls.localize('activeGroupEditorsByMostRecentlyUsedQuickAccess', "Show Editors in Active Group by Most Recently Used"), needsEditor: false }]
|
||||
});
|
||||
|
||||
quickAccessRegistry.registerQuickAccessProvider({
|
||||
|
||||
@@ -18,7 +18,6 @@ import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IFileDialogService, ConfirmResult } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
|
||||
import { values } from 'vs/base/common/map';
|
||||
import { ItemActivation, IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { AllEditorsByMostRecentlyUsedQuickAccess, ActiveGroupEditorsByMostRecentlyUsedQuickAccess, AllEditorsByAppearanceQuickAccess } from 'vs/workbench/browser/parts/editor/editorQuickAccess';
|
||||
|
||||
@@ -578,7 +577,7 @@ export abstract class BaseCloseAllAction extends Action {
|
||||
dirtyEditorsToConfirm.add(name);
|
||||
}
|
||||
|
||||
const confirm = await this.fileDialogService.showSaveConfirm(values(dirtyEditorsToConfirm));
|
||||
const confirm = await this.fileDialogService.showSaveConfirm(Array.from(dirtyEditorsToConfirm.values()));
|
||||
if (confirm === ConfirmResult.CANCEL) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -894,7 +894,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
|
||||
private async doShowEditor(editor: EditorInput, active: boolean, options?: EditorOptions): Promise<IEditorPane | undefined> {
|
||||
|
||||
// Show in editor control if the active editor changed
|
||||
let openEditorPromise: Promise<IEditorPane | undefined>;
|
||||
let openEditorPromise: Promise<IEditorPane | undefined> | undefined;
|
||||
if (active) {
|
||||
openEditorPromise = (async () => {
|
||||
try {
|
||||
@@ -915,7 +915,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
|
||||
}
|
||||
})();
|
||||
} else {
|
||||
openEditorPromise = Promise.resolve(undefined); // inactive: return undefined as result to signal this
|
||||
openEditorPromise = undefined; // inactive: return undefined as result to signal this
|
||||
}
|
||||
|
||||
// Show in title control after editor control because some actions depend on it
|
||||
|
||||
@@ -13,7 +13,6 @@ import { GroupDirection, IAddGroupOptions, GroupsArrangement, GroupOrientation,
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IView, orthogonal, LayoutPriority, IViewSize, Direction, SerializableGrid, Sizing, ISerializedGrid, Orientation, GridBranchNode, isGridBranchNode, GridNode, createSerializedGrid, Grid } from 'vs/base/browser/ui/grid/grid';
|
||||
import { GroupIdentifier, IWorkbenchEditorConfiguration, IEditorPartOptions, IEditorPartOptionsChangeEvent } from 'vs/workbench/common/editor';
|
||||
import { values } from 'vs/base/common/map';
|
||||
import { EDITOR_GROUP_BORDER, EDITOR_PANE_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import { distinct, coalesce } from 'vs/base/common/arrays';
|
||||
import { IEditorGroupsAccessor, IEditorGroupView, getEditorPartOptions, impactsEditorPartOptions, IEditorPartCreationOptions } from 'vs/workbench/browser/parts/editor/editor';
|
||||
@@ -211,7 +210,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
|
||||
}
|
||||
|
||||
get groups(): IEditorGroupView[] {
|
||||
return values(this.groupViews);
|
||||
return Array.from(this.groupViews.values());
|
||||
}
|
||||
|
||||
get count(): number {
|
||||
|
||||
@@ -62,7 +62,7 @@ export abstract class BaseEditorQuickAccessProvider extends PickerQuickAccessPro
|
||||
|
||||
// Filtering
|
||||
const filteredEditorEntries = this.doGetEditorPickItems().filter(entry => {
|
||||
if (!query.value) {
|
||||
if (!query.normalized) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ export abstract class BaseEditorQuickAccessProvider extends PickerQuickAccessPro
|
||||
});
|
||||
|
||||
// Sorting
|
||||
if (query.value) {
|
||||
if (query.normalized) {
|
||||
const groups = this.editorGroupService.getGroups(GroupsOrder.GRID_APPEARANCE).map(group => group.id);
|
||||
filteredEditorEntries.sort((entryA, entryB) => {
|
||||
if (entryA.groupId !== entryB.groupId) {
|
||||
|
||||
@@ -23,7 +23,6 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar';
|
||||
import { Severity } from 'vs/platform/notification/common/notification';
|
||||
import { isNonEmptyArray } from 'vs/base/common/arrays';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
|
||||
export class NotificationsListDelegate implements IListVirtualDelegate<INotificationViewItem> {
|
||||
|
||||
@@ -142,7 +141,7 @@ class NotificationMessageRenderer {
|
||||
} else {
|
||||
let title = node.title;
|
||||
|
||||
if (!title && startsWith(node.href, 'command:')) {
|
||||
if (!title && node.href.startsWith('command:')) {
|
||||
title = localize('executeCommand', "Click to execute command '{0}'", node.href.substr('command:'.length));
|
||||
} else if (!title) {
|
||||
title = node.href;
|
||||
|
||||
@@ -46,13 +46,13 @@
|
||||
border-right-width: 0; /* no border when editor area is hiden */
|
||||
}
|
||||
|
||||
.monaco-workbench .part.panel > .composite.tit > .title-actions .monaco-action-bar .action-item .action-label {
|
||||
.monaco-workbench .part.panel > .composite.title > .title-actions .monaco-action-bar .action-item .action-label {
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
/** Panel Switcher */
|
||||
|
||||
.monaco-workbench .part.panel > .composite.tit > .panel-switcher-container.composite-bar > .monaco-action-bar .action-label.codicon-more {
|
||||
.monaco-workbench .part.panel > .composite.title > .panel-switcher-container.composite-bar > .monaco-action-bar .action-label.codicon-more {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
@@ -31,7 +31,6 @@ import { coalesce, find } from 'vs/base/common/arrays';
|
||||
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 { values } from 'vs/base/common/map';
|
||||
import { assertIsDefined } from 'vs/base/common/types';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { Command } from 'vs/editor/common/modes';
|
||||
@@ -227,7 +226,7 @@ class StatusbarViewModel extends Disposable {
|
||||
|
||||
private saveState(): void {
|
||||
if (this.hidden.size > 0) {
|
||||
this.storageService.store(StatusbarViewModel.HIDDEN_ENTRIES_KEY, JSON.stringify(values(this.hidden)), StorageScope.GLOBAL);
|
||||
this.storageService.store(StatusbarViewModel.HIDDEN_ENTRIES_KEY, JSON.stringify(Array.from(this.hidden.values())), StorageScope.GLOBAL);
|
||||
} else {
|
||||
this.storageService.remove(StatusbarViewModel.HIDDEN_ENTRIES_KEY, StorageScope.GLOBAL);
|
||||
}
|
||||
@@ -360,9 +359,9 @@ 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;
|
||||
storageKeysSyncRegistryService.registerStorageKey({ key: StatusbarViewModel.HIDDEN_ENTRIES_KEY, version: 1 });
|
||||
|
||||
this.registerListeners();
|
||||
}
|
||||
|
||||
@@ -109,8 +109,7 @@ export class ContributableViewsModel extends Disposable {
|
||||
const added: IAddedViewDescriptorRef[] = [];
|
||||
const removed: IViewDescriptorRef[] = [];
|
||||
|
||||
for (const { id, visible, size } of viewDescriptors) {
|
||||
const { visibleIndex, viewDescriptor, state } = this.find(id);
|
||||
for (const { visibleIndex, viewDescriptor, state, visible, size } of viewDescriptors.map(({ id, visible, size }) => ({ ...this.find(id), visible, size }))) {
|
||||
|
||||
if (!viewDescriptor.canToggleVisibility) {
|
||||
throw new Error(`Can't toggle this view's visibility`);
|
||||
@@ -338,13 +337,14 @@ export class PersistentContributableViewsModel extends ContributableViewsModel {
|
||||
@IStorageKeysSyncRegistryService storageKeysSyncRegistryService: IStorageKeysSyncRegistryService
|
||||
) {
|
||||
const globalViewsStateStorageId = `${viewletStateStorageId}.hidden`;
|
||||
storageKeysSyncRegistryService.registerStorageKey({ key: globalViewsStateStorageId, version: 1 });
|
||||
const viewStates = PersistentContributableViewsModel.loadViewsStates(viewletStateStorageId, globalViewsStateStorageId, storageService);
|
||||
|
||||
super(container, viewDescriptorService, viewStates);
|
||||
|
||||
this.storageService = storageService;
|
||||
this.workspaceViewsStateStorageId = viewletStateStorageId;
|
||||
this.globalViewsStateStorageId = globalViewsStateStorageId;
|
||||
this.storageService = storageService;
|
||||
|
||||
this._register(Event.any(
|
||||
this.onDidAdd,
|
||||
@@ -353,7 +353,6 @@ export class PersistentContributableViewsModel extends ContributableViewsModel {
|
||||
Event.map(this.onDidChangeViewState, viewDescriptorRef => [viewDescriptorRef]))
|
||||
(viewDescriptorRefs => this.saveViewsStates()));
|
||||
|
||||
storageKeysSyncRegistryService.registerStorageKey({ key: this.globalViewsStateStorageId, version: 1 });
|
||||
this._globalViewsStatesValue = this.getStoredGlobalViewsStatesValue();
|
||||
this._register(this.storageService.onDidChangeStorage(e => this.onDidStorageChange(e)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user