Merge branch 'ads-main-vscode-2020-07-15T23-51-12' into main

This commit is contained in:
cssuh
2020-07-17 15:00:28 -04:00
558 changed files with 15180 additions and 8232 deletions

View File

@@ -5,7 +5,6 @@
import 'vs/css!./media/actions';
import { Action } from 'vs/base/common/actions';
import * as nls from 'vs/nls';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { domEvent } from 'vs/base/browser/event';
@@ -19,29 +18,31 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { timeout } from 'vs/base/common/async';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
import { Registry } from 'vs/platform/registry/common/platform';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
import { registerAction2, Action2 } from 'vs/platform/actions/common/actions';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { clamp } from 'vs/base/common/numbers';
import { KeyCode } from 'vs/base/common/keyCodes';
import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry';
import { ILogService } from 'vs/platform/log/common/log';
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
class InspectContextKeysAction extends Action {
const developerCategory = { value: nls.localize({ key: 'developer', comment: ['A developer on Code itself or someone diagnosing issues in Code'] }, "Developer"), original: 'Developer' };
static readonly ID = 'workbench.action.inspectContextKeys';
static readonly LABEL = nls.localize('inspect context keys', "Inspect Context Keys");
class InspectContextKeysAction extends Action2 {
constructor(
id: string,
label: string,
@IContextKeyService private readonly contextKeyService: IContextKeyService
) {
super(id, label);
constructor() {
super({
id: 'workbench.action.inspectContextKeys',
title: { value: nls.localize('inspect context keys', "Inspect Context Keys"), original: 'Inspect Context Keys' },
category: developerCategory,
f1: true
});
}
async run(): Promise<void> {
run(accessor: ServicesAccessor): void {
const contextKeyService = accessor.get(IContextKeyService);
const disposables = new DisposableStore();
const stylesheet = createStyleSheet();
@@ -80,7 +81,7 @@ class InspectContextKeysAction extends Action {
e.preventDefault();
e.stopPropagation();
const context = this.contextKeyService.getContext(e.target as HTMLElement) as Context;
const context = contextKeyService.getContext(e.target as HTMLElement) as Context;
console.log(context.collectAllValues());
dispose(disposables);
@@ -88,33 +89,33 @@ class InspectContextKeysAction extends Action {
}
}
class ToggleScreencastModeAction extends Action {
static readonly ID = 'workbench.action.toggleScreencastMode';
static readonly LABEL = nls.localize('toggle screencast mode', "Toggle Screencast Mode");
class ToggleScreencastModeAction extends Action2 {
static disposable: IDisposable | undefined;
constructor(
id: string,
label: string,
@IKeybindingService private readonly keybindingService: IKeybindingService,
@ILayoutService private readonly layoutService: ILayoutService,
@IConfigurationService private readonly configurationService: IConfigurationService
) {
super(id, label);
constructor() {
super({
id: 'workbench.action.toggleScreencastMode',
title: { value: nls.localize('toggle screencast mode', "Toggle Screencast Mode"), original: 'Toggle Screencast Mode' },
category: developerCategory,
f1: true
});
}
async run(): Promise<void> {
run(accessor: ServicesAccessor): void {
if (ToggleScreencastModeAction.disposable) {
ToggleScreencastModeAction.disposable.dispose();
ToggleScreencastModeAction.disposable = undefined;
return;
}
const layoutService = accessor.get(ILayoutService);
const configurationService = accessor.get(IConfigurationService);
const keybindingService = accessor.get(IKeybindingService);
const disposables = new DisposableStore();
const container = this.layoutService.container;
const container = layoutService.container;
const mouseMarker = append(container, $('.screencast-mouse'));
disposables.add(toDisposable(() => mouseMarker.remove()));
@@ -142,17 +143,17 @@ class ToggleScreencastModeAction extends Action {
disposables.add(toDisposable(() => keyboardMarker.remove()));
const updateKeyboardFontSize = () => {
keyboardMarker.style.fontSize = `${clamp(this.configurationService.getValue<number>('screencastMode.fontSize') || 56, 20, 100)}px`;
keyboardMarker.style.fontSize = `${clamp(configurationService.getValue<number>('screencastMode.fontSize') || 56, 20, 100)}px`;
};
const updateKeyboardMarker = () => {
keyboardMarker.style.bottom = `${clamp(this.configurationService.getValue<number>('screencastMode.verticalOffset') || 0, 0, 90)}%`;
keyboardMarker.style.bottom = `${clamp(configurationService.getValue<number>('screencastMode.verticalOffset') || 0, 0, 90)}%`;
};
updateKeyboardFontSize();
updateKeyboardMarker();
disposables.add(this.configurationService.onDidChangeConfiguration(e => {
disposables.add(configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('screencastMode.verticalOffset')) {
updateKeyboardMarker();
}
@@ -170,9 +171,9 @@ class ToggleScreencastModeAction extends Action {
keyboardTimeout.dispose();
const event = new StandardKeyboardEvent(e);
const shortcut = this.keybindingService.softDispatch(event, event.target);
const shortcut = keybindingService.softDispatch(event, event.target);
if (shortcut || !this.configurationService.getValue<boolean>('screencastMode.onlyKeyboardShortcuts')) {
if (shortcut || !configurationService.getValue<boolean>('screencastMode.onlyKeyboardShortcuts')) {
if (
event.ctrlKey || event.altKey || event.metaKey || event.shiftKey
|| length > 20
@@ -182,7 +183,7 @@ class ToggleScreencastModeAction extends Action {
length = 0;
}
const keybinding = this.keybindingService.resolveKeyboardEvent(event);
const keybinding = keybindingService.resolveKeyboardEvent(event);
const label = keybinding.getLabel();
const key = $('span.key', {}, label || '');
length++;
@@ -202,59 +203,54 @@ class ToggleScreencastModeAction extends Action {
}
}
class LogStorageAction extends Action {
class LogStorageAction extends Action2 {
static readonly ID = 'workbench.action.logStorage';
static readonly LABEL = nls.localize({ key: 'logStorage', comment: ['A developer only action to log the contents of the storage for the current window.'] }, "Log Storage Database Contents");
constructor(
id: string,
label: string,
@IStorageService private readonly storageService: IStorageService
) {
super(id, label);
constructor() {
super({
id: 'workbench.action.logStorage',
title: { value: nls.localize({ key: 'logStorage', comment: ['A developer only action to log the contents of the storage for the current window.'] }, "Log Storage Database Contents"), original: 'Log Storage Database Contents' },
category: developerCategory,
f1: true
});
}
async run(): Promise<void> {
this.storageService.logStorage();
run(accessor: ServicesAccessor): void {
accessor.get(IStorageService).logStorage();
}
}
class LogWorkingCopiesAction extends Action {
class LogWorkingCopiesAction extends Action2 {
static readonly ID = 'workbench.action.logWorkingCopies';
static readonly LABEL = nls.localize({ key: 'logWorkingCopies', comment: ['A developer only action to log the working copies that exist.'] }, "Log Working Copies");
constructor(
id: string,
label: string,
@ILogService private logService: ILogService,
@IWorkingCopyService private workingCopyService: IWorkingCopyService
) {
super(id, label);
constructor() {
super({
id: 'workbench.action.logWorkingCopies',
title: { value: nls.localize({ key: 'logWorkingCopies', comment: ['A developer only action to log the working copies that exist.'] }, "Log Working Copies"), original: 'Log Working Copies' },
category: developerCategory,
f1: true
});
}
async run(): Promise<void> {
run(accessor: ServicesAccessor): void {
const workingCopyService = accessor.get(IWorkingCopyService);
const logService = accessor.get(ILogService);
const msg = [
`Dirty Working Copies:`,
...this.workingCopyService.dirtyWorkingCopies.map(workingCopy => workingCopy.resource.toString(true)),
...workingCopyService.dirtyWorkingCopies.map(workingCopy => workingCopy.resource.toString(true)),
``,
`All Working Copies:`,
...this.workingCopyService.workingCopies.map(workingCopy => workingCopy.resource.toString(true)),
...workingCopyService.workingCopies.map(workingCopy => workingCopy.resource.toString(true)),
];
this.logService.info(msg.join('\n'));
logService.info(msg.join('\n'));
}
}
// --- Actions Registration
registerAction2(InspectContextKeysAction);
registerAction2(ToggleScreencastModeAction);
registerAction2(LogStorageAction);
registerAction2(LogWorkingCopiesAction);
const developerCategory = nls.localize({ key: 'developer', comment: ['A developer on Code itself or someone diagnosing issues in Code'] }, "Developer");
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
registry.registerWorkbenchAction(SyncActionDescriptor.from(InspectContextKeysAction), 'Developer: Inspect Context Keys', developerCategory);
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleScreencastModeAction), 'Developer: Toggle Screencast Mode', developerCategory);
registry.registerWorkbenchAction(SyncActionDescriptor.from(LogStorageAction), 'Developer: Log Storage Database Contents', developerCategory);
registry.registerWorkbenchAction(SyncActionDescriptor.from(LogWorkingCopiesAction), 'Developer: Log Working Copies', developerCategory);
// Screencast Mode
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);

View File

@@ -3,224 +3,248 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Action } from 'vs/base/common/actions';
import * as nls from 'vs/nls';
import product from 'vs/platform/product/common/product';
import { isMacintosh, isLinux, language } from 'vs/base/common/platform';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { URI } from 'vs/base/common/uri';
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { MenuId, Action2, registerAction2, MenuRegistry } from 'vs/platform/actions/common/actions';
import { KeyChord, KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { IProductService } from 'vs/platform/product/common/productService';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
class KeybindingsReferenceAction extends Action {
const helpCategory = { value: nls.localize('help', "Help"), original: 'Help' };
class KeybindingsReferenceAction extends Action2 {
static readonly ID = 'workbench.action.keybindingsReference';
static readonly LABEL = nls.localize('keybindingsReference', "Keyboard Shortcuts Reference");
static readonly AVAILABLE = !!(isLinux ? product.keyboardShortcutsUrlLinux : isMacintosh ? product.keyboardShortcutsUrlMac : product.keyboardShortcutsUrlWin);
constructor(
id: string,
label: string,
@IOpenerService private readonly openerService: IOpenerService,
@IProductService private readonly productService: IProductService
) {
super(id, label);
constructor() {
super({
id: KeybindingsReferenceAction.ID,
title: { value: nls.localize('keybindingsReference', "Keyboard Shortcuts Reference"), original: 'Keyboard Shortcuts Reference' },
category: helpCategory,
f1: true,
keybinding: {
weight: KeybindingWeight.WorkbenchContrib,
when: null,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_R)
}
});
}
async run(): Promise<void> {
const url = isLinux ? this.productService.keyboardShortcutsUrlLinux : isMacintosh ? this.productService.keyboardShortcutsUrlMac : this.productService.keyboardShortcutsUrlWin;
run(accessor: ServicesAccessor): void {
const productService = accessor.get(IProductService);
const openerService = accessor.get(IOpenerService);
const url = isLinux ? productService.keyboardShortcutsUrlLinux : isMacintosh ? productService.keyboardShortcutsUrlMac : productService.keyboardShortcutsUrlWin;
if (url) {
this.openerService.open(URI.parse(url));
openerService.open(URI.parse(url));
}
}
}
class OpenDocumentationUrlAction extends Action {
class OpenDocumentationUrlAction extends Action2 {
static readonly ID = 'workbench.action.openDocumentationUrl';
static readonly LABEL = nls.localize('openDocumentationUrl', "Documentation");
static readonly AVAILABLE = !!product.documentationUrl;
constructor(
id: string,
label: string,
@IOpenerService private readonly openerService: IOpenerService,
@IProductService private readonly productService: IProductService
) {
super(id, label);
constructor() {
super({
id: OpenDocumentationUrlAction.ID,
title: { value: nls.localize('openDocumentationUrl', "Documentation"), original: 'Documentation' },
category: helpCategory,
f1: true
});
}
async run(): Promise<void> {
if (this.productService.documentationUrl) {
this.openerService.open(URI.parse(this.productService.documentationUrl));
run(accessor: ServicesAccessor): void {
const productService = accessor.get(IProductService);
const openerService = accessor.get(IOpenerService);
if (productService.documentationUrl) {
openerService.open(URI.parse(productService.documentationUrl));
}
}
}
class OpenIntroductoryVideosUrlAction extends Action {
class OpenIntroductoryVideosUrlAction extends Action2 {
static readonly ID = 'workbench.action.openIntroductoryVideosUrl';
static readonly LABEL = nls.localize('openIntroductoryVideosUrl', "Introductory Videos");
static readonly AVAILABLE = !!product.introductoryVideosUrl;
constructor(
id: string,
label: string,
@IOpenerService private readonly openerService: IOpenerService,
@IProductService private readonly productService: IProductService
) {
super(id, label);
constructor() {
super({
id: OpenIntroductoryVideosUrlAction.ID,
title: { value: nls.localize('openIntroductoryVideosUrl', "Introductory Videos"), original: 'Introductory Videos' },
category: helpCategory,
f1: true
});
}
async run(): Promise<void> {
if (this.productService.introductoryVideosUrl) {
this.openerService.open(URI.parse(this.productService.introductoryVideosUrl));
run(accessor: ServicesAccessor): void {
const productService = accessor.get(IProductService);
const openerService = accessor.get(IOpenerService);
if (productService.introductoryVideosUrl) {
openerService.open(URI.parse(productService.introductoryVideosUrl));
}
}
}
class OpenTipsAndTricksUrlAction extends Action {
class OpenTipsAndTricksUrlAction extends Action2 {
static readonly ID = 'workbench.action.openTipsAndTricksUrl';
static readonly LABEL = nls.localize('openTipsAndTricksUrl', "Tips and Tricks");
static readonly AVAILABLE = !!product.tipsAndTricksUrl;
constructor(
id: string,
label: string,
@IOpenerService private readonly openerService: IOpenerService,
@IProductService private readonly productService: IProductService
) {
super(id, label);
constructor() {
super({
id: OpenTipsAndTricksUrlAction.ID,
title: { value: nls.localize('openTipsAndTricksUrl', "Tips and Tricks"), original: 'Tips and Tricks' },
category: helpCategory,
f1: true
});
}
async run(): Promise<void> {
if (this.productService.tipsAndTricksUrl) {
this.openerService.open(URI.parse(this.productService.tipsAndTricksUrl));
run(accessor: ServicesAccessor): void {
const productService = accessor.get(IProductService);
const openerService = accessor.get(IOpenerService);
if (productService.tipsAndTricksUrl) {
openerService.open(URI.parse(productService.tipsAndTricksUrl));
}
}
}
class OpenNewsletterSignupUrlAction extends Action {
class OpenNewsletterSignupUrlAction extends Action2 {
static readonly ID = 'workbench.action.openNewsletterSignupUrl';
static readonly LABEL = nls.localize('newsletterSignup', "Signup for the VS Code Newsletter");
static readonly AVAILABLE = !!product.newsletterSignupUrl;
constructor(
id: string,
label: string,
@IOpenerService private readonly openerService: IOpenerService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IProductService private readonly productService: IProductService
) {
super(id, label);
constructor() {
super({
id: OpenNewsletterSignupUrlAction.ID,
title: { value: nls.localize('newsletterSignup', "Signup for the VS Code Newsletter"), original: 'Signup for the VS Code Newsletter' },
category: helpCategory,
f1: true
});
}
async run(): Promise<void> {
const info = await this.telemetryService.getTelemetryInfo();
async run(accessor: ServicesAccessor): Promise<void> {
const productService = accessor.get(IProductService);
const openerService = accessor.get(IOpenerService);
const telemetryService = accessor.get(ITelemetryService);
this.openerService.open(URI.parse(`${this.productService.newsletterSignupUrl}?machineId=${encodeURIComponent(info.machineId)}`));
const info = await telemetryService.getTelemetryInfo();
openerService.open(URI.parse(`${productService.newsletterSignupUrl}?machineId=${encodeURIComponent(info.machineId)}`));
}
}
class OpenTwitterUrlAction extends Action {
class OpenTwitterUrlAction extends Action2 {
static readonly ID = 'workbench.action.openTwitterUrl';
static readonly LABEL = nls.localize('openTwitterUrl', "Join Us on Twitter");
static readonly AVAILABLE = !!product.twitterUrl;
constructor(
id: string,
label: string,
@IOpenerService private readonly openerService: IOpenerService,
@IProductService private readonly productService: IProductService
) {
super(id, label);
constructor() {
super({
id: OpenTwitterUrlAction.ID,
title: { value: nls.localize('openTwitterUrl', "Join Us on Twitter"), original: 'Join Us on Twitter' },
category: helpCategory,
f1: true
});
}
async run(): Promise<void> {
if (this.productService.twitterUrl) {
this.openerService.open(URI.parse(this.productService.twitterUrl));
run(accessor: ServicesAccessor): void {
const productService = accessor.get(IProductService);
const openerService = accessor.get(IOpenerService);
if (productService.twitterUrl) {
openerService.open(URI.parse(productService.twitterUrl));
}
}
}
class OpenRequestFeatureUrlAction extends Action {
class OpenRequestFeatureUrlAction extends Action2 {
static readonly ID = 'workbench.action.openRequestFeatureUrl';
static readonly LABEL = nls.localize('openUserVoiceUrl', "Search Feature Requests");
static readonly AVAILABLE = !!product.requestFeatureUrl;
constructor(
id: string,
label: string,
@IOpenerService private readonly openerService: IOpenerService,
@IProductService private readonly productService: IProductService
) {
super(id, label);
constructor() {
super({
id: OpenRequestFeatureUrlAction.ID,
title: { value: nls.localize('openUserVoiceUrl', "Search Feature Requests"), original: 'Search Feature Requests' },
category: helpCategory,
f1: true
});
}
async run(): Promise<void> {
if (this.productService.requestFeatureUrl) {
this.openerService.open(URI.parse(this.productService.requestFeatureUrl));
run(accessor: ServicesAccessor): void {
const productService = accessor.get(IProductService);
const openerService = accessor.get(IOpenerService);
if (productService.requestFeatureUrl) {
openerService.open(URI.parse(productService.requestFeatureUrl));
}
}
}
class OpenLicenseUrlAction extends Action {
class OpenLicenseUrlAction extends Action2 {
static readonly ID = 'workbench.action.openLicenseUrl';
static readonly LABEL = nls.localize('openLicenseUrl', "View License");
static readonly AVAILABLE = !!product.licenseUrl;
constructor(
id: string,
label: string,
@IOpenerService private readonly openerService: IOpenerService,
@IProductService private readonly productService: IProductService
) {
super(id, label);
constructor() {
super({
id: OpenLicenseUrlAction.ID,
title: { value: nls.localize('openLicenseUrl', "View License"), original: 'View License' },
category: helpCategory,
f1: true
});
}
async run(): Promise<void> {
if (this.productService.licenseUrl) {
run(accessor: ServicesAccessor): void {
const productService = accessor.get(IProductService);
const openerService = accessor.get(IOpenerService);
if (productService.licenseUrl) {
if (language) {
const queryArgChar = this.productService.licenseUrl.indexOf('?') > 0 ? '&' : '?';
this.openerService.open(URI.parse(`${this.productService.licenseUrl}${queryArgChar}lang=${language}`));
const queryArgChar = productService.licenseUrl.indexOf('?') > 0 ? '&' : '?';
openerService.open(URI.parse(`${productService.licenseUrl}${queryArgChar}lang=${language}`));
} else {
this.openerService.open(URI.parse(this.productService.licenseUrl));
openerService.open(URI.parse(productService.licenseUrl));
}
}
}
}
class OpenPrivacyStatementUrlAction extends Action {
class OpenPrivacyStatementUrlAction extends Action2 {
static readonly ID = 'workbench.action.openPrivacyStatementUrl';
static readonly LABEL = nls.localize('openPrivacyStatement', "Privacy Statement");
static readonly AVAILABE = !!product.privacyStatementUrl;
constructor(
id: string,
label: string,
@IOpenerService private readonly openerService: IOpenerService,
@IProductService private readonly productService: IProductService
) {
super(id, label);
constructor() {
super({
id: OpenPrivacyStatementUrlAction.ID,
title: { value: nls.localize('openPrivacyStatement', "Privacy Statement"), original: 'Privacy Statement' },
category: helpCategory,
f1: true
});
}
async run(): Promise<void> {
if (this.productService.privacyStatementUrl) {
run(accessor: ServicesAccessor): void {
const productService = accessor.get(IProductService);
const openerService = accessor.get(IOpenerService);
if (productService.privacyStatementUrl) {
if (language) {
const queryArgChar = this.productService.privacyStatementUrl.indexOf('?') > 0 ? '&' : '?';
this.openerService.open(URI.parse(`${this.productService.privacyStatementUrl}${queryArgChar}lang=${language}`));
const queryArgChar = productService.privacyStatementUrl.indexOf('?') > 0 ? '&' : '?';
openerService.open(URI.parse(`${productService.privacyStatementUrl}${queryArgChar}lang=${language}`));
} else {
this.openerService.open(URI.parse(this.productService.privacyStatementUrl));
openerService.open(URI.parse(productService.privacyStatementUrl));
}
}
}
@@ -228,43 +252,40 @@ class OpenPrivacyStatementUrlAction extends Action {
// --- Actions Registration
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
const helpCategory = nls.localize('help', "Help");
if (KeybindingsReferenceAction.AVAILABLE) {
registry.registerWorkbenchAction(SyncActionDescriptor.from(KeybindingsReferenceAction, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_R) }), 'Help: Keyboard Shortcuts Reference', helpCategory);
registerAction2(KeybindingsReferenceAction);
}
if (OpenDocumentationUrlAction.AVAILABLE) {
registry.registerWorkbenchAction(SyncActionDescriptor.from(OpenDocumentationUrlAction), 'Help: Documentation', helpCategory);
registerAction2(OpenDocumentationUrlAction);
}
if (OpenIntroductoryVideosUrlAction.AVAILABLE) {
registry.registerWorkbenchAction(SyncActionDescriptor.from(OpenIntroductoryVideosUrlAction), 'Help: Introductory Videos', helpCategory);
registerAction2(OpenIntroductoryVideosUrlAction);
}
if (OpenTipsAndTricksUrlAction.AVAILABLE) {
registry.registerWorkbenchAction(SyncActionDescriptor.from(OpenTipsAndTricksUrlAction), 'Help: Tips and Tricks', helpCategory);
registerAction2(OpenTipsAndTricksUrlAction);
}
if (OpenNewsletterSignupUrlAction.AVAILABLE) {
registry.registerWorkbenchAction(SyncActionDescriptor.from(OpenNewsletterSignupUrlAction), 'Help: Tips and Tricks', helpCategory);
registerAction2(OpenNewsletterSignupUrlAction);
}
if (OpenTwitterUrlAction.AVAILABLE) {
registry.registerWorkbenchAction(SyncActionDescriptor.from(OpenTwitterUrlAction), 'Help: Join Us on Twitter', helpCategory);
registerAction2(OpenTwitterUrlAction);
}
if (OpenRequestFeatureUrlAction.AVAILABLE) {
registry.registerWorkbenchAction(SyncActionDescriptor.from(OpenRequestFeatureUrlAction), 'Help: Search Feature Requests', helpCategory);
registerAction2(OpenRequestFeatureUrlAction);
}
if (OpenLicenseUrlAction.AVAILABLE) {
registry.registerWorkbenchAction(SyncActionDescriptor.from(OpenLicenseUrlAction), 'Help: View License', helpCategory);
registerAction2(OpenLicenseUrlAction);
}
if (OpenPrivacyStatementUrlAction.AVAILABE) {
registry.registerWorkbenchAction(SyncActionDescriptor.from(OpenPrivacyStatementUrlAction), 'Help: Privacy Statement', helpCategory);
registerAction2(OpenPrivacyStatementUrlAction);
}
// --- Menu Registration

View File

@@ -6,7 +6,7 @@
import * as nls from 'vs/nls';
import { Registry } from 'vs/platform/registry/common/platform';
import { Action } from 'vs/base/common/actions';
import { SyncActionDescriptor, MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
import { SyncActionDescriptor, MenuId, MenuRegistry, registerAction2, Action2 } from 'vs/platform/actions/common/actions';
import { IWorkbenchActionRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/actions';
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { IWorkbenchLayoutService, Parts, Position } from 'vs/workbench/services/layout/browser/layoutService';
@@ -30,61 +30,58 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { Codicon } from 'vs/base/common/codicons';
const registry = Registry.as<IWorkbenchActionRegistry>(WorkbenchExtensions.WorkbenchActions);
const viewCategory = nls.localize('view', "View");
const viewCategory = { value: nls.localize('view', "View"), original: 'View' };
// --- Close Side Bar
export class CloseSidebarAction extends Action {
class CloseSidebarAction extends Action2 {
static readonly ID = 'workbench.action.closeSidebar';
static readonly LABEL = nls.localize('closeSidebar', "Close Side Bar");
constructor(
id: string,
label: string,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
) {
super(id, label);
this.enabled = !!this.layoutService;
constructor() {
super({
id: 'workbench.action.closeSidebar',
title: { value: nls.localize('closeSidebar', "Close Side Bar"), original: 'Close Side Bar' },
category: viewCategory,
f1: true
});
}
async run(): Promise<void> {
this.layoutService.setSideBarHidden(true);
run(accessor: ServicesAccessor): void {
accessor.get(IWorkbenchLayoutService).setSideBarHidden(true);
}
}
registry.registerWorkbenchAction(SyncActionDescriptor.from(CloseSidebarAction), 'View: Close Side Bar', viewCategory);
registerAction2(CloseSidebarAction);
// --- Toggle Activity Bar
export class ToggleActivityBarVisibilityAction extends Action {
export class ToggleActivityBarVisibilityAction extends Action2 {
static readonly ID = 'workbench.action.toggleActivityBarVisibility';
static readonly LABEL = nls.localize('toggleActivityBar', "Toggle Activity Bar Visibility");
private static readonly activityBarVisibleKey = 'workbench.activityBar.visible';
constructor(
id: string,
label: string,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
@IConfigurationService private readonly configurationService: IConfigurationService
) {
super(id, label);
this.enabled = !!this.layoutService;
constructor() {
super({
id: ToggleActivityBarVisibilityAction.ID,
title: { value: ToggleActivityBarVisibilityAction.LABEL, original: 'Toggle Activity Bar Visibility' },
category: viewCategory,
f1: true
});
}
run(): Promise<void> {
const visibility = this.layoutService.isVisible(Parts.ACTIVITYBAR_PART);
run(accessor: ServicesAccessor): void {
const layoutService = accessor.get(IWorkbenchLayoutService);
const configurationService = accessor.get(IConfigurationService);
const visibility = layoutService.isVisible(Parts.ACTIVITYBAR_PART);
const newVisibilityValue = !visibility;
return this.configurationService.updateValue(ToggleActivityBarVisibilityAction.activityBarVisibleKey, newVisibilityValue, ConfigurationTarget.USER);
configurationService.updateValue(ToggleActivityBarVisibilityAction.activityBarVisibleKey, newVisibilityValue, ConfigurationTarget.USER);
}
}
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleActivityBarVisibilityAction), 'View: Toggle Activity Bar Visibility', viewCategory);
registerAction2(ToggleActivityBarVisibilityAction);
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '2_workbench_layout',
@@ -98,32 +95,33 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
// --- Toggle Centered Layout
class ToggleCenteredLayout extends Action {
class ToggleCenteredLayout extends Action2 {
static readonly ID = 'workbench.action.toggleCenteredLayout';
static readonly LABEL = nls.localize('toggleCenteredLayout', "Toggle Centered Layout");
constructor(
id: string,
label: string,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
) {
super(id, label);
this.enabled = !!this.layoutService;
constructor() {
super({
id: ToggleCenteredLayout.ID,
title: { value: nls.localize('toggleCenteredLayout', "Toggle Centered Layout"), original: 'Toggle Centered Layout' },
category: viewCategory,
f1: true
});
}
async run(): Promise<void> {
this.layoutService.centerEditorLayout(!this.layoutService.isEditorLayoutCentered());
run(accessor: ServicesAccessor): void {
const layoutService = accessor.get(IWorkbenchLayoutService);
layoutService.centerEditorLayout(!layoutService.isEditorLayoutCentered());
}
}
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleCenteredLayout), 'View: Toggle Centered Layout', viewCategory);
registerAction2(ToggleCenteredLayout);
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '1_toggle_view',
command: {
id: ToggleCenteredLayout.ID,
title: nls.localize('miToggleCenteredLayout', "Centered Layout"),
title: nls.localize({ key: 'miToggleCenteredLayout', comment: ['&& denotes a mnemonic'] }, "&&Centered Layout"),
toggled: IsCenteredLayoutContext
},
order: 3
@@ -166,8 +164,7 @@ export class ToggleEditorLayoutAction extends Action {
}
}
const group = viewCategory;
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleEditorLayoutAction, { primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_0, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_0 } }), 'View: Toggle Vertical/Horizontal Editor Layout', group);
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleEditorLayoutAction, { primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_0, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_0 } }), 'View: Toggle Vertical/Horizontal Editor Layout', viewCategory.value);
MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
group: 'z_flip',
@@ -194,8 +191,6 @@ export class ToggleSidebarPositionAction extends Action {
@IConfigurationService private readonly configurationService: IConfigurationService
) {
super(id, label);
this.enabled = !!this.layoutService && !!this.configurationService;
}
run(): Promise<void> {
@@ -210,7 +205,7 @@ export class ToggleSidebarPositionAction extends Action {
}
}
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleSidebarPositionAction), 'View: Toggle Side Bar Position', viewCategory);
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleSidebarPositionAction), 'View: Toggle Side Bar Position', viewCategory.value);
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '3_workbench_layout_move',
@@ -244,8 +239,6 @@ export class ToggleEditorVisibilityAction extends Action {
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
) {
super(id, label);
this.enabled = !!this.layoutService;
}
async run(): Promise<void> {
@@ -253,7 +246,7 @@ export class ToggleEditorVisibilityAction extends Action {
}
}
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleEditorVisibilityAction), 'View: Toggle Editor Area Visibility', viewCategory);
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleEditorVisibilityAction), 'View: Toggle Editor Area Visibility', viewCategory.value);
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '2_workbench_layout',
@@ -276,8 +269,6 @@ export class ToggleSidebarVisibilityAction extends Action {
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
) {
super(id, label);
this.enabled = !!this.layoutService;
}
async run(): Promise<void> {
@@ -286,7 +277,7 @@ export class ToggleSidebarVisibilityAction extends Action {
}
}
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleSidebarVisibilityAction, { primary: KeyMod.CtrlCmd | KeyCode.KEY_B }), 'View: Toggle Side Bar Visibility', viewCategory);
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleSidebarVisibilityAction, { primary: KeyMod.CtrlCmd | KeyCode.KEY_B }), 'View: Toggle Side Bar Visibility', viewCategory.value);
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
group: '2_appearance',
@@ -321,8 +312,6 @@ export class ToggleStatusbarVisibilityAction extends Action {
@IConfigurationService private readonly configurationService: IConfigurationService
) {
super(id, label);
this.enabled = !!this.layoutService;
}
run(): Promise<void> {
@@ -333,7 +322,7 @@ export class ToggleStatusbarVisibilityAction extends Action {
}
}
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleStatusbarVisibilityAction), 'View: Toggle Status Bar Visibility', viewCategory);
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleStatusbarVisibilityAction), 'View: Toggle Status Bar Visibility', viewCategory.value);
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '2_workbench_layout',
@@ -374,7 +363,7 @@ registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleTabsVisibilityA
primary: undefined,
mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.KEY_W, },
linux: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.KEY_W, }
}), 'View: Toggle Tab Visibility', viewCategory);
}), 'View: Toggle Tab Visibility', viewCategory.value);
// --- Toggle Zen Mode
@@ -389,7 +378,6 @@ class ToggleZenMode extends Action {
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
) {
super(id, label);
this.enabled = !!this.layoutService;
}
async run(): Promise<void> {
@@ -397,7 +385,7 @@ class ToggleZenMode extends Action {
}
}
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleZenMode, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_Z) }), 'View: Toggle Zen Mode', viewCategory);
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleZenMode, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_Z) }), 'View: Toggle Zen Mode', viewCategory.value);
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '1_toggle_view',
@@ -458,7 +446,7 @@ export class ToggleMenuBarAction extends Action {
}
if (isWindows || isLinux || isWeb) {
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleMenuBarAction), 'View: Toggle Menu Bar', viewCategory);
registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleMenuBarAction), 'View: Toggle Menu Bar', viewCategory.value);
}
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
@@ -508,7 +496,7 @@ export class ResetViewLocationsAction extends Action {
}
}
registry.registerWorkbenchAction(SyncActionDescriptor.from(ResetViewLocationsAction), 'View: Reset View Locations', viewCategory);
registry.registerWorkbenchAction(SyncActionDescriptor.from(ResetViewLocationsAction), 'View: Reset View Locations', viewCategory.value);
// --- Toggle View with Command
export abstract class ToggleViewAction extends Action {
@@ -650,7 +638,7 @@ export class MoveViewAction extends Action {
}
}
registry.registerWorkbenchAction(SyncActionDescriptor.from(MoveViewAction), 'View: Move View', viewCategory);
registry.registerWorkbenchAction(SyncActionDescriptor.from(MoveViewAction), 'View: Move View', viewCategory.value);
// --- Move Focused View with Command
export class MoveFocusedViewAction extends Action {
@@ -773,7 +761,7 @@ export class MoveFocusedViewAction extends Action {
}
}
registry.registerWorkbenchAction(SyncActionDescriptor.from(MoveFocusedViewAction), 'View: Move Focused View', viewCategory, FocusedViewContext.notEqualsTo(''));
registry.registerWorkbenchAction(SyncActionDescriptor.from(MoveFocusedViewAction), 'View: Move Focused View', viewCategory.value, FocusedViewContext.notEqualsTo(''));
// --- Reset View Location with Command
@@ -816,7 +804,7 @@ export class ResetFocusedViewLocationAction extends Action {
}
}
registry.registerWorkbenchAction(SyncActionDescriptor.from(ResetFocusedViewLocationAction), 'View: Reset Focused View Location', viewCategory, FocusedViewContext.notEqualsTo(''));
registry.registerWorkbenchAction(SyncActionDescriptor.from(ResetFocusedViewLocationAction), 'View: Reset Focused View Location', viewCategory.value, FocusedViewContext.notEqualsTo(''));
// --- Resize View
@@ -890,5 +878,5 @@ export class DecreaseViewSizeAction extends BaseResizeViewAction {
}
}
registry.registerWorkbenchAction(SyncActionDescriptor.from(IncreaseViewSizeAction, undefined), 'View: Increase Current View Size', viewCategory);
registry.registerWorkbenchAction(SyncActionDescriptor.from(DecreaseViewSizeAction, undefined), 'View: Decrease Current View Size', viewCategory);
registry.registerWorkbenchAction(SyncActionDescriptor.from(IncreaseViewSizeAction, undefined), 'View: Increase Current View Size', viewCategory.value);
registry.registerWorkbenchAction(SyncActionDescriptor.from(DecreaseViewSizeAction, undefined), 'View: Decrease Current View Size', viewCategory.value);

View File

@@ -573,7 +573,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
// Which element should be considered to start selecting all?
let start: unknown | undefined = undefined;
if (focus.length > 0 && (selection.length === 0 || selection.indexOf(focus[0]) === -1)) {
if (focus.length > 0 && (selection.length === 0 || !selection.includes(focus[0]))) {
start = focus[0];
}

View File

@@ -4,15 +4,12 @@
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { Registry } from 'vs/platform/registry/common/platform';
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { MenuRegistry, MenuId, Action2, registerAction2, ILocalizedString } from 'vs/platform/actions/common/actions';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { KeybindingsRegistry, KeybindingWeight, IKeybindingRule } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { IQuickInputService, ItemActivation } from 'vs/platform/quickinput/common/quickInput';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { Action } from 'vs/base/common/actions';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { inQuickPickContext, defaultQuickAccessContext, getQuickNavigateHandler } from 'vs/workbench/browser/quickaccess';
@@ -161,91 +158,82 @@ CommandsRegistry.registerCommand('workbench.action.quickOpenPreviousEditor', asy
//#region Workbench actions
export class BaseQuickAccessNavigateAction extends Action {
class BaseQuickAccessNavigateAction extends Action2 {
constructor(
id: string,
label: string,
private id: string,
title: ILocalizedString,
private next: boolean,
private quickNavigate: boolean,
@IQuickInputService private readonly quickInputService: IQuickInputService,
@IKeybindingService private readonly keybindingService: IKeybindingService
keybinding?: Omit<IKeybindingRule, 'id'>
) {
super(id, label);
super({ id, title, f1: true, keybinding });
}
async run(): Promise<void> {
const keys = this.keybindingService.lookupKeybindings(this.id);
async run(accessor: ServicesAccessor): Promise<void> {
const keybindingService = accessor.get(IKeybindingService);
const quickInputService = accessor.get(IQuickInputService);
const keys = keybindingService.lookupKeybindings(this.id);
const quickNavigate = this.quickNavigate ? { keybindings: keys } : undefined;
this.quickInputService.navigate(this.next, quickNavigate);
quickInputService.navigate(this.next, quickNavigate);
}
}
export class QuickAccessNavigateNextAction extends BaseQuickAccessNavigateAction {
class QuickAccessNavigateNextAction extends BaseQuickAccessNavigateAction {
static readonly ID = 'workbench.action.quickOpenNavigateNext';
static readonly LABEL = localize('quickNavigateNext', "Navigate Next in Quick Open");
constructor(
id: string,
label: string,
@IQuickInputService quickInputService: IQuickInputService,
@IKeybindingService keybindingService: IKeybindingService
) {
super(id, label, true, true, quickInputService, keybindingService);
constructor() {
super('workbench.action.quickOpenNavigateNext', { value: localize('quickNavigateNext', "Navigate Next in Quick Open"), original: 'Navigate Next in Quick Open' }, true, true);
}
}
class QuickAccessNavigatePreviousAction extends BaseQuickAccessNavigateAction {
static readonly ID = 'workbench.action.quickOpenNavigatePrevious';
static readonly LABEL = localize('quickNavigatePrevious', "Navigate Previous in Quick Open");
constructor(
id: string,
label: string,
@IQuickInputService quickInputService: IQuickInputService,
@IKeybindingService keybindingService: IKeybindingService
) {
super(id, label, false, true, quickInputService, keybindingService);
constructor() {
super('workbench.action.quickOpenNavigatePrevious', { value: localize('quickNavigatePrevious', "Navigate Previous in Quick Open"), original: 'Navigate Previous in Quick Open' }, false, true);
}
}
class QuickAccessSelectNextAction extends BaseQuickAccessNavigateAction {
static readonly ID = 'workbench.action.quickOpenSelectNext';
static readonly LABEL = localize('quickSelectNext', "Select Next in Quick Open");
constructor(
id: string,
label: string,
@IQuickInputService quickInputService: IQuickInputService,
@IKeybindingService keybindingService: IKeybindingService
) {
super(id, label, true, false, quickInputService, keybindingService);
constructor() {
super(
'workbench.action.quickOpenSelectNext',
{ value: localize('quickSelectNext', "Select Next in Quick Open"), original: 'Select Next in Quick Open' },
true,
false,
{
weight: KeybindingWeight.WorkbenchContrib + 50,
when: inQuickPickContext,
primary: 0,
mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_N }
}
);
}
}
class QuickAccessSelectPreviousAction extends BaseQuickAccessNavigateAction {
static readonly ID = 'workbench.action.quickOpenSelectPrevious';
static readonly LABEL = localize('quickSelectPrevious', "Select Previous in Quick Open");
constructor(
id: string,
label: string,
@IQuickInputService quickInputService: IQuickInputService,
@IKeybindingService keybindingService: IKeybindingService
) {
super(id, label, false, false, quickInputService, keybindingService);
constructor() {
super(
'workbench.action.quickOpenSelectPrevious',
{ value: localize('quickSelectPrevious', "Select Previous in Quick Open"), original: 'Select Previous in Quick Open' },
false,
false,
{
weight: KeybindingWeight.WorkbenchContrib + 50,
when: inQuickPickContext,
primary: 0,
mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_P }
}
);
}
}
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
registry.registerWorkbenchAction(SyncActionDescriptor.from(QuickAccessSelectNextAction, { primary: 0, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_N } }, inQuickPickContext, KeybindingWeight.WorkbenchContrib + 50), 'Select Next in Quick Open');
registry.registerWorkbenchAction(SyncActionDescriptor.from(QuickAccessSelectPreviousAction, { primary: 0, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_P } }, inQuickPickContext, KeybindingWeight.WorkbenchContrib + 50), 'Select Previous in Quick Open');
registry.registerWorkbenchAction(SyncActionDescriptor.from(QuickAccessNavigateNextAction), 'Navigate Next in Quick Open');
registry.registerWorkbenchAction(SyncActionDescriptor.from(QuickAccessNavigatePreviousAction), 'Navigate Previous in Quick Open');
registerAction2(QuickAccessSelectNextAction);
registerAction2(QuickAccessSelectPreviousAction);
registerAction2(QuickAccessNavigateNextAction);
registerAction2(QuickAccessNavigatePreviousAction);
//#endregion

View File

@@ -210,7 +210,7 @@ export class WorkbenchContextKeysHandler extends Disposable {
this.activeEditorContext.set(activeEditorPane.getId());
this.activeEditorIsReadonly.set(activeEditorPane.input.isReadonly());
const editors = activeEditorPane.input.resource ? this.editorService.getEditorOverrides(activeEditorPane.input.resource, undefined, activeGroup, undefined) : [];
const editors = activeEditorPane.input.resource ? this.editorService.getEditorOverrides(activeEditorPane.input.resource, undefined, activeGroup) : [];
this.activeEditorAvailableEditorIds.set(editors.map(([_, entry]) => entry.id).join(','));
} else {
this.activeEditorContext.reset();

View File

@@ -36,13 +36,13 @@ export interface IDraggedResource {
isExternal: boolean;
}
interface ISerializedDraggedResource {
resource: string;
}
export class DraggedEditorIdentifier {
constructor(private _identifier: IEditorIdentifier) { }
get identifier(): IEditorIdentifier {
return this._identifier;
}
constructor(public readonly identifier: IEditorIdentifier) { }
}
export class DraggedEditorGroupIdentifier {
@@ -50,20 +50,16 @@ export class DraggedEditorGroupIdentifier {
constructor(public readonly identifier: GroupIdentifier) { }
}
export interface IDraggedEditor extends IDraggedResource {
content?: string;
interface IDraggedEditorProps {
dirtyContent?: string;
encoding?: string;
mode?: string;
options?: ITextEditorOptions;
}
export interface ISerializedDraggedEditor {
resource: string;
content?: string;
encoding?: string;
mode?: string;
options?: ITextEditorOptions;
}
export interface IDraggedEditor extends IDraggedResource, IDraggedEditorProps { }
export interface ISerializedDraggedEditor extends ISerializedDraggedResource, IDraggedEditorProps { }
export const CodeDataTransfers = {
EDITORS: 'CodeEditors',
@@ -85,7 +81,7 @@ export function extractResources(e: DragEvent, externalOnly?: boolean): Array<ID
draggedEditors.forEach(draggedEditor => {
resources.push({
resource: URI.parse(draggedEditor.resource),
content: draggedEditor.content,
dirtyContent: draggedEditor.dirtyContent,
options: draggedEditor.options,
encoding: draggedEditor.encoding,
mode: draggedEditor.mode,
@@ -182,13 +178,12 @@ export class ResourcesDropHandler {
// Check for special things being dropped
const isWorkspaceOpening = await this.doHandleDrop(untitledOrFileResources);
if (isWorkspaceOpening) {
return; // return early if the drop operation resulted in this window changing to a workspace
}
// Add external ones to recently open list unless dropped resource is a workspace
const recentFiles: IRecentFile[] = untitledOrFileResources.filter(d => d.isExternal && d.resource.scheme === Schemas.file).map(d => ({ fileUri: d.resource }));
const recentFiles: IRecentFile[] = untitledOrFileResources.filter(untitledOrFileResource => untitledOrFileResource.isExternal && untitledOrFileResource.resource.scheme === Schemas.file).map(d => ({ fileUri: d.resource }));
if (recentFiles.length) {
this.workspacesService.addRecentlyOpened(recentFiles);
}
@@ -215,15 +210,15 @@ export class ResourcesDropHandler {
private async doHandleDrop(untitledOrFileResources: Array<IDraggedResource | IDraggedEditor>): Promise<boolean> {
// Check for dirty editors being dropped
const resourcesWithContent: IDraggedEditor[] = untitledOrFileResources.filter(resource => !resource.isExternal && !!(resource as IDraggedEditor).content);
if (resourcesWithContent.length > 0) {
await Promise.all(resourcesWithContent.map(resourceWithContent => this.handleDirtyEditorDrop(resourceWithContent)));
const dirtyEditors: IDraggedEditor[] = untitledOrFileResources.filter(untitledOrFileResource => !untitledOrFileResource.isExternal && typeof (untitledOrFileResource as IDraggedEditor).dirtyContent === 'string');
if (dirtyEditors.length > 0) {
await Promise.all(dirtyEditors.map(dirtyEditor => this.handleDirtyEditorDrop(dirtyEditor)));
return false;
}
// Check for workspace file being dropped if we are allowed to do so
if (this.options.allowWorkspaceOpen) {
const externalFileOnDiskResources = untitledOrFileResources.filter(d => d.isExternal && d.resource.scheme === Schemas.file).map(d => d.resource);
const externalFileOnDiskResources = untitledOrFileResources.filter(untitledOrFileResource => untitledOrFileResource.isExternal && untitledOrFileResource.resource.scheme === Schemas.file).map(d => d.resource);
if (externalFileOnDiskResources.length > 0) {
return this.handleWorkspaceFileDrop(externalFileOnDiskResources);
}
@@ -249,9 +244,9 @@ export class ResourcesDropHandler {
// If the dropped editor is dirty with content we simply take that
// content and turn it into a backup so that it loads the contents
if (droppedDirtyEditor.content) {
if (typeof droppedDirtyEditor.dirtyContent === 'string') {
try {
await this.backupFileService.backup(droppedDirtyEditor.resource, stringToSnapshot(droppedDirtyEditor.content));
await this.backupFileService.backup(droppedDirtyEditor.resource, stringToSnapshot(droppedDirtyEditor.dirtyContent));
} catch (e) {
// Ignore error
}
@@ -331,9 +326,9 @@ export function fillResourceDataTransfers(accessor: ServicesAccessor, resources:
}
// Resource URLs: allows to drop multiple resources to a target in VS Code (not directories)
const files = sources.filter(s => !s.isDirectory);
const files = sources.filter(source => !source.isDirectory);
if (files.length) {
event.dataTransfer.setData(DataTransfers.RESOURCES, JSON.stringify(files.map(f => f.resource.toString())));
event.dataTransfer.setData(DataTransfers.RESOURCES, JSON.stringify(files.map(file => file.resource.toString())));
}
// Editors: enables cross window DND of tabs into the editor area
@@ -380,13 +375,13 @@ export function fillResourceDataTransfers(accessor: ServicesAccessor, resources:
// If the resource is dirty or untitled, send over its content
// to restore dirty state. Get that from the text model directly
let content: string | undefined = undefined;
let dirtyContent: string | undefined = undefined;
if (model?.isDirty()) {
content = model.textEditorModel.getValue();
dirtyContent = model.textEditorModel.getValue();
}
// Add as dragged editor
draggedEditors.push({ resource: file.resource.toString(), content, options, encoding, mode });
draggedEditors.push({ resource: file.resource.toString(), dirtyContent, options, encoding, mode });
});
if (draggedEditors.length) {

View File

@@ -1761,11 +1761,10 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
const workbenchDimensions = this.getClientArea();
const width = this.storageService.getNumber(Storage.GRID_WIDTH, StorageScope.GLOBAL, workbenchDimensions.width);
const height = this.storageService.getNumber(Storage.GRID_HEIGHT, StorageScope.GLOBAL, workbenchDimensions.height);
// At some point, we will not fall back to old keys from legacy layout, but for now, let's migrate the keys
const sideBarSize = this.storageService.getNumber(Storage.SIDEBAR_SIZE, StorageScope.GLOBAL, this.storageService.getNumber('workbench.sidebar.width', StorageScope.GLOBAL, Math.min(workbenchDimensions.width / 4, 300)));
const sideBarSize = this.storageService.getNumber(Storage.SIDEBAR_SIZE, StorageScope.GLOBAL, Math.min(workbenchDimensions.width / 4, 300));
const panelDimension = positionFromString(this.storageService.get(Storage.PANEL_DIMENSION, StorageScope.GLOBAL, 'bottom'));
const fallbackPanelSize = this.state.panel.position === Position.BOTTOM ? workbenchDimensions.height / 3 : workbenchDimensions.width / 4;
const panelSize = panelDimension === this.state.panel.position ? this.storageService.getNumber(Storage.PANEL_SIZE, StorageScope.GLOBAL, this.storageService.getNumber(this.state.panel.position === Position.BOTTOM ? 'workbench.panel.height' : 'workbench.panel.width', StorageScope.GLOBAL, fallbackPanelSize)) : fallbackPanelSize;
const panelSize = panelDimension === this.state.panel.position ? this.storageService.getNumber(Storage.PANEL_SIZE, StorageScope.GLOBAL, fallbackPanelSize) : fallbackPanelSize;
const titleBarHeight = this.titleBarPartView.minimumHeight;
const statusBarHeight = this.statusBarPartView.minimumHeight;

View File

@@ -26,13 +26,13 @@ import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/bro
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { createAndFillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { Codicon } from 'vs/base/common/codicons';
import { ActionViewItem, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { isMacintosh } from 'vs/base/common/platform';
import { ContextSubMenu } from 'vs/base/browser/contextmenu';
import { IAuthenticationService } from 'vs/workbench/services/authentication/browser/authenticationService';
import { distinct } from 'vs/base/common/arrays';
import { AuthenticationSession } from 'vs/editor/common/modes';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
export class ViewContainerActivityAction extends ActivityAction {
@@ -106,7 +106,8 @@ export class AccountsActionViewItem extends ActivityActionViewItem {
@IContextMenuService protected contextMenuService: IContextMenuService,
@IMenuService protected menuService: IMenuService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IAuthenticationService private readonly authenticationService: IAuthenticationService
@IAuthenticationService private readonly authenticationService: IAuthenticationService,
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService
) {
super(action, { draggable: false, colors, icon: true }, themeService);
}
@@ -141,32 +142,43 @@ export class AccountsActionViewItem extends ActivityActionViewItem {
const providers = this.authenticationService.getProviderIds();
const allSessions = providers.map(async id => {
const sessions = await this.authenticationService.getSessions(id);
const uniqueSessions = distinct(sessions, session => session.account.displayName);
const groupedSessions: { [label: string]: AuthenticationSession[] } = {};
sessions.forEach(session => {
if (groupedSessions[session.account.label]) {
groupedSessions[session.account.label].push(session);
} else {
groupedSessions[session.account.label] = [session];
}
});
return {
providerId: id,
sessions: uniqueSessions
sessions: groupedSessions
};
});
const result = await Promise.all(allSessions);
let menus: (IAction | ContextSubMenu)[] = [];
result.forEach(sessionInfo => {
const providerDisplayName = this.authenticationService.getDisplayName(sessionInfo.providerId);
sessionInfo.sessions.forEach(session => {
const accountName = session.account.displayName;
const menu = new ContextSubMenu(`${accountName} (${providerDisplayName})`, [
new Action(`configureSessions${accountName}`, nls.localize('manageTrustedExtensions', "Manage Trusted Extensions"), '', true, _ => {
return this.authenticationService.manageTrustedExtensionsForAccount(sessionInfo.providerId, accountName);
}),
new Action('signOut', nls.localize('signOut', "Sign Out"), '', true, _ => {
return this.authenticationService.signOutOfAccount(sessionInfo.providerId, accountName);
})
]);
const providerDisplayName = this.authenticationService.getLabel(sessionInfo.providerId);
Object.keys(sessionInfo.sessions).forEach(accountName => {
const hasEmbedderAccountSession = sessionInfo.sessions[accountName].some(session => session.id === this.environmentService.options?.authenticationSessionId);
const manageExtensionsAction = new Action(`configureSessions${accountName}`, nls.localize('manageTrustedExtensions', "Manage Trusted Extensions"), '', true, _ => {
return this.authenticationService.manageTrustedExtensionsForAccount(sessionInfo.providerId, accountName);
});
const signOutAction = new Action('signOut', nls.localize('signOut', "Sign Out"), '', true, _ => {
return this.authenticationService.signOutOfAccount(sessionInfo.providerId, accountName);
});
const actions = hasEmbedderAccountSession ? [manageExtensionsAction] : [manageExtensionsAction, signOutAction];
const menu = new ContextSubMenu(`${accountName} (${providerDisplayName})`, actions);
menus.push(menu);
});
});
if (menus.length) {
if (menus.length && otherCommands.length) {
menus.push(new Separator());
}
@@ -370,25 +382,6 @@ export class HomeActionViewItem extends ActionViewItem {
}
}
/**
* @deprecated TODO@ben remove me eventually
*/
export class DeprecatedHomeAction extends Action {
constructor(
private readonly command: string,
name: string,
icon: Codicon,
@ICommandService private readonly commandService: ICommandService
) {
super('workbench.action.home', name, icon.classNames);
}
async run(): Promise<void> {
this.commandService.executeCommand(this.command);
}
}
registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) => {
const activityBarBackgroundColor = theme.getColor(ACTIVITY_BAR_BACKGROUND);
if (activityBarBackgroundColor) {

View File

@@ -8,7 +8,7 @@ import * as nls from 'vs/nls';
import { ActionsOrientation, ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { GLOBAL_ACTIVITY_ID, IActivity, ACCOUNTS_ACTIIVTY_ID } from 'vs/workbench/common/activity';
import { Part } from 'vs/workbench/browser/part';
import { GlobalActivityActionViewItem, ViewContainerActivityAction, PlaceHolderToggleCompositePinnedAction, PlaceHolderViewContainerActivityAction, HomeAction, HomeActionViewItem, DeprecatedHomeAction } from 'vs/workbench/browser/parts/activitybar/activitybarActions';
import { GlobalActivityActionViewItem, ViewContainerActivityAction, PlaceHolderToggleCompositePinnedAction, PlaceHolderViewContainerActivityAction, HomeAction, HomeActionViewItem } from 'vs/workbench/browser/parts/activitybar/activitybarActions';
import { AccountsActionViewItem } from 'sql/workbench/browser/parts/activitybar/activitybarActions'; // {{ SQL CARBON EDIT }} - use the ADS account management action
import { IBadge, NumberBadge } from 'vs/workbench/services/activity/common/activity';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
@@ -19,7 +19,7 @@ import { IThemeService, IColorTheme } from 'vs/platform/theme/common/themeServic
import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER, ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_BADGE_BACKGROUND, ACTIVITY_BAR_BADGE_FOREGROUND, ACTIVITY_BAR_INACTIVE_FOREGROUND, ACTIVITY_BAR_ACTIVE_BACKGROUND, ACTIVITY_BAR_DRAG_AND_DROP_BORDER } from 'vs/workbench/common/theme';
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
import { CompositeBar, ICompositeBarItem, CompositeDragAndDrop } from 'vs/workbench/browser/parts/compositeBar';
import { Dimension, addClass, removeNode, createCSSRule, asCSSUrl, toggleClass } from 'vs/base/browser/dom';
import { Dimension, addClass, removeNode, createCSSRule, asCSSUrl, toggleClass, addDisposableListener, EventType } from 'vs/base/browser/dom';
import { IStorageService, StorageScope, IWorkspaceStorageChangeEvent } from 'vs/platform/storage/common/storage';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { URI, UriComponents } from 'vs/base/common/uri';
@@ -40,6 +40,8 @@ import { Before2D } from 'vs/workbench/browser/dnd';
import { Codicon, iconRegistry } from 'vs/base/common/codicons';
import { Action } from 'vs/base/common/actions';
import { Event } from 'vs/base/common/event';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode } from 'vs/base/common/keyCodes';
interface IPlaceholderViewContainer {
id: string;
@@ -93,16 +95,20 @@ export class ActivitybarPart extends Part implements IActivityBarService {
private menuBarContainer: HTMLElement | undefined;
private compositeBar: CompositeBar;
private compositeBarContainer: HTMLElement | undefined;
private globalActivityAction: ActivityAction | undefined;
private globalActivityActionBar: ActionBar | undefined;
private readonly globalActivity: ICompositeActivity[] = [];
private globalActivitiesContainer: HTMLElement | undefined;
private accountsActivityAction: ActivityAction | undefined;
private readonly compositeActions = new Map<string, { activityAction: ViewContainerActivityAction, pinnedAction: ToggleCompositePinnedAction }>();
private readonly viewContainerDisposables = new Map<string, IDisposable>();
private readonly keyboardNavigationDisposables = new DisposableStore();
private readonly location = ViewContainerLocation.Sidebar;
constructor(
@@ -137,6 +143,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
this.compositeBar = this._register(this.instantiationService.createInstance(CompositeBar, cachedItems, {
icon: true,
orientation: ActionsOrientation.VERTICAL,
preventLoopNavigation: true,
openComposite: (compositeId: string) => this.viewsService.openViewContainer(compositeId, true),
getActivityAction: (compositeId: string) => this.getCompositeActions(compositeId).activityAction,
getCompositePinnedAction: (compositeId: string) => this.getCompositeActions(compositeId).pinnedAction,
@@ -145,18 +152,27 @@ export class ActivitybarPart extends Part implements IActivityBarService {
const menuBarVisibility = getMenuBarVisibility(this.configurationService, this.environmentService);
const actions = [];
if (this.homeBarContainer) {
actions.push(new Action('toggleHomeBarAction',
actions.push(new Action(
'toggleHomeBarAction',
this.homeBarVisibilityPreference ? nls.localize('hideHomeBar', "Hide Home Button") : nls.localize('showHomeBar', "Show Home Button"),
undefined,
true,
async () => { this.homeBarVisibilityPreference = !this.homeBarVisibilityPreference; }));
async () => { this.homeBarVisibilityPreference = !this.homeBarVisibilityPreference; }
));
}
if (menuBarVisibility === 'compact' || (menuBarVisibility === 'hidden' && isWeb)) {
actions.push(this.instantiationService.createInstance(ToggleMenuBarAction, ToggleMenuBarAction.ID, menuBarVisibility === 'compact' ? nls.localize('hideMenu', "Hide Menu") : nls.localize('showMenu', "Show Menu")));
}
actions.push(this.instantiationService.createInstance(ToggleActivityBarVisibilityAction, ToggleActivityBarVisibilityAction.ID, nls.localize('hideActivitBar', "Hide Activity Bar")));
actions.push(new Action(
ToggleActivityBarVisibilityAction.ID,
nls.localize('hideActivitBar', "Hide Activity Bar"),
undefined,
true,
async () => { this.instantiationService.invokeFunction(accessor => new ToggleActivityBarVisibilityAction().run(accessor)); }
));
return actions;
},
getContextMenuActionsForComposite: compositeId => this.getContextMenuActionsForComposite(compositeId),
@@ -367,10 +383,13 @@ export class ActivitybarPart extends Part implements IActivityBarService {
private uninstallMenubar() {
if (this.menuBar) {
this.menuBar.dispose();
this.menuBar = undefined;
}
if (this.menuBarContainer) {
removeNode(this.menuBarContainer);
this.menuBarContainer = undefined;
this.registerKeyboardNavigationListeners();
}
}
@@ -384,6 +403,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {
// Menubar: install a custom menu bar depending on configuration
this.menuBar = this._register(this.instantiationService.createInstance(CustomMenubarControl));
this.menuBar.create(this.menuBarContainer);
this.registerKeyboardNavigationListeners();
}
createContentArea(parent: HTMLElement): HTMLElement {
@@ -401,7 +422,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {
console.warn(`Unknown home indicator icon ${homeIndicator.icon}`);
codicon = Codicon.code;
}
this.createHomeBar(homeIndicator.href, homeIndicator.command, homeIndicator.title, codicon);
this.createHomeBar(homeIndicator.href, homeIndicator.title, codicon);
this.onDidChangeHomeBarVisibility();
}
@@ -411,19 +433,88 @@ export class ActivitybarPart extends Part implements IActivityBarService {
}
// View Containers action bar
this.compositeBar.create(this.content);
this.compositeBarContainer = this.compositeBar.create(this.content);
// Global action bar
const globalActivities = document.createElement('div');
addClass(globalActivities, 'global-activity');
this.content.appendChild(globalActivities);
this.globalActivitiesContainer = document.createElement('div');
addClass(this.globalActivitiesContainer, 'global-activity');
this.content.appendChild(this.globalActivitiesContainer);
this.createGlobalActivityActionBar(globalActivities);
this.createGlobalActivityActionBar(this.globalActivitiesContainer);
this.registerKeyboardNavigationListeners();
return this.content;
}
private createHomeBar(href: string, command: string | undefined, title: string, icon: Codicon): void {
private registerKeyboardNavigationListeners(): void {
this.keyboardNavigationDisposables.clear();
// Down arrow on home indicator
if (this.homeBarContainer) {
this.keyboardNavigationDisposables.add(addDisposableListener(this.homeBarContainer, EventType.KEY_DOWN, e => {
const kbEvent = new StandardKeyboardEvent(e);
if (kbEvent.equals(KeyCode.DownArrow)) {
if (this.menuBar) {
this.menuBar.toggleFocus();
} else if (this.compositeBar) {
this.compositeBar.focus();
}
}
}));
}
// Up/Down arrow on compact menu
if (this.menuBarContainer) {
this.keyboardNavigationDisposables.add(addDisposableListener(this.menuBarContainer, EventType.KEY_DOWN, e => {
const kbEvent = new StandardKeyboardEvent(e);
if (kbEvent.equals(KeyCode.DownArrow)) {
if (this.compositeBar) {
this.compositeBar.focus();
}
} else if (kbEvent.equals(KeyCode.UpArrow)) {
if (this.homeBar) {
this.homeBar.focus();
}
}
}));
}
// Up/Down on Activity Icons
if (this.compositeBarContainer) {
this.keyboardNavigationDisposables.add(addDisposableListener(this.compositeBarContainer, EventType.KEY_DOWN, e => {
const kbEvent = new StandardKeyboardEvent(e);
if (kbEvent.equals(KeyCode.DownArrow)) {
if (this.globalActivityActionBar) {
this.globalActivityActionBar.focus(true);
}
} else if (kbEvent.equals(KeyCode.UpArrow)) {
if (this.menuBar) {
this.menuBar.toggleFocus();
} else if (this.homeBar) {
this.homeBar.focus();
}
}
}));
}
// Up arrow on global icons
if (this.globalActivitiesContainer) {
this.keyboardNavigationDisposables.add(addDisposableListener(this.globalActivitiesContainer, EventType.KEY_DOWN, e => {
const kbEvent = new StandardKeyboardEvent(e);
if (kbEvent.equals(KeyCode.UpArrow)) {
if (this.compositeBar) {
this.compositeBar.focus(this.getVisibleViewContainerIds().length - 1);
}
}
}));
}
}
private createHomeBar(href: string, title: string, icon: Codicon): void {
this.homeBarContainer = document.createElement('div');
this.homeBarContainer.setAttribute('aria-label', nls.localize('homeIndicator', "Home"));
this.homeBarContainer.setAttribute('role', 'toolbar');
@@ -433,19 +524,15 @@ export class ActivitybarPart extends Part implements IActivityBarService {
orientation: ActionsOrientation.VERTICAL,
animated: false,
ariaLabel: nls.localize('home', "Home"),
actionViewItemProvider: command ? undefined : action => new HomeActionViewItem(action),
allowContextMenu: true
actionViewItemProvider: action => new HomeActionViewItem(action),
allowContextMenu: true,
preventLoopNavigation: true
}));
const homeBarIconBadge = document.createElement('div');
addClass(homeBarIconBadge, 'home-bar-icon-badge');
this.homeBarContainer.appendChild(homeBarIconBadge);
if (command) {
this.homeBar.push(this._register(this.instantiationService.createInstance(DeprecatedHomeAction, command, title, icon)), { icon: true, label: false });
} else {
this.homeBar.push(this._register(this.instantiationService.createInstance(HomeAction, href, title, icon)));
}
this.homeBar.push(this._register(this.instantiationService.createInstance(HomeAction, href, title, icon)));
const content = assertIsDefined(this.content);
content.prepend(this.homeBarContainer);
@@ -491,7 +578,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {
},
orientation: ActionsOrientation.VERTICAL,
ariaLabel: nls.localize('manage', "Manage"),
animated: false
animated: false,
preventLoopNavigation: true
}));
this.globalActivityAction = new ActivityAction({

View File

@@ -146,6 +146,7 @@ export interface ICompositeBarOptions {
readonly compositeSize: number;
readonly overflowActionSize: number;
readonly dndHandler: ICompositeDragAndDrop;
readonly preventLoopNavigation?: boolean;
getActivityAction: (compositeId: string) => ActivityAction;
getCompositePinnedAction: (compositeId: string) => Action;
@@ -225,6 +226,7 @@ export class CompositeBar extends Widget implements ICompositeBar {
orientation: this.options.orientation,
ariaLabel: nls.localize('activityBarAriaLabel', "Active View Switcher"),
animated: false,
preventLoopNavigation: this.options.preventLoopNavigation
}));
// Contextmenu for composites
@@ -293,9 +295,9 @@ export class CompositeBar extends Widget implements ICompositeBar {
return { verticallyBefore: front, horizontallyBefore: front };
}
focus(): void {
focus(index?: number): void {
if (this.compositeSwitcherBar) {
this.compositeSwitcherBar.focus();
this.compositeSwitcherBar.focus(index);
}
}
@@ -418,7 +420,7 @@ export class CompositeBar extends Widget implements ICompositeBar {
// Case: we closed the last visible composite
// Solv: we hide the part
else if (this.visibleComposites.length === 1) {
else if (this.visibleComposites.length === 0) {
this.options.hidePart();
}
@@ -553,7 +555,7 @@ export class CompositeBar extends Widget implements ICompositeBar {
// Pull out composites that overflow or got hidden
const compositesToRemove: number[] = [];
this.visibleComposites.forEach((compositeId, index) => {
if (compositesToShow.indexOf(compositeId) === -1) {
if (!compositesToShow.includes(compositeId)) {
compositesToRemove.push(index);
}
});
@@ -614,8 +616,8 @@ export class CompositeBar extends Widget implements ICompositeBar {
overflowingIds.push(this.model.activeItem.id);
}
overflowingIds = overflowingIds.filter(compositeId => this.visibleComposites.indexOf(compositeId) === -1);
return this.model.visibleItems.filter(c => overflowingIds.indexOf(c.id) !== -1).map(item => { return { id: item.id, name: this.getAction(item.id)?.label || item.name }; });
overflowingIds = overflowingIds.filter(compositeId => !this.visibleComposites.includes(compositeId));
return this.model.visibleItems.filter(c => overflowingIds.includes(c.id)).map(item => { return { id: item.id, name: this.getAction(item.id)?.label || item.name }; });
}
private showContextMenu(e: MouseEvent): void {

View File

@@ -8,12 +8,12 @@ import { EditorInput, EditorOptions, IEditorPane, GroupIdentifier, IEditorMement
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IEditorGroup, IEditorGroupsService, GroupsOrder } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { LRUCache, Touch } from 'vs/base/common/map';
import { URI } from 'vs/base/common/uri';
import { Event } from 'vs/base/common/event';
import { isEmptyObject } from 'vs/base/common/types';
import { isEmptyObject, isUndefinedOrNull } from 'vs/base/common/types';
import { DEFAULT_EDITOR_MIN_DIMENSIONS, DEFAULT_EDITOR_MAX_DIMENSIONS } from 'vs/workbench/browser/parts/editor/editor';
import { MementoObject } from 'vs/workbench/common/memento';
import { joinPath, IExtUri } from 'vs/base/common/resources';
@@ -227,9 +227,9 @@ export class EditorMemento<T> implements IEditorMemento<T> {
}
}
loadEditorState(group: IEditorGroup, resource: URI): T | undefined;
loadEditorState(group: IEditorGroup, editor: EditorInput): T | undefined;
loadEditorState(group: IEditorGroup, resourceOrEditor: URI | EditorInput): T | undefined {
loadEditorState(group: IEditorGroup, resource: URI, fallbackToOtherGroupState?: boolean): T | undefined;
loadEditorState(group: IEditorGroup, editor: EditorInput, fallbackToOtherGroupState?: boolean): T | undefined;
loadEditorState(group: IEditorGroup, resourceOrEditor: URI | EditorInput, fallbackToOtherGroupState?: boolean): T | undefined {
const resource = this.doGetResource(resourceOrEditor);
if (!resource || !group) {
return undefined; // we are not in a good state to load any state for a resource
@@ -239,7 +239,18 @@ export class EditorMemento<T> implements IEditorMemento<T> {
const mementoForResource = cache.get(resource.toString());
if (mementoForResource) {
return mementoForResource[group.id];
let mementoForResourceAndGroup = mementoForResource[group.id];
if (!fallbackToOtherGroupState || !isUndefinedOrNull(mementoForResourceAndGroup)) {
return mementoForResourceAndGroup;
}
// Fallback to retrieve state from the most recently active editor group as instructed
for (const group of this.editorGroupService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE)) {
mementoForResourceAndGroup = mementoForResource[group.id];
if (!isUndefinedOrNull(mementoForResourceAndGroup)) {
return mementoForResourceAndGroup;
}
}
}
return undefined;
@@ -339,7 +350,7 @@ export class EditorMemento<T> implements IEditorMemento<T> {
// cache and its is a LRU cache make a copy to ensure iteration succeeds
const entries = [...cache.entries()];
for (const [resource, mapGroupToMemento] of entries) {
Object.keys(mapGroupToMemento).forEach(group => {
for (const group of Object.keys(mapGroupToMemento)) {
const groupId: GroupIdentifier = Number(group);
if (!this.editorGroupService.getGroup(groupId)) {
delete mapGroupToMemento[groupId];
@@ -347,7 +358,7 @@ export class EditorMemento<T> implements IEditorMemento<T> {
cache.delete(resource);
}
}
});
}
}
}
}

View File

@@ -38,7 +38,7 @@ import { ResourceLabel } from 'vs/workbench/browser/labels';
import { BreadcrumbsConfig, IBreadcrumbsService } from 'vs/workbench/browser/parts/editor/breadcrumbs';
import { BreadcrumbElement, EditorBreadcrumbsModel, FileElement } from 'vs/workbench/browser/parts/editor/breadcrumbsModel';
import { BreadcrumbsPicker, createBreadcrumbsPicker } from 'vs/workbench/browser/parts/editor/breadcrumbsPicker';
import { IEditorPartOptions, toResource, SideBySideEditor } from 'vs/workbench/common/editor';
import { IEditorPartOptions, toResource, SideBySideEditor, SideBySideEditorInput, IEditorInputFactoryRegistry, Extensions } from 'vs/workbench/common/editor';
import { ACTIVE_GROUP, ACTIVE_GROUP_TYPE, IEditorService, SIDE_GROUP, SIDE_GROUP_TYPE } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@@ -49,6 +49,7 @@ import { withNullAsUndefined, withUndefinedAsNull } from 'vs/base/common/types';
import { ILabelService } from 'vs/platform/label/common/label';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
import { TextEditorSelectionRevealType } from 'vs/platform/editor/common/editor';
import { Registry } from 'vs/platform/registry/common/platform';
class Item extends BreadcrumbsItem {
@@ -248,12 +249,23 @@ export class BreadcrumbsControl {
}
}
// display uri which can be derived from file input
let fileInfoUri = uri;
let input = this._editorGroup.activeEditor;
if (input instanceof SideBySideEditorInput) {
input = input.primary;
}
if (Registry.as<IEditorInputFactoryRegistry>(Extensions.EditorInputFactories).getFileEditorInputFactory().isFileEditorInput(input)) {
fileInfoUri = input.label;
}
this.domNode.classList.toggle('hidden', false);
this._ckBreadcrumbsVisible.set(true);
this._ckBreadcrumbsPossible.set(true);
const editor = this._getActiveCodeEditor();
const model = new EditorBreadcrumbsModel(
fileInfoUri,
uri, editor,
this._configurationService,
this._textResourceConfigurationService,

View File

@@ -52,6 +52,7 @@ export class EditorBreadcrumbsModel {
readonly onDidUpdate: Event<this> = this._onDidUpdate.event;
constructor(
fileInfoUri: URI,
private readonly _uri: URI,
private readonly _editor: ICodeEditor | undefined,
@IConfigurationService private readonly _configurationService: IConfigurationService,
@@ -64,7 +65,7 @@ export class EditorBreadcrumbsModel {
this._disposables.add(this._cfgFilePath.onDidChange(_ => this._onDidUpdate.fire(this)));
this._disposables.add(this._cfgSymbolPath.onDidChange(_ => this._onDidUpdate.fire(this)));
this._fileInfo = EditorBreadcrumbsModel._initFilePathInfo(this._uri, workspaceService);
this._fileInfo = EditorBreadcrumbsModel._initFilePathInfo(fileInfoUri, workspaceService);
this._bindToEditor();
this._onDidUpdate.fire(this);
}

View File

@@ -15,7 +15,6 @@ import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/u
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { TextDiffEditor } from 'vs/workbench/browser/parts/editor/textDiffEditor';
import { SUPPORTED_ENCODINGS } from 'vs/workbench/services/textfile/common/textfiles';
import { BinaryResourceDiffEditor } from 'vs/workbench/browser/parts/editor/binaryDiffEditor';
import { ChangeEncodingAction, ChangeEOLAction, ChangeModeAction, EditorStatus } from 'vs/workbench/browser/parts/editor/editorStatus';
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
@@ -276,10 +275,7 @@ Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).regi
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
registry.registerWorkbenchAction(SyncActionDescriptor.from(ChangeModeAction, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_M) }), 'Change Language Mode');
registry.registerWorkbenchAction(SyncActionDescriptor.from(ChangeEOLAction), 'Change End of Line Sequence');
if (Object.keys(SUPPORTED_ENCODINGS).length > 1) {
registry.registerWorkbenchAction(SyncActionDescriptor.from(ChangeEncodingAction), 'Change File Encoding');
}
registry.registerWorkbenchAction(SyncActionDescriptor.from(ChangeEncodingAction), 'Change File Encoding');
// Register Editor Quick Access
const quickAccessRegistry = Registry.as<IQuickAccessRegistry>(QuickAccessExtensions.Quickaccess);
@@ -450,6 +446,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCo
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.CLOSE_EDITORS_TO_THE_RIGHT_COMMAND_ID, title: nls.localize('closeRight', "Close to the Right"), precondition: EditorGroupEditorsCountContext.notEqualsTo('1') }, group: '1_close', order: 30, when: ContextKeyExpr.has('config.workbench.editor.showTabs') });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.CLOSE_SAVED_EDITORS_COMMAND_ID, title: nls.localize('closeAllSaved', "Close Saved") }, group: '1_close', order: 40 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.CLOSE_EDITORS_IN_GROUP_COMMAND_ID, title: nls.localize('closeAll', "Close All") }, group: '1_close', order: 50 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: ReopenResourcesAction.ID, title: ReopenResourcesAction.LABEL }, group: '1_open', order: 10, when: ActiveEditorAvailableEditorIdsContext });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.KEEP_EDITOR_COMMAND_ID, title: nls.localize('keepOpen', "Keep Open"), precondition: EditorPinnedContext.toNegated() }, group: '3_preview', order: 10, when: ContextKeyExpr.has('config.workbench.editor.enablePreview') });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.PIN_EDITOR_COMMAND_ID, title: nls.localize('pin', "Pin") }, group: '3_preview', order: 20, when: ContextKeyExpr.and(EditorStickyContext.toNegated(), ContextKeyExpr.has('config.workbench.editor.showTabs')) });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.UNPIN_EDITOR_COMMAND_ID, title: nls.localize('unpin', "Unpin") }, group: '3_preview', order: 20, when: ContextKeyExpr.and(EditorStickyContext, ContextKeyExpr.has('config.workbench.editor.showTabs')) });
@@ -457,14 +454,12 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCo
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.SPLIT_EDITOR_DOWN, title: nls.localize('splitDown', "Split Down") }, group: '5_split', order: 20 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.SPLIT_EDITOR_LEFT, title: nls.localize('splitLeft', "Split Left") }, group: '5_split', order: 30 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.SPLIT_EDITOR_RIGHT, title: nls.localize('splitRight', "Split Right") }, group: '5_split', order: 40 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: ReopenResourcesAction.ID, title: ReopenResourcesAction.LABEL }, group: '6_reopen', order: 20, when: ActiveEditorAvailableEditorIdsContext });
// Editor Title Menu
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.TOGGLE_DIFF_SIDE_BY_SIDE, title: nls.localize('toggleInlineView', "Toggle Inline View") }, group: '1_diff', order: 10, when: ContextKeyExpr.has('isInDiffEditor') });
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.SHOW_EDITORS_IN_GROUP, title: nls.localize('showOpenedEditors', "Show Opened Editors") }, group: '3_open', order: 10 });
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.CLOSE_EDITORS_IN_GROUP_COMMAND_ID, title: nls.localize('closeAll', "Close All") }, group: '5_close', order: 10 });
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.CLOSE_SAVED_EDITORS_COMMAND_ID, title: nls.localize('closeAllSaved', "Close Saved") }, group: '5_close', order: 20 });
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: ReopenResourcesAction.ID, title: ReopenResourcesAction.LABEL }, group: '6_reopen', order: 20, when: ActiveEditorAvailableEditorIdsContext });
interface IEditorToolItem { id: string; title: string; icon?: { dark?: URI; light?: URI; } | ThemeIcon; }

View File

@@ -600,7 +600,7 @@ function registerCloseEditorCommands() {
.filter(context => context.groupId === groupId)
.map(context => typeof context.editorIndex === 'number' ? group.getEditorByIndex(context.editorIndex) : group.activeEditor);
const editorsToClose = group.getEditors(EditorsOrder.SEQUENTIAL, { excludeSticky: true }).filter(editor => editors.indexOf(editor) === -1);
const editorsToClose = group.getEditors(EditorsOrder.SEQUENTIAL, { excludeSticky: true }).filter(editor => !editors.includes(editor));
if (group.activeEditor) {
group.pinEditor(group.activeEditor);

View File

@@ -443,7 +443,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
// Events for groups that got added
this.getGroups(GroupsOrder.GRID_APPEARANCE).forEach(groupView => {
if (currentGroupViews.indexOf(groupView) === -1) {
if (!currentGroupViews.includes(groupView)) {
this._onDidAddGroup.fire(groupView);
}
});

View File

@@ -299,7 +299,7 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution {
private readonly screenRedearModeElement = this._register(new MutableDisposable<IStatusbarEntryAccessor>());
private readonly indentationElement = this._register(new MutableDisposable<IStatusbarEntryAccessor>());
private readonly selectionElement = this._register(new MutableDisposable<IStatusbarEntryAccessor>());
private readonly encodingElement = Object.keys(SUPPORTED_ENCODINGS).length > 1 ? this._register(new MutableDisposable<IStatusbarEntryAccessor>()) : undefined;
private readonly encodingElement = this._register(new MutableDisposable<IStatusbarEntryAccessor>());
private readonly eolElement = this._register(new MutableDisposable<IStatusbarEntryAccessor>());
private readonly modeElement = this._register(new MutableDisposable<IStatusbarEntryAccessor>());
private readonly metadataElement = this._register(new MutableDisposable<IStatusbarEntryAccessor>());
@@ -486,10 +486,6 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution {
}
private updateEncodingElement(text: string | undefined): void {
if (!this.encodingElement) {
return; // return early if encoding should not show (e.g. in Web we only support utf8)
}
if (!text) {
this.encodingElement.clear();
return;

View File

@@ -210,7 +210,16 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditorPan
// Handle diff editor specially by merging in diffEditor configuration
if (isObject(configuration.diffEditor)) {
objects.mixin(editorConfiguration, configuration.diffEditor);
// User settings defines `diffEditor.codeLens`, but there is also `editor.codeLens`.
// Due to the mixin, the two settings cannot be distinguished anymore.
//
// So we map `diffEditor.codeLens` to `diffEditor.originalCodeLens` and `diffEditor.modifiedCodeLens`.
const diffEditorConfiguration = <IDiffEditorOptions>objects.deepClone(configuration.diffEditor);
diffEditorConfiguration.originalCodeLens = diffEditorConfiguration.codeLens;
diffEditorConfiguration.modifiedCodeLens = diffEditorConfiguration.codeLens;
delete diffEditorConfiguration.codeLens;
objects.mixin(editorConfiguration, diffEditorConfiguration);
}
return editorConfiguration;

View File

@@ -224,9 +224,11 @@ export abstract class TitleControl extends Themable {
this.editorToolBarMenuDisposables.clear();
// Update contexts
this.resourceContext.set(this.group.activeEditor ? withUndefinedAsNull(toResource(this.group.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY })) : null);
this.editorPinnedContext.set(this.group.activeEditor ? this.group.isPinned(this.group.activeEditor) : false);
this.editorStickyContext.set(this.group.activeEditor ? this.group.isSticky(this.group.activeEditor) : false);
this.contextKeyService.bufferChangeEvents(() => {
this.resourceContext.set(this.group.activeEditor ? withUndefinedAsNull(toResource(this.group.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY })) : null);
this.editorPinnedContext.set(this.group.activeEditor ? this.group.isPinned(this.group.activeEditor) : false);
this.editorStickyContext.set(this.group.activeEditor ? this.group.isSticky(this.group.activeEditor) : false);
});
// Editor actions require the editor control to be there, so we retrieve it via service
const activeEditorPane = this.group.activeEditorPane;

View File

@@ -533,7 +533,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
getPinnedPanels(): readonly PanelDescriptor[] {
const pinnedCompositeIds = this.compositeBar.getPinnedComposites().map(c => c.id);
return this.getPanels()
.filter(p => pinnedCompositeIds.indexOf(p.id) !== -1)
.filter(p => pinnedCompositeIds.includes(p.id))
.sort((p1, p2) => pinnedCompositeIds.indexOf(p1.id) - pinnedCompositeIds.indexOf(p2.id));
}

View File

@@ -9,8 +9,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import { Action } from 'vs/base/common/actions';
import { CompositePart } from 'vs/workbench/browser/parts/compositePart';
import { Viewlet, ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet';
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { Action2, registerAction2 } from 'vs/platform/actions/common/actions';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { IWorkbenchLayoutService, Parts, Position as SideBarPosition } from 'vs/workbench/services/layout/browser/layoutService';
import { IViewlet, SidebarFocusContext, ActiveViewletContext } from 'vs/workbench/common/viewlet';
@@ -19,7 +18,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { Event, Emitter } from 'vs/base/common/event';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
@@ -35,6 +34,7 @@ import { LayoutPriority } from 'vs/base/browser/ui/grid/grid';
import { assertIsDefined } from 'vs/base/common/types';
import { CompositeDragAndDropObserver } from 'vs/workbench/browser/dnd';
import { IViewDescriptorService, ViewContainerLocation } from 'vs/workbench/common/views';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
export class SidebarPart extends CompositePart<Viewlet> implements IViewletService {
@@ -302,39 +302,40 @@ export class SidebarPart extends CompositePart<Viewlet> implements IViewletServi
}
}
class FocusSideBarAction extends Action {
class FocusSideBarAction extends Action2 {
static readonly ID = 'workbench.action.focusSideBar';
static readonly LABEL = nls.localize('focusSideBar', "Focus into Side Bar");
constructor(
id: string,
label: string,
@IViewletService private readonly viewletService: IViewletService,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
) {
super(id, label);
constructor() {
super({
id: 'workbench.action.focusSideBar',
title: { value: nls.localize('focusSideBar', "Focus into Side Bar"), original: 'Focus into Side Bar' },
category: { value: nls.localize('view', "View"), original: 'View' },
f1: true,
keybinding: {
weight: KeybindingWeight.WorkbenchContrib,
when: null,
primary: KeyMod.CtrlCmd | KeyCode.KEY_0
}
});
}
async run(): Promise<void> {
async run(accessor: ServicesAccessor): Promise<void> {
const layoutService = accessor.get(IWorkbenchLayoutService);
const viewletService = accessor.get(IViewletService);
// Show side bar
if (!this.layoutService.isVisible(Parts.SIDEBAR_PART)) {
this.layoutService.setSideBarHidden(false);
if (!layoutService.isVisible(Parts.SIDEBAR_PART)) {
layoutService.setSideBarHidden(false);
return;
}
// Focus into active viewlet
const viewlet = this.viewletService.getActiveViewlet();
const viewlet = viewletService.getActiveViewlet();
if (viewlet) {
viewlet.focus();
}
}
}
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
registry.registerWorkbenchAction(SyncActionDescriptor.from(FocusSideBarAction, {
primary: KeyMod.CtrlCmd | KeyCode.KEY_0
}), 'View: Focus into Side Bar', nls.localize('viewCategory', "View"));
registerAction2(FocusSideBarAction);
registerSingleton(IViewletService, SidebarPart);

View File

@@ -765,6 +765,9 @@ class StatusbarEntryItem extends Disposable {
this.container.setAttribute('aria-label', entry.ariaLabel);
this.labelContainer.setAttribute('aria-label', entry.ariaLabel);
}
if (!this.entry || entry.role !== this.entry.role) {
this.labelContainer.setAttribute('role', entry.role || 'button');
}
// Update: Tooltip (on the container, because label can be disabled)
if (!this.entry || entry.tooltip !== this.entry.tooltip) {

View File

@@ -735,4 +735,10 @@ export class CustomMenubarControl extends MenubarControl {
this.menubar?.update(this.getMenuBarOptions());
}
toggleFocus() {
if (this.menubar) {
this.menubar.toggleFocus();
}
}
}

View File

@@ -275,6 +275,11 @@ export class ViewsService extends Disposable implements IViewsService {
return viewContainerId ? this.viewDescriptorService.getViewContainerById(viewContainerId) : null;
}
getActiveViewPaneContainerWithId(viewContainerId: string): IViewPaneContainer | null {
const viewContainer = this.viewDescriptorService.getViewContainerById(viewContainerId);
return viewContainer ? this.getActiveViewPaneContainer(viewContainer) : null;
}
async openViewContainer(id: string, focus?: boolean): Promise<IPaneComposite | null> {
const viewContainer = this.viewDescriptorService.getViewContainerById(id);
if (viewContainer) {
@@ -297,9 +302,9 @@ export class ViewsService extends Disposable implements IViewsService {
const viewContainerLocation = this.viewDescriptorService.getViewContainerLocation(viewContainer);
switch (viewContainerLocation) {
case ViewContainerLocation.Panel:
return this.panelService.getActivePanel()?.getId() === id ? this.panelService.hideActivePanel() : undefined;
return this.panelService.getActivePanel()?.getId() === id ? this.layoutService.setPanelHidden(true) : undefined;
case ViewContainerLocation.Sidebar:
return this.viewletService.getActiveViewlet()?.getId() === id ? this.viewletService.hideActiveViewlet() : undefined;
return this.viewletService.getActiveViewlet()?.getId() === id ? this.layoutService.setSideBarHidden(true) : undefined;
}
}
}

View File

@@ -169,8 +169,6 @@ export class ShowViewletAction extends Action {
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
) {
super(id, name);
this.enabled = !!this.viewletService && !!this.editorGroupService;
}
async run(): Promise<void> {

View File

@@ -205,7 +205,6 @@ class BrowserMain extends Disposable {
}
private async registerFileSystemProviders(environmentService: IWorkbenchEnvironmentService, fileService: IFileService, remoteAgentService: IRemoteAgentService, logService: BufferLogService, logsPath: URI): Promise<void> {
const indexedDB = new IndexedDB();
// Logger