mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-06 09:35:41 -05:00
Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f (#7282)
* Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f * fix various icon issues * fix preview features
This commit is contained in:
@@ -19,12 +19,12 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
|
||||
import { ITitleService } from 'vs/workbench/services/title/common/titleService';
|
||||
import { IWorkbenchThemeService, VS_HC_THEME } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import * as browser from 'vs/base/browser/browser';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { ICommandService, CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { IResourceInput } from 'vs/platform/editor/common/editor';
|
||||
import { KeyboardMapperFactory } from 'vs/workbench/services/keybinding/electron-browser/nativeKeymapService';
|
||||
import { ipcRenderer as ipc, webFrame, crashReporter, Event } from 'electron';
|
||||
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
|
||||
import { IMenuService, MenuId, IMenu, MenuItemAction, ICommandAction, SubmenuItemAction } from 'vs/platform/actions/common/actions';
|
||||
import { IMenuService, MenuId, IMenu, MenuItemAction, ICommandAction, SubmenuItemAction, MenuRegistry } from 'vs/platform/actions/common/actions';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { createAndFillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
@@ -32,9 +32,8 @@ import { IDisposable, Disposable, DisposableStore } from 'vs/base/common/lifecyc
|
||||
import { LifecyclePhase, ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IIntegrityService } from 'vs/workbench/services/integrity/common/integrity';
|
||||
import { isRootUser, isWindows, isMacintosh, isLinux, isWeb } from 'vs/base/common/platform';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import pkg from 'vs/platform/product/node/package';
|
||||
import { isRootUser, isWindows, isMacintosh, isLinux } from 'vs/base/common/platform';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
@@ -56,6 +55,9 @@ import { IMenubarService, IMenubarData, IMenubarMenu, IMenubarKeybinding, IMenub
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IElectronService } from 'vs/platform/electron/node/electron';
|
||||
import { posix, dirname } from 'vs/base/common/path';
|
||||
import { getBaseLabel } from 'vs/base/common/labels';
|
||||
|
||||
const TextInputActions: IAction[] = [
|
||||
new Action('undo', nls.localize('undo', "Undo"), undefined, true, () => Promise.resolve(document.execCommand('undo'))),
|
||||
@@ -74,6 +76,8 @@ export class ElectronWindow extends Disposable {
|
||||
private readonly touchBarDisposables = this._register(new DisposableStore());
|
||||
private lastInstalledTouchedBar: ICommandAction[][] | undefined;
|
||||
|
||||
private customTitleContextMenuDisposable = this._register(new DisposableStore());
|
||||
|
||||
private previousConfiguredZoomLevel: number | undefined;
|
||||
|
||||
private addFoldersScheduler: RunOnceScheduler;
|
||||
@@ -103,7 +107,8 @@ export class ElectronWindow extends Disposable {
|
||||
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
|
||||
@ITextFileService private readonly textFileService: ITextFileService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IOpenerService private readonly openerService: IOpenerService
|
||||
@IOpenerService private readonly openerService: IOpenerService,
|
||||
@IElectronService private readonly electronService: IElectronService
|
||||
) {
|
||||
super();
|
||||
|
||||
@@ -244,6 +249,11 @@ export class ElectronWindow extends Disposable {
|
||||
|
||||
this._register(this.trackClosedWaitFiles(waitMarkerFile, resourcesToWaitFor));
|
||||
}
|
||||
|
||||
// macOS custom title menu
|
||||
if (isMacintosh) {
|
||||
this._register(this.editorService.onDidActiveEditorChange(() => this.provideCustomTitleContextMenu()));
|
||||
}
|
||||
}
|
||||
|
||||
private onDidVisibleEditorsChange(): void {
|
||||
@@ -307,6 +317,43 @@ export class ElectronWindow extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private provideCustomTitleContextMenu(): void {
|
||||
|
||||
// Clear old menu
|
||||
this.customTitleContextMenuDisposable.clear();
|
||||
|
||||
// Provide new menu if a file is opened and we are on a custom title
|
||||
const fileResource = toResource(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.MASTER, filterByScheme: Schemas.file });
|
||||
if (!fileResource || getTitleBarStyle(this.configurationService, this.environmentService) !== 'custom') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Split up filepath into segments
|
||||
const filePath = fileResource.fsPath;
|
||||
const segments = filePath.split(posix.sep);
|
||||
for (let i = segments.length; i > 0; i--) {
|
||||
const isFile = (i === segments.length);
|
||||
|
||||
let pathOffset = i;
|
||||
if (!isFile) {
|
||||
pathOffset++; // for segments which are not the file name we want to open the folder
|
||||
}
|
||||
|
||||
const path = segments.slice(0, pathOffset).join(posix.sep);
|
||||
|
||||
let label: string;
|
||||
if (!isFile) {
|
||||
label = getBaseLabel(dirname(path));
|
||||
} else {
|
||||
label = getBaseLabel(path);
|
||||
}
|
||||
|
||||
const commandId = `workbench.action.revealPathInFinder${i}`;
|
||||
this.customTitleContextMenuDisposable.add(CommandsRegistry.registerCommand(commandId, () => this.electronService.showItemInFolder(path)));
|
||||
this.customTitleContextMenuDisposable.add(MenuRegistry.appendMenuItem(MenuId.TitleBarContext, { command: { id: commandId, title: label || posix.sep }, order: -i }));
|
||||
}
|
||||
}
|
||||
|
||||
private create(): void {
|
||||
|
||||
// Native menu controller
|
||||
@@ -372,7 +419,7 @@ export class ElectronWindow extends Disposable {
|
||||
const success = await $this.windowsService.openExternal(encodeURI(resource.toString(true)));
|
||||
if (!success && resource.scheme === Schemas.file) {
|
||||
// if opening failed, and this is a file, we can still try to reveal it
|
||||
await $this.windowsService.showItemInFolder(resource);
|
||||
await $this.electronService.showItemInFolder(resource.fsPath);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -460,7 +507,7 @@ export class ElectronWindow extends Disposable {
|
||||
productName,
|
||||
submitURL: isWindows ? hockeyAppConfig[process.arch === 'ia32' ? 'win32-ia32' : 'win32-x64'] : isLinux ? hockeyAppConfig[`linux-x64`] : hockeyAppConfig.darwin,
|
||||
extra: {
|
||||
vscode_version: pkg.version,
|
||||
vscode_version: product.version,
|
||||
vscode_commit: product.commit
|
||||
}
|
||||
};
|
||||
@@ -615,7 +662,7 @@ class NativeMenubarControl extends MenubarControl {
|
||||
environmentService,
|
||||
accessibilityService);
|
||||
|
||||
if (isMacintosh && !isWeb) {
|
||||
if (isMacintosh) {
|
||||
this.menus['Preferences'] = this._register(this.menuService.createMenu(MenuId.MenubarPreferencesMenu, this.contextKeyService));
|
||||
this.topLevelTitles['Preferences'] = nls.localize('mPreferences', "Preferences");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user