mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 313ede61cbad8f9dc748907b3384e059ddddb79a (#7436)
* Merge from vscode 313ede61cbad8f9dc748907b3384e059ddddb79a * fix strict null checks
This commit is contained in:
@@ -9,7 +9,7 @@ import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { IMarkdownString, parseHrefAndDimensions, removeMarkdownEscapes } from 'vs/base/common/htmlContent';
|
||||
import { defaultGenerator } from 'vs/base/common/idGenerator';
|
||||
import * as marked from 'vs/base/common/marked/marked';
|
||||
import * as insane from 'vs/base/common/insane/insane';
|
||||
import { insane } from 'vs/base/common/insane/insane';
|
||||
import { parse } from 'vs/base/common/marshalling';
|
||||
import { cloneAndChange } from 'vs/base/common/objects';
|
||||
import { escape } from 'vs/base/common/strings';
|
||||
|
||||
@@ -152,34 +152,48 @@ export class StandardWheelEvent {
|
||||
this.deltaX = deltaX;
|
||||
|
||||
if (e) {
|
||||
let e1 = <IWebKitMouseWheelEvent><any>e;
|
||||
let e2 = <IGeckoMouseWheelEvent><any>e;
|
||||
if (e.type === 'wheel') {
|
||||
|
||||
// vertical delta scroll
|
||||
if (typeof e1.wheelDeltaY !== 'undefined') {
|
||||
this.deltaY = e1.wheelDeltaY / 120;
|
||||
} else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {
|
||||
this.deltaY = -e2.detail / 3;
|
||||
} else {
|
||||
this.deltaY = -e.deltaY / 40;
|
||||
}
|
||||
// Modern wheel event
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent
|
||||
const ev = <WheelEvent><unknown>e;
|
||||
|
||||
// horizontal delta scroll
|
||||
if (typeof e1.wheelDeltaX !== 'undefined') {
|
||||
if (browser.isSafari && platform.isWindows) {
|
||||
this.deltaX = - (e1.wheelDeltaX / 120);
|
||||
if (ev.deltaMode === ev.DOM_DELTA_LINE) {
|
||||
// the deltas are expressed in lines
|
||||
this.deltaY = -e.deltaY;
|
||||
this.deltaX = -e.deltaX;
|
||||
} else {
|
||||
this.deltaX = e1.wheelDeltaX / 120;
|
||||
this.deltaY = -e.deltaY / 40;
|
||||
this.deltaX = -e.deltaX / 40;
|
||||
}
|
||||
} else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {
|
||||
this.deltaX = -e.detail / 3;
|
||||
} else {
|
||||
this.deltaX = -e.deltaX / 40;
|
||||
}
|
||||
|
||||
// Assume a vertical scroll if nothing else worked
|
||||
if (this.deltaY === 0 && this.deltaX === 0 && e.wheelDelta) {
|
||||
this.deltaY = e.wheelDelta / 120;
|
||||
} else {
|
||||
// Old (deprecated) wheel events
|
||||
let e1 = <IWebKitMouseWheelEvent><any>e;
|
||||
let e2 = <IGeckoMouseWheelEvent><any>e;
|
||||
|
||||
// vertical delta scroll
|
||||
if (typeof e1.wheelDeltaY !== 'undefined') {
|
||||
this.deltaY = e1.wheelDeltaY / 120;
|
||||
} else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {
|
||||
this.deltaY = -e2.detail / 3;
|
||||
}
|
||||
|
||||
// horizontal delta scroll
|
||||
if (typeof e1.wheelDeltaX !== 'undefined') {
|
||||
if (browser.isSafari && platform.isWindows) {
|
||||
this.deltaX = - (e1.wheelDeltaX / 120);
|
||||
} else {
|
||||
this.deltaX = e1.wheelDeltaX / 120;
|
||||
}
|
||||
} else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {
|
||||
this.deltaX = -e.detail / 3;
|
||||
}
|
||||
|
||||
// Assume a vertical scroll if nothing else worked
|
||||
if (this.deltaY === 0 && this.deltaX === 0 && e.wheelDelta) {
|
||||
this.deltaY = e.wheelDelta / 120;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,15 +86,21 @@ export class Gesture extends Disposable {
|
||||
this._register(DomUtils.addDisposableListener(document, 'touchmove', (e: TouchEvent) => this.onTouchMove(e)));
|
||||
}
|
||||
|
||||
public static addTarget(element: HTMLElement): void {
|
||||
public static addTarget(element: HTMLElement): IDisposable {
|
||||
if (!Gesture.isTouchDevice()) {
|
||||
return;
|
||||
return Disposable.None;
|
||||
}
|
||||
if (!Gesture.INSTANCE) {
|
||||
Gesture.INSTANCE = new Gesture();
|
||||
}
|
||||
|
||||
Gesture.INSTANCE.targets.push(element);
|
||||
|
||||
return {
|
||||
dispose: () => {
|
||||
Gesture.INSTANCE.targets = Gesture.INSTANCE.targets.filter(t => t !== element);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@memoize
|
||||
|
||||
@@ -103,7 +103,7 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
|
||||
|
||||
render(container: HTMLElement): void {
|
||||
this.element = container;
|
||||
Gesture.addTarget(container);
|
||||
this._register(Gesture.addTarget(container));
|
||||
|
||||
const enableDragging = this.options && this.options.draggable;
|
||||
if (enableDragging) {
|
||||
|
||||
@@ -63,7 +63,7 @@ export class Button extends Disposable {
|
||||
|
||||
container.appendChild(this._element);
|
||||
|
||||
Gesture.addTarget(this._element);
|
||||
this._register(Gesture.addTarget(this._element));
|
||||
|
||||
[DOM.EventType.CLICK, EventType.Tap].forEach(eventType => {
|
||||
this._register(DOM.addDisposableListener(this._element, eventType, e => {
|
||||
|
||||
@@ -83,7 +83,7 @@ export class BaseDropdown extends ActionRunner {
|
||||
this._register(cleanupFn);
|
||||
}
|
||||
|
||||
Gesture.addTarget(this._label);
|
||||
this._register(Gesture.addTarget(this._label));
|
||||
}
|
||||
|
||||
get element(): HTMLElement {
|
||||
|
||||
@@ -236,7 +236,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
||||
|
||||
this.rowsContainer = document.createElement('div');
|
||||
this.rowsContainer.className = 'monaco-list-rows';
|
||||
Gesture.addTarget(this.rowsContainer);
|
||||
this.disposables.add(Gesture.addTarget(this.rowsContainer));
|
||||
|
||||
this.scrollableElement = this.disposables.add(new ScrollableElement(this.rowsContainer, {
|
||||
alwaysConsumeMouseWheel: true,
|
||||
|
||||
@@ -542,7 +542,7 @@ export class MouseController<T> implements IDisposable {
|
||||
list.onContextMenu(this.onContextMenu, this, this.disposables);
|
||||
list.onMouseDblClick(this.onDoubleClick, this, this.disposables);
|
||||
list.onTouchStart(this.onMouseDown, this, this.disposables);
|
||||
Gesture.addTarget(list.getHTMLElement());
|
||||
this.disposables.add(Gesture.addTarget(list.getHTMLElement()));
|
||||
}
|
||||
|
||||
list.onMouseClick(this.onPointer, this, this.disposables);
|
||||
|
||||
@@ -398,7 +398,7 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
|
||||
EventHelper.stop(e, true);
|
||||
this.onClick(e);
|
||||
}));
|
||||
}, 50);
|
||||
}, 100);
|
||||
|
||||
this._register(this.runOnceToEnableMouseUp);
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ export class MenuBar extends Disposable {
|
||||
}
|
||||
}));
|
||||
|
||||
Gesture.addTarget(buttonElement);
|
||||
this._register(Gesture.addTarget(buttonElement));
|
||||
this._register(DOM.addDisposableListener(buttonElement, EventType.Tap, (e: GestureEvent) => {
|
||||
// Ignore this touch if the menu is touched
|
||||
if (this.isOpen && this.focusedMenu && this.focusedMenu.holder && DOM.isAncestor(e.initialTarget as HTMLElement, this.focusedMenu.holder)) {
|
||||
@@ -322,7 +322,7 @@ export class MenuBar extends Disposable {
|
||||
}
|
||||
}));
|
||||
|
||||
Gesture.addTarget(buttonElement);
|
||||
this._register(Gesture.addTarget(buttonElement));
|
||||
this._register(DOM.addDisposableListener(buttonElement, EventType.Tap, (e: GestureEvent) => {
|
||||
// Ignore this touch if the menu is touched
|
||||
if (this.isOpen && this.focusedMenu && this.focusedMenu.holder && DOM.isAncestor(e.initialTarget as HTMLElement, this.focusedMenu.holder)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@font-face {
|
||||
font-family: "octicons";
|
||||
src: url("./octicons.ttf?628f71ee09945d25ba5fceb0c17f7b0f") format("truetype");
|
||||
src: url("./octicons.ttf?1829db8570ee0fa5a4bef3bb41d5f62e") format("truetype");
|
||||
}
|
||||
|
||||
.octicon, .mega-octicon {
|
||||
|
||||
Binary file not shown.
@@ -139,7 +139,7 @@ export class Sash extends Disposable {
|
||||
this._register(domEvent(this.el, 'mousedown')(this.onMouseDown, this));
|
||||
this._register(domEvent(this.el, 'dblclick')(this.onMouseDoubleClick, this));
|
||||
|
||||
Gesture.addTarget(this.el);
|
||||
this._register(Gesture.addTarget(this.el));
|
||||
this._register(domEvent(this.el, EventType.Start)(this.onTouchStart, this));
|
||||
|
||||
if (isIPad) {
|
||||
|
||||
@@ -23,7 +23,10 @@ export class MarkdownString implements IMarkdownString {
|
||||
|
||||
appendText(value: string): MarkdownString {
|
||||
// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
|
||||
this.value += value.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&');
|
||||
this.value += value
|
||||
.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&')
|
||||
.replace('\n', '\n\n');
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
8
src/vs/base/common/insane/insane.d.ts
vendored
8
src/vs/base/common/insane/insane.d.ts
vendored
@@ -3,11 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export as namespace insane;
|
||||
|
||||
export = insane;
|
||||
|
||||
declare function insane(
|
||||
export function insane(
|
||||
html: string,
|
||||
options?: {
|
||||
readonly allowedSchemes?: readonly string[],
|
||||
@@ -16,5 +12,3 @@ declare function insane(
|
||||
},
|
||||
strict?: boolean,
|
||||
): string;
|
||||
|
||||
declare namespace insane { }
|
||||
|
||||
@@ -21,11 +21,7 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// ESM-comment-begin
|
||||
let __insane_exports;
|
||||
// ESM-comment-end
|
||||
|
||||
|
||||
let __insane_func;
|
||||
|
||||
(function () { function r(e, n, t) { function o(i, f) { if (!n[i]) { if (!e[i]) { var c = "function" == typeof require && require; if (!f && c) return c(i, !0); if (u) return u(i, !0); var a = new Error("Cannot find module '" + i + "'"); throw a.code = "MODULE_NOT_FOUND", a } var p = n[i] = { exports: {} }; e[i][0].call(p.exports, function (r) { var n = e[i][1][r]; return o(n || r) }, p, p.exports, r, e, n, t) } return n[i].exports } for (var u = "function" == typeof require && require, i = 0; i < t.length; i++)o(t[i]); return o } return r })()({
|
||||
1: [function (require, module, exports) {
|
||||
@@ -92,7 +88,7 @@ let __insane_exports;
|
||||
|
||||
insane.defaults = defaults;
|
||||
module.exports = insane;
|
||||
__insane_exports = insane;
|
||||
__insane_func = insane;
|
||||
|
||||
}, { "./defaults": 2, "./parser": 7, "./sanitizer": 8, "assignment": 6, "he": 9 }], 5: [function (require, module, exports) {
|
||||
'use strict';
|
||||
@@ -469,10 +465,10 @@ let __insane_exports;
|
||||
}, {}]
|
||||
}, {}, [4]);
|
||||
|
||||
// BEGIN MONACOCHANGE
|
||||
// __marked_exports = marked;
|
||||
// }).call(this);
|
||||
|
||||
// ESM-comment-begin
|
||||
define(function() { return __insane_exports; });
|
||||
define(function() { return { insane: __insane_func }; });
|
||||
// ESM-comment-end
|
||||
|
||||
// ESM-uncomment-begin
|
||||
// export var insane = __insane_func;
|
||||
// ESM-uncomment-end
|
||||
|
||||
@@ -92,7 +92,10 @@ class RemoteAuthoritiesImpl {
|
||||
return this._delegate(uri);
|
||||
}
|
||||
const authority = uri.authority;
|
||||
const host = this._hosts[authority];
|
||||
let host = this._hosts[authority];
|
||||
if (host.indexOf(':') !== -1) {
|
||||
host = `[${host}]`;
|
||||
}
|
||||
const port = this._ports[authority];
|
||||
const connectionToken = this._connectionTokens[authority];
|
||||
return URI.from({
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Menu, MenuItem, BrowserWindow, ipcMain, IpcMainEvent } from 'electron';
|
||||
import { Menu, MenuItem, BrowserWindow, ipcMain, Event as IpcMainEvent } from 'electron';
|
||||
import { ISerializableContextMenuItem, CONTEXT_MENU_CLOSE_CHANNEL, CONTEXT_MENU_CHANNEL, IPopupOptions } from 'vs/base/parts/contextmenu/common/contextmenu';
|
||||
|
||||
export function registerContextMenuListener(): void {
|
||||
|
||||
@@ -437,6 +437,7 @@ export class TreeView extends HeightMap {
|
||||
private shouldInvalidateDropReaction: boolean;
|
||||
private currentDropTargets: ViewItem[] | null = null;
|
||||
private currentDropDisposable: Lifecycle.IDisposable = Lifecycle.Disposable.None;
|
||||
private gestureDisposable: Lifecycle.IDisposable = Lifecycle.Disposable.None;
|
||||
private dragAndDropScrollInterval: number | null = null;
|
||||
private dragAndDropScrollTimeout: number | null = null;
|
||||
private dragAndDropMouseY: number | null = null;
|
||||
@@ -523,7 +524,7 @@ export class TreeView extends HeightMap {
|
||||
this.wrapper.style.msTouchAction = 'none';
|
||||
this.wrapper.style.msContentZooming = 'none';
|
||||
} else {
|
||||
Touch.Gesture.addTarget(this.wrapper);
|
||||
this.gestureDisposable = Touch.Gesture.addTarget(this.wrapper);
|
||||
}
|
||||
|
||||
this.rowsContainer = document.createElement('div');
|
||||
@@ -1681,6 +1682,7 @@ export class TreeView extends HeightMap {
|
||||
if (this.context.cache) {
|
||||
this.context.cache.dispose();
|
||||
}
|
||||
this.gestureDisposable.dispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
19
src/vs/base/test/common/markdownString.test.ts
Normal file
19
src/vs/base/test/common/markdownString.test.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { MarkdownString } from 'vs/base/common/htmlContent';
|
||||
|
||||
suite('markdownString', () => {
|
||||
|
||||
test('escape', () => {
|
||||
|
||||
const mds = new MarkdownString();
|
||||
|
||||
mds.appendText('# foo\n*bar*');
|
||||
|
||||
assert.equal(mds.value, '\\# foo\n\n\\*bar\\*');
|
||||
});
|
||||
});
|
||||
@@ -27,6 +27,7 @@ function getWorker(workerId: string, label: string): Worker | Promise<Worker> {
|
||||
throw new Error(`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker`);
|
||||
}
|
||||
|
||||
// ESM-comment-begin
|
||||
export function getWorkerBootstrapUrl(scriptPath: string, label: string): string {
|
||||
if (/^(http:)|(https:)|(file:)/.test(scriptPath)) {
|
||||
const currentUrl = String(window.location);
|
||||
@@ -43,6 +44,7 @@ export function getWorkerBootstrapUrl(scriptPath: string, label: string): string
|
||||
}
|
||||
return scriptPath + '#' + label;
|
||||
}
|
||||
// ESM-comment-end
|
||||
|
||||
function isPromiseLike<T>(obj: any): obj is PromiseLike<T> {
|
||||
if (typeof obj.then === 'function') {
|
||||
|
||||
Reference in New Issue
Block a user