debt - less explicit any
This commit is contained in:
parent
ec1def6ca8
commit
7031abadea
33 changed files with 94 additions and 112 deletions
|
@ -20,7 +20,7 @@ export interface IContextMenuDelegate {
|
|||
getActions(): readonly IAction[];
|
||||
getCheckedActionsRepresentation?(action: IAction): 'radio' | 'checkbox';
|
||||
getActionViewItem?(action: IAction): IActionViewItem | undefined;
|
||||
getActionsContext?(event?: IContextMenuEvent): any;
|
||||
getActionsContext?(event?: IContextMenuEvent): unknown;
|
||||
getKeyBinding?(action: IAction): ResolvedKeybinding | undefined;
|
||||
getMenuClassName?(): string;
|
||||
onHide?(didCancel: boolean): void;
|
||||
|
|
|
@ -89,7 +89,7 @@ export function applyDragImage(event: DragEvent, label: string | null, clazz: st
|
|||
|
||||
export interface IDragAndDropData {
|
||||
update(dataTransfer: DataTransfer): void;
|
||||
getData(): any;
|
||||
getData(): unknown;
|
||||
}
|
||||
|
||||
export class DragAndDropData<T> implements IDragAndDropData {
|
||||
|
|
|
@ -9,7 +9,7 @@ export type EventHandler = HTMLElement | HTMLDocument | Window;
|
|||
|
||||
export interface IDomEvent {
|
||||
<K extends keyof HTMLElementEventMap>(element: EventHandler, type: K, useCapture?: boolean): BaseEvent<HTMLElementEventMap[K]>;
|
||||
(element: EventHandler, type: string, useCapture?: boolean): BaseEvent<any>;
|
||||
(element: EventHandler, type: string, useCapture?: boolean): BaseEvent<unknown>;
|
||||
}
|
||||
|
||||
export const domEvent: IDomEvent = (element: EventHandler, type: string, useCapture?: boolean) => {
|
||||
|
|
|
@ -27,12 +27,12 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
|
|||
|
||||
element: HTMLElement | undefined;
|
||||
|
||||
_context: any;
|
||||
_context: unknown;
|
||||
_action: IAction;
|
||||
|
||||
private _actionRunner: IActionRunner | undefined;
|
||||
|
||||
constructor(context: any, action: IAction, protected options: IBaseActionViewItemOptions = {}) {
|
||||
constructor(context: unknown, action: IAction, protected options: IBaseActionViewItemOptions = {}) {
|
||||
super();
|
||||
|
||||
this._context = context || this;
|
||||
|
|
|
@ -15,7 +15,7 @@ import { IActionViewItemOptions, ActionViewItem, BaseActionViewItem } from 'vs/b
|
|||
|
||||
export interface IActionViewItem extends IDisposable {
|
||||
actionRunner: IActionRunner;
|
||||
setActionContext(context: any): void;
|
||||
setActionContext(context: unknown): void;
|
||||
render(element: HTMLElement): void;
|
||||
isEnabled(): boolean;
|
||||
focus(fromRight?: boolean): void; // TODO@isidorn what is this?
|
||||
|
@ -38,7 +38,7 @@ export interface ActionTrigger {
|
|||
|
||||
export interface IActionBarOptions {
|
||||
readonly orientation?: ActionsOrientation;
|
||||
readonly context?: any;
|
||||
readonly context?: unknown;
|
||||
readonly actionViewItemProvider?: IActionViewItemProvider;
|
||||
readonly actionRunner?: IActionRunner;
|
||||
readonly ariaLabel?: string;
|
||||
|
@ -264,11 +264,11 @@ export class ActionBar extends Disposable implements IActionRunner {
|
|||
}
|
||||
}
|
||||
|
||||
get context(): any {
|
||||
get context(): unknown {
|
||||
return this._context;
|
||||
}
|
||||
|
||||
set context(context: any) {
|
||||
set context(context: unknown) {
|
||||
this._context = context;
|
||||
this.viewItems.forEach(i => i.setActionContext(context));
|
||||
}
|
||||
|
@ -525,8 +525,8 @@ export class ActionBar extends Disposable implements IActionRunner {
|
|||
}
|
||||
}
|
||||
|
||||
run(action: IAction, context?: unknown): Promise<void> {
|
||||
return this._actionRunner.run(action, context);
|
||||
async run(action: IAction, context?: unknown): Promise<void> {
|
||||
await this._actionRunner.run(action, context);
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
|
|
|
@ -45,7 +45,7 @@ export interface IDelegate {
|
|||
anchorAxisAlignment?: AnchorAxisAlignment; // default: vertical
|
||||
canRelayout?: boolean; // default: true
|
||||
onDOMEvent?(e: Event, activeElement: HTMLElement): void;
|
||||
onHide?(data?: any): void;
|
||||
onHide?(data?: unknown): void;
|
||||
}
|
||||
|
||||
export interface IContextViewProvider {
|
||||
|
@ -324,7 +324,7 @@ export class ContextView extends Disposable {
|
|||
this.view.style.width = 'initial';
|
||||
}
|
||||
|
||||
hide(data?: any): void {
|
||||
hide(data?: unknown): void {
|
||||
const delegate = this.delegate;
|
||||
this.delegate = null;
|
||||
|
||||
|
|
|
@ -222,12 +222,12 @@ export class IconLabel extends Disposable {
|
|||
let isHovering = false;
|
||||
let tokenSource: CancellationTokenSource;
|
||||
let hoverDisposable: IDisposable | undefined;
|
||||
function mouseOver(this: HTMLElement, e: MouseEvent): any {
|
||||
function mouseOver(this: HTMLElement, e: MouseEvent): void {
|
||||
if (isHovering) {
|
||||
return;
|
||||
}
|
||||
tokenSource = new CancellationTokenSource();
|
||||
function mouseLeaveOrDown(this: HTMLElement, e: MouseEvent): any {
|
||||
function mouseLeaveOrDown(this: HTMLElement, e: MouseEvent): void {
|
||||
const isMouseDown = e.type === dom.EventType.MOUSE_DOWN;
|
||||
if (isMouseDown) {
|
||||
hoverDisposable?.dispose();
|
||||
|
@ -245,7 +245,7 @@ export class IconLabel extends Disposable {
|
|||
const mouseDownDisposable = domEvent(htmlElement, dom.EventType.MOUSE_DOWN, true)(mouseLeaveOrDown.bind(htmlElement));
|
||||
isHovering = true;
|
||||
|
||||
function mouseMove(this: HTMLElement, e: MouseEvent): any {
|
||||
function mouseMove(this: HTMLElement, e: MouseEvent): void {
|
||||
mouseX = e.x;
|
||||
}
|
||||
const mouseMoveDisposable = domEvent(htmlElement, dom.EventType.MOUSE_MOVE, true)(mouseMove.bind(htmlElement));
|
||||
|
|
|
@ -339,7 +339,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
|||
container.appendChild(this.domNode);
|
||||
|
||||
this.scrollableElement.onScroll(this.onScroll, this, this.disposables);
|
||||
domEvent(this.rowsContainer, TouchEventType.Change)(this.onTouchChange, this, this.disposables);
|
||||
domEvent(this.rowsContainer, TouchEventType.Change)(e => this.onTouchChange(e as GestureEvent), this, this.disposables);
|
||||
|
||||
// Prevent the monaco-scrollable-element from scrolling
|
||||
// https://github.com/microsoft/vscode/issues/44181
|
||||
|
@ -898,7 +898,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
|||
@memoize get onMouseOut(): Event<IListMouseEvent<T>> { return Event.map(domEvent(this.domNode, 'mouseout'), e => this.toMouseEvent(e)); }
|
||||
@memoize get onContextMenu(): Event<IListMouseEvent<T>> { return Event.map(domEvent(this.domNode, 'contextmenu'), e => this.toMouseEvent(e)); }
|
||||
@memoize get onTouchStart(): Event<IListTouchEvent<T>> { return Event.map(domEvent(this.domNode, 'touchstart'), e => this.toTouchEvent(e)); }
|
||||
@memoize get onTap(): Event<IListGestureEvent<T>> { return Event.map(domEvent(this.rowsContainer, TouchEventType.Tap), e => this.toGestureEvent(e)); }
|
||||
@memoize get onTap(): Event<IListGestureEvent<T>> { return Event.map(domEvent(this.rowsContainer, TouchEventType.Tap), e => this.toGestureEvent(e as GestureEvent)); }
|
||||
|
||||
private toMouseEvent(browserEvent: MouseEvent): IListMouseEvent<T> {
|
||||
const index = this.getItemIndexFromEventTarget(browserEvent.target || null);
|
||||
|
|
|
@ -37,7 +37,7 @@ export enum Direction {
|
|||
}
|
||||
|
||||
export interface IMenuOptions {
|
||||
context?: any;
|
||||
context?: unknown;
|
||||
actionViewItemProvider?: IActionViewItemProvider;
|
||||
actionRunner?: IActionRunner;
|
||||
getKeyBinding?: (action: IAction) => ResolvedKeybinding | undefined;
|
||||
|
|
|
@ -211,7 +211,7 @@ export class Sash extends Disposable {
|
|||
this._register(domEvent(this.el, 'mouseleave')(() => Sash.onMouseLeave(this)));
|
||||
|
||||
this._register(Gesture.addTarget(this.el));
|
||||
this._register(domEvent(this.el, EventType.Start)(this.onTouchStart, this));
|
||||
this._register(domEvent(this.el, EventType.Start)(e => this.onTouchStart(e as GestureEvent), this));
|
||||
|
||||
if (typeof options.size === 'number') {
|
||||
this.size = options.size;
|
||||
|
|
|
@ -10,7 +10,7 @@ import { Event, Emitter } from 'vs/base/common/event';
|
|||
export interface ITelemetryData {
|
||||
readonly from?: string;
|
||||
readonly target?: string;
|
||||
[key: string]: any;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export type WorkbenchActionExecutedClassification = {
|
||||
|
@ -30,13 +30,14 @@ export interface IAction extends IDisposable {
|
|||
class: string | undefined;
|
||||
enabled: boolean;
|
||||
checked: boolean;
|
||||
run(event?: any): Promise<any>;
|
||||
run(event?: unknown): Promise<unknown>;
|
||||
}
|
||||
|
||||
export interface IActionRunner extends IDisposable {
|
||||
run(action: IAction, context?: any): Promise<any>;
|
||||
readonly onDidRun: Event<IRunEvent>;
|
||||
readonly onBeforeRun: Event<IRunEvent>;
|
||||
|
||||
run(action: IAction, context?: unknown): Promise<unknown>;
|
||||
}
|
||||
|
||||
export interface IActionChangeEvent {
|
||||
|
@ -58,9 +59,9 @@ export class Action extends Disposable implements IAction {
|
|||
protected _cssClass: string | undefined;
|
||||
protected _enabled: boolean = true;
|
||||
protected _checked: boolean = false;
|
||||
protected readonly _actionCallback?: (event?: any) => Promise<any>;
|
||||
protected readonly _actionCallback?: (event?: unknown) => Promise<unknown>;
|
||||
|
||||
constructor(id: string, label: string = '', cssClass: string = '', enabled: boolean = true, actionCallback?: (event?: any) => Promise<any>) {
|
||||
constructor(id: string, label: string = '', cssClass: string = '', enabled: boolean = true, actionCallback?: (event?: unknown) => Promise<unknown>) {
|
||||
super();
|
||||
this._id = id;
|
||||
this._label = label;
|
||||
|
@ -148,19 +149,16 @@ export class Action extends Disposable implements IAction {
|
|||
}
|
||||
}
|
||||
|
||||
run(event?: any, _data?: ITelemetryData): Promise<any> {
|
||||
async run(event?: unknown, data?: ITelemetryData): Promise<void> {
|
||||
if (this._actionCallback) {
|
||||
return this._actionCallback(event);
|
||||
await this._actionCallback(event);
|
||||
}
|
||||
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
export interface IRunEvent {
|
||||
readonly action: IAction;
|
||||
readonly result?: any;
|
||||
readonly error?: any;
|
||||
readonly error?: Error;
|
||||
}
|
||||
|
||||
export class ActionRunner extends Disposable implements IActionRunner {
|
||||
|
@ -171,24 +169,25 @@ export class ActionRunner extends Disposable implements IActionRunner {
|
|||
private _onDidRun = this._register(new Emitter<IRunEvent>());
|
||||
readonly onDidRun = this._onDidRun.event;
|
||||
|
||||
async run(action: IAction, context?: any): Promise<any> {
|
||||
async run(action: IAction, context?: unknown): Promise<void> {
|
||||
if (!action.enabled) {
|
||||
return Promise.resolve(null);
|
||||
return;
|
||||
}
|
||||
|
||||
this._onBeforeRun.fire({ action: action });
|
||||
this._onBeforeRun.fire({ action });
|
||||
|
||||
let error: Error | undefined = undefined;
|
||||
try {
|
||||
const result = await this.runAction(action, context);
|
||||
this._onDidRun.fire({ action: action, result: result });
|
||||
} catch (error) {
|
||||
this._onDidRun.fire({ action: action, error: error });
|
||||
}
|
||||
await this.runAction(action, context);
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
protected runAction(action: IAction, context?: any): Promise<any> {
|
||||
const res = context ? action.run(context) : action.run();
|
||||
return Promise.resolve(res);
|
||||
this._onDidRun.fire({ action, error });
|
||||
}
|
||||
|
||||
protected async runAction(action: IAction, context?: unknown): Promise<void> {
|
||||
await action.run(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,6 +197,7 @@ export class Separator extends Action {
|
|||
|
||||
constructor(label?: string) {
|
||||
super(Separator.ID, label, label ? 'separator text' : 'separator');
|
||||
|
||||
this.checked = false;
|
||||
this.enabled = false;
|
||||
}
|
||||
|
@ -213,6 +213,7 @@ export class SubmenuAction implements IAction {
|
|||
readonly checked: boolean = false;
|
||||
|
||||
private readonly _actions: readonly IAction[];
|
||||
get actions(): readonly IAction[] { return this._actions; }
|
||||
|
||||
constructor(id: string, label: string, actions: readonly IAction[], cssClass?: string) {
|
||||
this.id = id;
|
||||
|
@ -227,15 +228,13 @@ export class SubmenuAction implements IAction {
|
|||
// to bridge into the rendering world.
|
||||
}
|
||||
|
||||
get actions(): readonly IAction[] {
|
||||
return this._actions;
|
||||
}
|
||||
|
||||
async run(): Promise<any> { }
|
||||
async run(): Promise<void> { }
|
||||
}
|
||||
|
||||
export class EmptySubmenuAction extends Action {
|
||||
|
||||
static readonly ID = 'vs.actions.empty';
|
||||
|
||||
constructor() {
|
||||
super(EmptySubmenuAction.ID, nls.localize('submenu.empty', '(empty)'), undefined, false);
|
||||
}
|
||||
|
|
|
@ -107,10 +107,7 @@ export class DiffReview extends Disposable {
|
|||
this.actionBarContainer.domNode
|
||||
));
|
||||
|
||||
this._actionBar.push(new Action('diffreview.close', nls.localize('label.close', "Close"), 'close-diff-review ' + ThemeIcon.asClassName(diffReviewCloseIcon), true, () => {
|
||||
this.hide();
|
||||
return Promise.resolve(null);
|
||||
}), { label: false, icon: true });
|
||||
this._actionBar.push(new Action('diffreview.close', nls.localize('label.close', "Close"), 'close-diff-review ' + ThemeIcon.asClassName(diffReviewCloseIcon), true, async () => this.hide()), { label: false, icon: true });
|
||||
|
||||
this.domNode = createFastDomNode(document.createElement('div'));
|
||||
this.domNode.setClassName('diff-review monaco-editor-background');
|
||||
|
|
|
@ -18,6 +18,7 @@ import { EventType, $, isHTMLElement } from 'vs/base/browser/dom';
|
|||
import { attachMenuStyler } from 'vs/platform/theme/common/styler';
|
||||
import { domEvent } from 'vs/base/browser/event';
|
||||
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
|
||||
export interface IContextMenuHandlerOptions {
|
||||
blockMouse: boolean;
|
||||
|
@ -145,9 +146,7 @@ export class ContextMenuHandler {
|
|||
}
|
||||
|
||||
private onActionRun(e: IRunEvent): void {
|
||||
if (this.telemetryService) {
|
||||
this.telemetryService.publicLog2<WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification>('workbenchActionExecuted', { id: e.action.id, from: 'contextMenu' });
|
||||
}
|
||||
|
||||
this.contextViewService.hideContextView(false);
|
||||
|
||||
|
@ -158,7 +157,7 @@ export class ContextMenuHandler {
|
|||
}
|
||||
|
||||
private onDidActionRun(e: IRunEvent): void {
|
||||
if (e.error) {
|
||||
if (e.error && !isPromiseCanceledError(e.error)) {
|
||||
this.notificationService.error(e.error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,8 +77,8 @@ export class MainThreadUriOpeners extends Disposable implements MainThreadUriOpe
|
|||
await this.proxy.$openUri(id, { resolvedUri: uri, sourceUri: ctx.sourceUri }, token);
|
||||
} catch (e) {
|
||||
if (!isPromiseCanceledError(e)) {
|
||||
const openDefaultAction = new Action('default', localize('openerFailedUseDefault', "Open using default opener"), undefined, undefined, () => {
|
||||
return this.openerService.open(uri, {
|
||||
const openDefaultAction = new Action('default', localize('openerFailedUseDefault', "Open using default opener"), undefined, undefined, async () => {
|
||||
await this.openerService.open(uri, {
|
||||
allowTunneling: false,
|
||||
allowContributedOpeners: defaultExternalUriOpenerId,
|
||||
});
|
||||
|
|
|
@ -32,7 +32,7 @@ abstract class BaseNavigationAction extends Action {
|
|||
super(id, label);
|
||||
}
|
||||
|
||||
async run(): Promise<boolean | IViewlet | IPanel> {
|
||||
async run(): Promise<void> {
|
||||
const isEditorFocus = this.layoutService.hasFocus(Parts.EDITOR_PART);
|
||||
const isPanelFocus = this.layoutService.hasFocus(Parts.PANEL_PART);
|
||||
const isSidebarFocus = this.layoutService.hasFocus(Parts.SIDEBAR_PART);
|
||||
|
@ -41,7 +41,7 @@ abstract class BaseNavigationAction extends Action {
|
|||
if (isEditorFocus) {
|
||||
const didNavigate = this.navigateAcrossEditorGroup(this.toGroupDirection(this.direction));
|
||||
if (didNavigate) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
neighborPart = this.layoutService.getVisibleNeighborPart(Parts.EDITOR_PART, this.direction);
|
||||
|
@ -56,18 +56,12 @@ abstract class BaseNavigationAction extends Action {
|
|||
}
|
||||
|
||||
if (neighborPart === Parts.EDITOR_PART) {
|
||||
return this.navigateToEditorGroup(this.direction === Direction.Right ? GroupLocation.FIRST : GroupLocation.LAST);
|
||||
this.navigateToEditorGroup(this.direction === Direction.Right ? GroupLocation.FIRST : GroupLocation.LAST);
|
||||
} else if (neighborPart === Parts.SIDEBAR_PART) {
|
||||
this.navigateToSidebar();
|
||||
} else if (neighborPart === Parts.PANEL_PART) {
|
||||
this.navigateToPanel();
|
||||
}
|
||||
|
||||
if (neighborPart === Parts.SIDEBAR_PART) {
|
||||
return this.navigateToSidebar();
|
||||
}
|
||||
|
||||
if (neighborPart === Parts.PANEL_PART) {
|
||||
return this.navigateToPanel();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private async navigateToPanel(): Promise<IPanel | boolean> {
|
||||
|
|
|
@ -42,7 +42,7 @@ export class TextInputActionsProvider extends Disposable implements IWorkbenchCo
|
|||
// Cut / Copy / Paste
|
||||
new Action('editor.action.clipboardCutAction', localize('cut', "Cut"), undefined, true, async () => document.execCommand('cut')),
|
||||
new Action('editor.action.clipboardCopyAction', localize('copy', "Copy"), undefined, true, async () => document.execCommand('copy')),
|
||||
new Action('editor.action.clipboardPasteAction', localize('paste', "Paste"), undefined, true, async (element: HTMLInputElement | HTMLTextAreaElement) => {
|
||||
new Action('editor.action.clipboardPasteAction', localize('paste', "Paste"), undefined, true, async element => {
|
||||
|
||||
// Native: paste is supported
|
||||
if (isNative) {
|
||||
|
|
|
@ -304,10 +304,8 @@ export class ReloadWindowAction extends Action {
|
|||
super(id, label);
|
||||
}
|
||||
|
||||
async run(): Promise<boolean> {
|
||||
async run(): Promise<void> {
|
||||
await this.hostService.reload();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -263,9 +263,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
|
|||
}
|
||||
|
||||
// Log in telemetry
|
||||
if (this.telemetryService) {
|
||||
this.telemetryService.publicLog2<WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification>('workbenchActionExecuted', { id: e.action.id, from: this.nameForTelemetry });
|
||||
}
|
||||
});
|
||||
|
||||
// Indicate to composite that it is now visible
|
||||
|
|
|
@ -300,8 +300,8 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
|
|||
const groupId = this._group.id;
|
||||
const containerToolbar = this._register(new ActionBar(toolbarContainer, {
|
||||
ariaLabel: localize('ariaLabelGroupActions', "Editor group actions"), actionRunner: this._register(new class extends ActionRunner {
|
||||
run(action: IAction) {
|
||||
return action.run(groupId);
|
||||
async run(action: IAction) {
|
||||
await action.run(groupId);
|
||||
}
|
||||
})
|
||||
}));
|
||||
|
|
|
@ -1069,7 +1069,7 @@ export class ChangeModeAction extends Action {
|
|||
super(actionId, actionLabel);
|
||||
}
|
||||
|
||||
async run(event: any, data: ITelemetryData): Promise<void> {
|
||||
async run(event: unknown, data?: ITelemetryData): Promise<void> {
|
||||
const activeTextEditorControl = getCodeEditor(this.editorService.activeTextEditorControl);
|
||||
if (!activeTextEditorControl) {
|
||||
await this.quickInputService.pick([{ label: localize('noEditor', "No text editor active at this time") }]);
|
||||
|
|
|
@ -38,6 +38,7 @@ import { IFileService } from 'vs/platform/files/common/files';
|
|||
import { withNullAsUndefined, withUndefinedAsNull, assertIsDefined } from 'vs/base/common/types';
|
||||
import { isFirefox } from 'vs/base/browser/browser';
|
||||
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
|
||||
export interface IToolbarActions {
|
||||
primary: IAction[];
|
||||
|
@ -151,12 +152,12 @@ export abstract class TitleControl extends Themable {
|
|||
this._register(this.editorActionsToolbar.actionRunner.onDidRun(e => {
|
||||
|
||||
// Notify for Error
|
||||
if (e.error && !isPromiseCanceledError(e.error)) {
|
||||
this.notificationService.error(e.error);
|
||||
}
|
||||
|
||||
// Log in telemetry
|
||||
if (this.telemetryService) {
|
||||
this.telemetryService.publicLog2<WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification>('workbenchActionExecuted', { id: e.action.id, from: 'editorPart' });
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -251,11 +251,12 @@ export abstract class MenubarControl extends Disposable {
|
|||
openable = { fileUri: uri };
|
||||
}
|
||||
|
||||
const ret: IAction = new Action(commandId, unmnemonicLabel(label), undefined, undefined, (event) => {
|
||||
const openInNewWindow = event && ((!isMacintosh && (event.ctrlKey || event.shiftKey)) || (isMacintosh && (event.metaKey || event.altKey)));
|
||||
const ret: IAction = new Action(commandId, unmnemonicLabel(label), undefined, undefined, event => {
|
||||
const browserEvent = event as KeyboardEvent;
|
||||
const openInNewWindow = event && ((!isMacintosh && (browserEvent.ctrlKey || browserEvent.shiftKey)) || (isMacintosh && (browserEvent.metaKey || browserEvent.altKey)));
|
||||
|
||||
return this.hostService.openWindow([openable], {
|
||||
forceNewWindow: openInNewWindow,
|
||||
forceNewWindow: !!openInNewWindow,
|
||||
remoteAuthority
|
||||
});
|
||||
});
|
||||
|
|
|
@ -54,6 +54,7 @@ import { API_OPEN_DIFF_EDITOR_COMMAND_ID, API_OPEN_EDITOR_COMMAND_ID } from 'vs/
|
|||
import { Codicon } from 'vs/base/common/codicons';
|
||||
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { Command } from 'vs/editor/common/modes';
|
||||
import { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
|
||||
export class TreeViewPane extends ViewPane {
|
||||
|
||||
|
@ -1071,13 +1072,13 @@ class MultipleSelectionActionRunner extends ActionRunner {
|
|||
constructor(notificationService: INotificationService, private getSelectedResources: (() => ITreeItem[])) {
|
||||
super();
|
||||
this._register(this.onDidRun(e => {
|
||||
if (e.error) {
|
||||
if (e.error && !isPromiseCanceledError(e.error)) {
|
||||
notificationService.error(localize('command-error', 'Error running command {1}: {0}. This is likely caused by the extension that contributes {1}.', e.error.message, e.action.id));
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
runAction(action: IAction, context: TreeViewItemHandleArg): Promise<void> {
|
||||
async runAction(action: IAction, context: TreeViewItemHandleArg): Promise<void> {
|
||||
const selection = this.getSelectedResources();
|
||||
let selectionHandleArgs: TreeViewItemHandleArg[] | undefined = undefined;
|
||||
let actionInSelected: boolean = false;
|
||||
|
@ -1094,7 +1095,7 @@ class MultipleSelectionActionRunner extends ActionRunner {
|
|||
selectionHandleArgs = undefined;
|
||||
}
|
||||
|
||||
return action.run(...[context, selectionHandleArgs]);
|
||||
await action.run(...[context, selectionHandleArgs]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -780,10 +780,8 @@ export class DebugService implements IDebugService {
|
|||
const actions = [...errorActions, configureAction];
|
||||
const { choice } = await this.dialogService.show(severity.Error, message, actions.map(a => a.label).concat(nls.localize('cancel', "Cancel")), { cancelId: actions.length });
|
||||
if (choice < actions.length) {
|
||||
return actions[choice].run();
|
||||
await actions[choice].run();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
//---- focus management
|
||||
|
|
|
@ -126,9 +126,7 @@ export class DebugToolBar extends Themable implements IWorkbenchContribution {
|
|||
}
|
||||
|
||||
// log in telemetry
|
||||
if (this.telemetryService) {
|
||||
this.telemetryService.publicLog2<WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification>('workbenchActionExecuted', { id: e.action.id, from: 'debugActionsWidget' });
|
||||
}
|
||||
}));
|
||||
this._register(dom.addDisposableListener(window, dom.EventType.RESIZE, () => this.setCoordinates()));
|
||||
|
||||
|
|
|
@ -686,9 +686,8 @@ export class RawDebugSession implements IDisposable {
|
|||
if (error && url) {
|
||||
const label = error.urlLabel ? error.urlLabel : nls.localize('moreInfo', "More Info");
|
||||
return errors.createErrorWithActions(userMessage, {
|
||||
actions: [new Action('debug.moreInfo', label, undefined, true, () => {
|
||||
actions: [new Action('debug.moreInfo', label, undefined, true, async () => {
|
||||
this.openerService.open(URI.parse(url));
|
||||
return Promise.resolve(null);
|
||||
})]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -978,7 +978,7 @@ export class MenuItemExtensionAction extends ExtensionAction {
|
|||
|
||||
async run(): Promise<void> {
|
||||
if (this.extension) {
|
||||
return this.action.run(this.extension.identifier.id);
|
||||
await this.action.run(this.extension.identifier.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ export class OpenProcessExplorer extends Action {
|
|||
super(id, label);
|
||||
}
|
||||
|
||||
run(): Promise<boolean> {
|
||||
return this.issueService.openProcessExplorer().then(() => true);
|
||||
run(): Promise<void> {
|
||||
return this.issueService.openProcessExplorer();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ export class ReportPerformanceIssueUsingReporterAction extends Action {
|
|||
super(id, label);
|
||||
}
|
||||
|
||||
run(): Promise<boolean> {
|
||||
return this.issueService.openReporter({ issueType: IssueType.PerformanceIssue }).then(() => true);
|
||||
run(): Promise<void> {
|
||||
return this.issueService.openReporter({ issueType: IssueType.PerformanceIssue });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -324,7 +324,7 @@ export class KeybindingsEditor extends EditorPane implements IKeybindingsEditorP
|
|||
const fullTextSearchPlaceholder = localize('SearchKeybindings.FullTextSearchPlaceholder', "Type to search in keybindings");
|
||||
const keybindingsSearchPlaceholder = localize('SearchKeybindings.KeybindingsSearchPlaceholder', "Recording Keys. Press Escape to exit");
|
||||
|
||||
const clearInputAction = new Action(KEYBINDINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, localize('clearInput', "Clear Keybindings Search Input"), ThemeIcon.asClassName(preferencesClearInputIcon), false, () => { this.clearSearchResults(); return Promise.resolve(null); });
|
||||
const clearInputAction = new Action(KEYBINDINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, localize('clearInput', "Clear Keybindings Search Input"), ThemeIcon.asClassName(preferencesClearInputIcon), false, async () => this.clearSearchResults());
|
||||
|
||||
const searchContainer = DOM.append(this.headerContainer, $('.search-container'));
|
||||
this.searchWidget = this._register(this.instantiationService.createInstance(KeybindingsSearchWidget, searchContainer, {
|
||||
|
|
|
@ -29,7 +29,7 @@ import { Schemas } from 'vs/base/common/network';
|
|||
import { activeContrastBorder, badgeBackground, badgeForeground, contrastBorder, focusBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { attachInputBoxStyler, attachStylerCallback } from 'vs/platform/theme/common/styler';
|
||||
import { ICssStyleCollector, IColorTheme, IThemeService, registerThemingParticipant, ThemeIcon } from 'vs/platform/theme/common/themeService';
|
||||
import { IWorkspaceContextService, IWorkspaceFolder, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { isWorkspaceFolder, IWorkspaceContextService, IWorkspaceFolder, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { PANEL_ACTIVE_TITLE_BORDER, PANEL_ACTIVE_TITLE_FOREGROUND, PANEL_INACTIVE_TITLE_FOREGROUND } from 'vs/workbench/common/theme';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { ISettingsGroup, IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
|
||||
|
@ -539,8 +539,9 @@ export class SettingsTargetsWidget extends Widget {
|
|||
|
||||
this.workspaceSettings = new Action('workspaceSettings', localize('workspaceSettings', "Workspace"), '.settings-tab', false, () => this.updateTarget(ConfigurationTarget.WORKSPACE));
|
||||
|
||||
const folderSettingsAction = new Action('folderSettings', localize('folderSettings', "Folder"), '.settings-tab', false,
|
||||
(folder: IWorkspaceFolder | null) => this.updateTarget(folder ? folder.uri : ConfigurationTarget.USER_LOCAL));
|
||||
const folderSettingsAction = new Action('folderSettings', localize('folderSettings', "Folder"), '.settings-tab', false, async folder => {
|
||||
this.updateTarget(isWorkspaceFolder(folder) ? folder.uri : ConfigurationTarget.USER_LOCAL);
|
||||
});
|
||||
this.folderSettings = this.instantiationService.createInstance(FolderSettingsActionViewItem, folderSettingsAction);
|
||||
|
||||
this.update();
|
||||
|
|
|
@ -440,7 +440,7 @@ export class SettingsEditor2 extends EditorPane {
|
|||
|
||||
const searchContainer = DOM.append(this.headerContainer, $('.search-container'));
|
||||
|
||||
const clearInputAction = new Action(SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, localize('clearInput', "Clear Settings Search Input"), ThemeIcon.asClassName(preferencesClearInputIcon), false, () => { this.clearSearchResults(); return Promise.resolve(null); });
|
||||
const clearInputAction = new Action(SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, localize('clearInput', "Clear Settings Search Input"), ThemeIcon.asClassName(preferencesClearInputIcon), false, async () => this.clearSearchResults());
|
||||
|
||||
this.searchWidget = this._register(this.instantiationService.createInstance(SuggestEnabledInput, `${SettingsEditor2.ID}.searchbox`, searchContainer, {
|
||||
triggerCharacters: ['@'],
|
||||
|
|
|
@ -1541,12 +1541,10 @@ export class SettingTreeRenderers {
|
|||
@IUserDataAutoSyncEnablementService private readonly _userDataAutoSyncEnablementService: IUserDataAutoSyncEnablementService,
|
||||
) {
|
||||
this.settingActions = [
|
||||
new Action('settings.resetSetting', localize('resetSettingLabel', "Reset Setting"), undefined, undefined, (context: SettingsTreeSettingElement) => {
|
||||
if (context) {
|
||||
new Action('settings.resetSetting', localize('resetSettingLabel', "Reset Setting"), undefined, undefined, async context => {
|
||||
if (context instanceof SettingsTreeSettingElement) {
|
||||
this._onDidChangeSetting.fire({ key: context.setting.key, value: undefined, type: context.setting.type as SettingValueType });
|
||||
}
|
||||
|
||||
return Promise.resolve(null);
|
||||
}),
|
||||
new Separator(),
|
||||
this._instantiationService.createInstance(CopySettingIdAction),
|
||||
|
|
|
@ -413,7 +413,7 @@ export class WalkThroughPart extends EditorPane {
|
|||
this.loadTextEditorViewState(input);
|
||||
this.updatedScrollPosition();
|
||||
this.contentDisposables.push(Gesture.addTarget(innerContent));
|
||||
this.contentDisposables.push(domEvent(innerContent, TouchEventType.Change)(this.onTouchChange, this, this.disposables));
|
||||
this.contentDisposables.push(domEvent(innerContent, TouchEventType.Change)(e => this.onTouchChange(e as GestureEvent), this, this.disposables));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue