mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 11:08:31 -05:00
Vscode merge (#4582)
* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd * fix issues with merges * bump node version in azpipe * replace license headers * remove duplicate launch task * fix build errors * fix build errors * fix tslint issues * working through package and linux build issues * more work * wip * fix packaged builds * working through linux build errors * wip * wip * wip * fix mac and linux file limits * iterate linux pipeline * disable editor typing * revert series to parallel * remove optimize vscode from linux * fix linting issues * revert testing change * add work round for new node * readd packaging for extensions * fix issue with angular not resolving decorator dependencies
This commit is contained in:
@@ -117,7 +117,6 @@
|
||||
/* Context Menu */
|
||||
|
||||
.context-view.monaco-menu-container {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "Ubuntu", "Droid Sans", sans-serif;
|
||||
outline: 0;
|
||||
border: none;
|
||||
-webkit-animation: fadeIn 0.083s linear;
|
||||
@@ -182,7 +181,6 @@
|
||||
}
|
||||
|
||||
.menubar .menubar-menu-items-holder.monaco-menu-container {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "Ubuntu", "Droid Sans", sans-serif;
|
||||
outline: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as nls from 'vs/nls';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { IActionRunner, IAction, Action } from 'vs/base/common/actions';
|
||||
import { ActionBar, IActionItemProvider, ActionsOrientation, Separator, ActionItem, IActionItemOptions, BaseActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { ResolvedKeybinding, KeyCode, KeyCodeUtils } from 'vs/base/common/keyCodes';
|
||||
import { ResolvedKeybinding, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { addClass, EventType, EventHelper, EventLike, removeTabIndexAndUpdateFocus, isAncestor, hasClass, addDisposableListener, removeClass, append, $, addClasses, removeClasses } from 'vs/base/browser/dom';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
@@ -20,8 +20,22 @@ import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import { isLinux } from 'vs/base/common/platform';
|
||||
|
||||
export const MENU_MNEMONIC_REGEX: RegExp = /\(&{1,2}(.)\)|&{1,2}(.)/;
|
||||
export const MENU_ESCAPED_MNEMONIC_REGEX: RegExp = /(?:&){1,2}(.)/;
|
||||
function createMenuMnemonicRegExp() {
|
||||
try {
|
||||
return new RegExp('\\(&([^\\s&])\\)|(?<!&)&([^\\s&])');
|
||||
} catch (err) {
|
||||
return new RegExp('\uFFFF'); // never match please
|
||||
}
|
||||
}
|
||||
export const MENU_MNEMONIC_REGEX = createMenuMnemonicRegExp();
|
||||
function createMenuEscapedMnemonicRegExp() {
|
||||
try {
|
||||
return new RegExp('(?<!&)(?:&)([^\\s&])');
|
||||
} catch (err) {
|
||||
return new RegExp('\uFFFF'); // never match please
|
||||
}
|
||||
}
|
||||
export const MENU_ESCAPED_MNEMONIC_REGEX: RegExp = createMenuEscapedMnemonicRegExp();
|
||||
|
||||
export interface IMenuOptions {
|
||||
context?: any;
|
||||
@@ -56,7 +70,7 @@ interface ISubMenuData {
|
||||
}
|
||||
|
||||
export class Menu extends ActionBar {
|
||||
private mnemonics: Map<KeyCode, Array<MenuActionItem>>;
|
||||
private mnemonics: Map<string, Array<MenuActionItem>>;
|
||||
private menuDisposables: IDisposable[];
|
||||
private scrollableElement: DomScrollableElement;
|
||||
private menuElement: HTMLElement;
|
||||
@@ -93,7 +107,7 @@ export class Menu extends ActionBar {
|
||||
|
||||
if (options.enableMnemonics) {
|
||||
this.menuDisposables.push(addDisposableListener(menuElement, EventType.KEY_DOWN, (e) => {
|
||||
const key = KeyCodeUtils.fromString(e.key);
|
||||
const key = e.key.toLocaleLowerCase();
|
||||
if (this.mnemonics.has(key)) {
|
||||
EventHelper.stop(e, true);
|
||||
const actions = this.mnemonics.get(key)!;
|
||||
@@ -175,7 +189,7 @@ export class Menu extends ActionBar {
|
||||
parent: this
|
||||
};
|
||||
|
||||
this.mnemonics = new Map<KeyCode, Array<MenuActionItem>>();
|
||||
this.mnemonics = new Map<string, Array<MenuActionItem>>();
|
||||
|
||||
this.push(actions, { icon: true, label: true, isMenu: true });
|
||||
|
||||
@@ -349,7 +363,7 @@ class MenuActionItem extends BaseActionItem {
|
||||
|
||||
private label: HTMLElement;
|
||||
private check: HTMLElement;
|
||||
private mnemonic: KeyCode;
|
||||
private mnemonic: string;
|
||||
private cssClass: string;
|
||||
protected menuStyle: IMenuStyles;
|
||||
|
||||
@@ -368,7 +382,7 @@ class MenuActionItem extends BaseActionItem {
|
||||
if (label) {
|
||||
let matches = MENU_MNEMONIC_REGEX.exec(label);
|
||||
if (matches) {
|
||||
this.mnemonic = KeyCodeUtils.fromString((!!matches[1] ? matches[1] : matches[2]).toLocaleLowerCase());
|
||||
this.mnemonic = (!!matches[1] ? matches[1] : matches[2]).toLocaleLowerCase();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -440,13 +454,16 @@ class MenuActionItem extends BaseActionItem {
|
||||
label = cleanLabel;
|
||||
}
|
||||
|
||||
this.label.setAttribute('aria-label', cleanLabel);
|
||||
this.label.setAttribute('aria-label', cleanLabel.replace(/&&/g, '&'));
|
||||
|
||||
const matches = MENU_MNEMONIC_REGEX.exec(label);
|
||||
|
||||
if (matches) {
|
||||
label = strings.escape(label).replace(MENU_ESCAPED_MNEMONIC_REGEX, '<u aria-hidden="true">$1</u>');
|
||||
label = label.replace(/&&/g, '&');
|
||||
this.item.setAttribute('aria-keyshortcuts', (!!matches[1] ? matches[1] : matches[2]).toLocaleLowerCase());
|
||||
} else {
|
||||
label = label.replace(/&&/g, '&');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,7 +536,7 @@ class MenuActionItem extends BaseActionItem {
|
||||
}
|
||||
}
|
||||
|
||||
getMnemonic(): KeyCode {
|
||||
getMnemonic(): string {
|
||||
return this.mnemonic;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,15 +14,17 @@ import { cleanMnemonic, IMenuOptions, Menu, MENU_ESCAPED_MNEMONIC_REGEX, MENU_MN
|
||||
import { ActionRunner, IAction, IActionRunner } from 'vs/base/common/actions';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { KeyCode, KeyCodeUtils, ResolvedKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { KeyCode, ResolvedKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { Disposable, dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
|
||||
const $ = DOM.$;
|
||||
|
||||
export interface IMenuBarOptions {
|
||||
enableMnemonics?: boolean;
|
||||
visibility?: string;
|
||||
getKeybinding?: (action: IAction) => ResolvedKeybinding;
|
||||
getKeybinding?: (action: IAction) => ResolvedKeybinding | undefined;
|
||||
alwaysOnMnemonics?: boolean;
|
||||
}
|
||||
|
||||
export interface MenuBarMenu {
|
||||
@@ -69,14 +71,14 @@ export class MenuBar extends Disposable {
|
||||
private openedViaKeyboard: boolean;
|
||||
private awaitingAltRelease: boolean;
|
||||
private ignoreNextMouseUp: boolean;
|
||||
private mnemonics: Map<KeyCode, number>;
|
||||
private mnemonics: Map<string, number>;
|
||||
|
||||
private updatePending: boolean;
|
||||
private _focusState: MenubarState;
|
||||
private actionRunner: IActionRunner;
|
||||
|
||||
private _onVisibilityChange: Emitter<boolean>;
|
||||
private _onFocusStateChange: Emitter<boolean>;
|
||||
private readonly _onVisibilityChange: Emitter<boolean>;
|
||||
private readonly _onFocusStateChange: Emitter<boolean>;
|
||||
|
||||
private numMenusShown: number;
|
||||
private menuStyle: IMenuStyles;
|
||||
@@ -85,10 +87,10 @@ export class MenuBar extends Disposable {
|
||||
constructor(private container: HTMLElement, private options: IMenuBarOptions = {}) {
|
||||
super();
|
||||
|
||||
this.container.attributes['role'] = 'menubar';
|
||||
this.container.setAttribute('role', 'menubar');
|
||||
|
||||
this.menuCache = [];
|
||||
this.mnemonics = new Map<KeyCode, number>();
|
||||
this.mnemonics = new Map<string, number>();
|
||||
|
||||
this._focusState = MenubarState.VISIBLE;
|
||||
|
||||
@@ -109,7 +111,7 @@ export class MenuBar extends Disposable {
|
||||
this._register(DOM.addDisposableListener(this.container, DOM.EventType.KEY_DOWN, (e) => {
|
||||
let event = new StandardKeyboardEvent(e as KeyboardEvent);
|
||||
let eventHandled = true;
|
||||
const key = !!e.key ? KeyCodeUtils.fromString(e.key) : KeyCode.Unknown;
|
||||
const key = !!e.key ? e.key.toLocaleLowerCase() : '';
|
||||
|
||||
if (event.equals(KeyCode.LeftArrow)) {
|
||||
this.focusPrevious();
|
||||
@@ -150,11 +152,14 @@ export class MenuBar extends Disposable {
|
||||
this._register(DOM.addDisposableListener(this.container, DOM.EventType.FOCUS_OUT, (e) => {
|
||||
let event = e as FocusEvent;
|
||||
|
||||
if (event.relatedTarget) {
|
||||
if (!this.container.contains(event.relatedTarget as HTMLElement)) {
|
||||
this.focusToReturn = undefined;
|
||||
this.setUnfocusedState();
|
||||
}
|
||||
// We are losing focus and there is no related target, e.g. webview case
|
||||
if (!event.relatedTarget) {
|
||||
this.setUnfocusedState();
|
||||
}
|
||||
// We are losing focus and there is a target, reset focusToReturn value as not to redirect
|
||||
else if (event.relatedTarget && !this.container.contains(event.relatedTarget as HTMLElement)) {
|
||||
this.focusToReturn = undefined;
|
||||
this.setUnfocusedState();
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -163,7 +168,7 @@ export class MenuBar extends Disposable {
|
||||
return;
|
||||
}
|
||||
|
||||
const key = KeyCodeUtils.fromString(e.key);
|
||||
const key = e.key.toLocaleLowerCase();
|
||||
if (!this.mnemonics.has(key)) {
|
||||
return;
|
||||
}
|
||||
@@ -459,8 +464,8 @@ export class MenuBar extends Disposable {
|
||||
|
||||
// Update the button label to reflect mnemonics
|
||||
titleElement.innerHTML = this.options.enableMnemonics ?
|
||||
strings.escape(label).replace(MENU_ESCAPED_MNEMONIC_REGEX, '<mnemonic aria-hidden="true">$1</mnemonic>') :
|
||||
cleanMenuLabel;
|
||||
strings.escape(label).replace(MENU_ESCAPED_MNEMONIC_REGEX, '<mnemonic aria-hidden="true">$1</mnemonic>').replace(/&&/g, '&') :
|
||||
cleanMenuLabel.replace(/&&/g, '&');
|
||||
|
||||
let mnemonicMatches = MENU_MNEMONIC_REGEX.exec(label);
|
||||
|
||||
@@ -506,7 +511,7 @@ export class MenuBar extends Disposable {
|
||||
}
|
||||
|
||||
private registerMnemonic(menuIndex: number, mnemonic: string): void {
|
||||
this.mnemonics.set(KeyCodeUtils.fromString(mnemonic), menuIndex);
|
||||
this.mnemonics.set(mnemonic.toLocaleLowerCase(), menuIndex);
|
||||
}
|
||||
|
||||
private hideMenubar(): void {
|
||||
@@ -725,7 +730,7 @@ export class MenuBar extends Disposable {
|
||||
if (menuBarMenu.titleElement.children.length) {
|
||||
let child = menuBarMenu.titleElement.children.item(0) as HTMLElement;
|
||||
if (child) {
|
||||
child.style.textDecoration = visible ? 'underline' : null;
|
||||
child.style.textDecoration = (this.options.alwaysOnMnemonics || visible) ? 'underline' : null;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -852,8 +857,8 @@ export class MenuBar extends Disposable {
|
||||
let menuOptions: IMenuOptions = {
|
||||
getKeyBinding: this.options.getKeybinding,
|
||||
actionRunner: this.actionRunner,
|
||||
enableMnemonics: this.mnemonicsInUse && this.options.enableMnemonics,
|
||||
ariaLabel: customMenu.buttonElement.attributes['aria-label'].value
|
||||
enableMnemonics: this.options.alwaysOnMnemonics || (this.mnemonicsInUse && this.options.enableMnemonics),
|
||||
ariaLabel: withNullAsUndefined(customMenu.buttonElement.getAttribute('aria-label'))
|
||||
};
|
||||
|
||||
let menuWidget = this._register(new Menu(menuHolder, customMenu.actions, menuOptions));
|
||||
@@ -955,6 +960,16 @@ class ModifierKeyEmitter extends Emitter<IModifierKeyStatus> {
|
||||
this._keyStatus.lastKeyPressed = undefined;
|
||||
}));
|
||||
|
||||
this._subscriptions.push(domEvent(document.body, 'mouseup', true)(e => {
|
||||
this._keyStatus.lastKeyPressed = undefined;
|
||||
}));
|
||||
|
||||
this._subscriptions.push(domEvent(document.body, 'mousemove', true)(e => {
|
||||
if (e.buttons) {
|
||||
this._keyStatus.lastKeyPressed = undefined;
|
||||
}
|
||||
}));
|
||||
|
||||
this._subscriptions.push(domEvent(window, 'blur')(e => {
|
||||
this._keyStatus.lastKeyPressed = undefined;
|
||||
this._keyStatus.lastKeyReleased = undefined;
|
||||
|
||||
Reference in New Issue
Block a user