Adopt @editorAction

This commit is contained in:
Alex Dima 2016-08-09 17:55:05 +02:00
parent 838ada3612
commit 7f6ed014fd
51 changed files with 229 additions and 303 deletions

View file

@ -23,33 +23,96 @@ export const Command = ConfigBasicCommand;
export const EditorCommand = ConfigEditorCommand;
export type ICommandOptions = ICommandOptions;
// --- Keybinding extensions to make it more concise to express keybindings conditions
export interface IEditorCommandMenuOptions {
group?: string;
order?: number;
}
export interface IActionOptions extends ICommandOptions {
label: string;
alias: string;
menuOpts?: IEditorCommandMenuOptions;
}
export abstract class EditorAction extends ConfigEditorCommand {
public label: string;
public alias: string;
private menuOpts: IEditorCommandMenuOptions;
constructor(opts:IActionOptions) {
super(opts);
this.label = opts.label;
this.alias = opts.alias;
this.menuOpts = opts.menuOpts;
}
public toMenuItem(): IMenuItem {
if (!this.menuOpts) {
return null;
}
return {
command: {
id: this.id,
title: this.label
},
when: this.precondition,
group: this.menuOpts.group,
order: this.menuOpts.order
};
}
public runEditorCommand(accessor:ServicesAccessor, editor: editorCommon.ICommonCodeEditor, args: any): void | TPromise<void> {
accessor.get(ITelemetryService).publicLog('editorActionInvoked', { name: this.label, id: this.id });
return this.run(accessor, editor);
}
public abstract run(accessor:ServicesAccessor, editor:editorCommon.ICommonCodeEditor): void | TPromise<void>;
}
export interface IHandlerActionOptions extends IActionOptions {
handlerId: string;
}
export abstract class HandlerEditorAction extends EditorAction {
private _handlerId: string;
constructor(opts: IHandlerActionOptions) {
super(opts);
this._handlerId = opts.handlerId;
}
public run(accessor:ServicesAccessor, editor:editorCommon.ICommonCodeEditor): void {
editor.trigger(this.id, this._handlerId, null);
}
}
// --- Editor Actions
export function editorAction(constructor:{ new(): EditorAction; }): void {
CommonEditorRegistry.registerEditorAction(new constructor());
}
export module CommonEditorRegistry {
export function registerEditorAction(desc:EditorAction) {
(<EditorContributionRegistry>Registry.as(Extensions.EditorCommonContributions)).registerEditorAction(desc);
}
// --- Editor Actions
export function registerEditorAction(desc:EditorAction) {
EditorContributionRegistry.INSTANCE.registerEditorAction(desc);
}
export function getEditorActions(): EditorAction[] {
return (<EditorContributionRegistry>Registry.as(Extensions.EditorCommonContributions)).getEditorActions();
return EditorContributionRegistry.INSTANCE.getEditorActions();
}
// --- Editor Contributions
export function registerEditorContribution(ctor:editorCommon.ICommonEditorContributionCtor): void {
(<EditorContributionRegistry>Registry.as(Extensions.EditorCommonContributions)).registerEditorContribution(ctor);
EditorContributionRegistry.INSTANCE.registerEditorContribution(ctor);
}
export function getEditorContributions(): editorCommon.ICommonEditorContributionDescriptor[] {
return (<EditorContributionRegistry>Registry.as(Extensions.EditorCommonContributions)).getEditorContributions();
return EditorContributionRegistry.INSTANCE.getEditorContributions();
}
// --- Editor Commands
export function commandWeight(importance: number = 0): number {
return KeybindingsRegistry.WEIGHT.editorContrib(importance);
}
@ -101,6 +164,8 @@ var Extensions = {
class EditorContributionRegistry {
public static INSTANCE = new EditorContributionRegistry();
private editorContributions: editorCommon.ICommonEditorContributionDescriptor[];
private editorActions: EditorAction[];
@ -133,64 +198,4 @@ class EditorContributionRegistry {
return this.editorActions.slice(0);
}
}
Registry.add(Extensions.EditorCommonContributions, new EditorContributionRegistry());
export interface IActionOptions extends ICommandOptions {
label: string;
alias: string;
menuOpts?: IEditorCommandMenuOptions;
}
export abstract class EditorAction extends ConfigEditorCommand {
public label: string;
public alias: string;
private menuOpts: IEditorCommandMenuOptions;
constructor(opts:IActionOptions) {
super(opts);
this.label = opts.label;
this.alias = opts.alias;
this.menuOpts = opts.menuOpts;
}
public toMenuItem(): IMenuItem {
if (!this.menuOpts) {
return null;
}
return {
command: {
id: this.id,
title: this.label
},
when: this.precondition,
group: this.menuOpts.group,
order: this.menuOpts.order
};
}
public runEditorCommand(accessor:ServicesAccessor, editor: editorCommon.ICommonCodeEditor, args: any): void | TPromise<void> {
accessor.get(ITelemetryService).publicLog('editorActionInvoked', { name: this.label, id: this.id });
return this.run(accessor, editor);
}
public abstract run(accessor:ServicesAccessor, editor:editorCommon.ICommonCodeEditor): void | TPromise<void>;
}
export interface IHandlerActionOptions extends IActionOptions {
handlerId: string;
}
export abstract class HandlerEditorAction extends EditorAction {
private _handlerId: string;
constructor(opts: IHandlerActionOptions) {
super(opts);
this._handlerId = opts.handlerId;
}
public run(accessor:ServicesAccessor, editor:editorCommon.ICommonCodeEditor): void {
editor.trigger(this.id, this._handlerId, null);
}
}
Registry.add(Extensions.EditorCommonContributions, EditorContributionRegistry.INSTANCE);

View file

@ -19,7 +19,7 @@ import {KbCtxKey, IKeybindingContextKey, IKeybindingService} from 'vs/platform/k
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
import {GlobalScreenReaderNVDA} from 'vs/editor/common/config/commonEditorConfig';
import {ICommonCodeEditor, IEditorContribution, EditorContextKeys} from 'vs/editor/common/editorCommon';
import {CommonEditorRegistry, EditorAction, EditorCommand, Command} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, CommonEditorRegistry, EditorAction, EditorCommand, Command} from 'vs/editor/common/editorCommonExtensions';
import {ICodeEditor, IOverlayWidget, IOverlayWidgetPosition} from 'vs/editor/browser/editorBrowser';
import {EditorBrowserRegistry} from 'vs/editor/browser/editorBrowserExtensions';
import {ToggleTabFocusModeAction} from 'vs/editor/contrib/toggleTabFocusMode/common/toggleTabFocusMode';
@ -189,6 +189,7 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
}
}
@editorAction
class ShowAccessibilityHelpAction extends EditorAction {
constructor() {
@ -211,7 +212,6 @@ class ShowAccessibilityHelpAction extends EditorAction {
}
EditorBrowserRegistry.registerEditorContribution(AccessibilityHelpController);
CommonEditorRegistry.registerEditorAction(new ShowAccessibilityHelpAction());
const AccessibilityHelpCommand = EditorCommand.bindToContribution<AccessibilityHelpController>(AccessibilityHelpController.get);

View file

@ -6,7 +6,7 @@
import * as nls from 'vs/nls';
import {ICommand, ICommonCodeEditor, EditorContextKeys} from 'vs/editor/common/editorCommon';
import {IActionOptions, EditorAction, CommonEditorRegistry, ServicesAccessor} from 'vs/editor/common/editorCommonExtensions';
import {IActionOptions, editorAction, EditorAction, ServicesAccessor} from 'vs/editor/common/editorCommonExtensions';
import {MoveCarretCommand} from './moveCarretCommand';
class MoveCarretAction extends EditorAction {
@ -32,8 +32,8 @@ class MoveCarretAction extends EditorAction {
}
}
@editorAction
class MoveCarretLeftAction extends MoveCarretAction {
constructor() {
super(true, {
id: 'editor.action.moveCarretLeftAction',
@ -44,8 +44,8 @@ class MoveCarretLeftAction extends MoveCarretAction {
}
}
@editorAction
class MoveCarretRightAction extends MoveCarretAction {
constructor() {
super(false, {
id: 'editor.action.moveCarretRightAction',
@ -55,6 +55,3 @@ class MoveCarretRightAction extends MoveCarretAction {
});
}
}
CommonEditorRegistry.registerEditorAction(new MoveCarretLeftAction());
CommonEditorRegistry.registerEditorAction(new MoveCarretRightAction());

View file

@ -12,12 +12,19 @@ import * as browser from 'vs/base/browser/browser';
import {ServicesAccessor} from 'vs/platform/instantiation/common/instantiation';
import {findFocusedEditor} from 'vs/editor/common/config/config';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {IActionOptions, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, IActionOptions, EditorAction} from 'vs/editor/common/editorCommonExtensions';
import EditorContextKeys = editorCommon.EditorContextKeys;
const CLIPBOARD_CONTEXT_MENU_GROUP = '9_cutcopypaste';
function conditionalEditorAction(testCommand:string) {
if (!browser.supportsExecCommand(testCommand)) {
return () => {};
}
return editorAction;
}
abstract class ExecCommandAction extends EditorAction {
private browserCommand:string;
@ -44,6 +51,7 @@ abstract class ExecCommandAction extends EditorAction {
}
}
@conditionalEditorAction('cut')
class ExecCommandCutAction extends ExecCommandAction {
constructor() {
@ -73,6 +81,7 @@ class ExecCommandCutAction extends ExecCommandAction {
}
}
@conditionalEditorAction('copy')
class ExecCommandCopyAction extends ExecCommandAction {
constructor() {
@ -102,6 +111,7 @@ class ExecCommandCopyAction extends ExecCommandAction {
}
}
@conditionalEditorAction('paste')
class ExecCommandPasteAction extends ExecCommandAction {
constructor() {
@ -122,13 +132,3 @@ class ExecCommandPasteAction extends ExecCommandAction {
});
}
}
if (browser.supportsExecCommand('cut')) {
CommonEditorRegistry.registerEditorAction(new ExecCommandCutAction());
}
if (browser.supportsExecCommand('copy')) {
CommonEditorRegistry.registerEditorAction(new ExecCommandCopyAction());
}
if (browser.supportsExecCommand('paste')) {
CommonEditorRegistry.registerEditorAction(new ExecCommandPasteAction());
}

View file

@ -7,7 +7,7 @@
import * as nls from 'vs/nls';
import {KeyCode, KeyMod} from 'vs/base/common/keyCodes';
import {ICommand, ICommonCodeEditor, EditorContextKeys} from 'vs/editor/common/editorCommon';
import {IActionOptions, EditorAction, CommonEditorRegistry, ServicesAccessor} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, IActionOptions, EditorAction, ServicesAccessor} from 'vs/editor/common/editorCommonExtensions';
import {BlockCommentCommand} from './blockCommentCommand';
import {LineCommentCommand, Type} from './lineCommentCommand';
@ -39,6 +39,7 @@ abstract class CommentLineAction extends EditorAction {
}
@editorAction
class ToggleCommentLineAction extends CommentLineAction {
constructor() {
super(Type.Toggle, {
@ -54,6 +55,7 @@ class ToggleCommentLineAction extends CommentLineAction {
}
}
@editorAction
class AddLineCommentAction extends CommentLineAction {
constructor() {
super(Type.ForceAdd, {
@ -69,6 +71,7 @@ class AddLineCommentAction extends CommentLineAction {
}
}
@editorAction
class RemoveLineCommentAction extends CommentLineAction {
constructor() {
super(Type.ForceRemove, {
@ -84,6 +87,7 @@ class RemoveLineCommentAction extends CommentLineAction {
}
}
@editorAction
class BlockCommentAction extends EditorAction {
constructor() {
@ -111,9 +115,3 @@ class BlockCommentAction extends EditorAction {
editor.executeCommands(this.id, commands);
}
}
// register actions
CommonEditorRegistry.registerEditorAction(new ToggleCommentLineAction());
CommonEditorRegistry.registerEditorAction(new AddLineCommentAction());
CommonEditorRegistry.registerEditorAction(new RemoveLineCommentAction());
CommonEditorRegistry.registerEditorAction(new BlockCommentAction());

View file

@ -16,7 +16,7 @@ import {IContextMenuService, IContextViewService} from 'vs/platform/contextview/
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IMenuService, IMenu, MenuId} from 'vs/platform/actions/common/actions';
import {ICommonCodeEditor, IEditorContribution, MouseTargetType, EditorContextKeys} from 'vs/editor/common/editorCommon';
import {ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction} from 'vs/editor/common/editorCommonExtensions';
import {ICodeEditor, IEditorMouseEvent} from 'vs/editor/browser/editorBrowser';
import {EditorBrowserRegistry} from 'vs/editor/browser/editorBrowserExtensions';
@ -222,6 +222,7 @@ class ContextMenuController implements IEditorContribution {
}
}
@editorAction
class ShowContextMenu extends EditorAction {
constructor() {
@ -244,4 +245,3 @@ class ShowContextMenu extends EditorAction {
}
EditorBrowserRegistry.registerEditorContribution(ContextMenuController);
CommonEditorRegistry.registerEditorAction(new ShowContextMenu());

View file

@ -19,7 +19,7 @@ import {IOSupport} from 'vs/platform/keybinding/common/keybindingResolver';
import {KbExpr, IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {Range} from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction} from 'vs/editor/common/editorCommonExtensions';
import {ICodeEditor, IOverlayWidget, IOverlayWidgetPosition, OverlayWidgetPositionPreference} from 'vs/editor/browser/editorBrowser';
import {EditorBrowserRegistry} from 'vs/editor/browser/editorBrowserExtensions';
import {CodeSnippet, getSnippetController} from 'vs/editor/contrib/snippet/common/snippet';
@ -445,6 +445,7 @@ class DefineKeybindingWidget implements IOverlayWidget {
}
}
@editorAction
export class DefineKeybindingAction extends EditorAction {
static ID = 'editor.action.defineKeybinding';
@ -485,4 +486,3 @@ function isInterestingEditorModel(editor:editorCommon.ICommonCodeEditor): boolea
}
EditorBrowserRegistry.registerEditorContribution(DefineKeybindingController);
CommonEditorRegistry.registerEditorAction(new DefineKeybindingAction());

View file

@ -12,7 +12,7 @@ import {Range} from 'vs/editor/common/core/range';
import {Selection} from 'vs/editor/common/core/selection';
import * as strings from 'vs/base/common/strings';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {ServicesAccessor, EditorAction, EditorCommand, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction, EditorCommand, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {FIND_IDS, FindModelBoundToEditorModel} from 'vs/editor/contrib/find/common/findModel';
import {FindReplaceState, FindReplaceStateChangedEvent, INewFindReplaceState} from 'vs/editor/contrib/find/common/findState';
import {DocumentHighlightProviderRegistry} from 'vs/editor/common/modes';
@ -233,6 +233,7 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
}
}
@editorAction
export class StartFindAction extends EditorAction {
constructor() {
@ -276,6 +277,7 @@ export abstract class MatchFindAction extends EditorAction {
protected abstract _run(controller:CommonFindController): boolean;
}
@editorAction
export class NextMatchFindAction extends MatchFindAction {
constructor() {
@ -297,6 +299,7 @@ export class NextMatchFindAction extends MatchFindAction {
}
}
@editorAction
export class PreviousMatchFindAction extends MatchFindAction {
constructor() {
@ -339,6 +342,7 @@ export abstract class SelectionMatchFindAction extends EditorAction {
protected abstract _run(controller:CommonFindController): boolean;
}
@editorAction
export class NextSelectionMatchFindAction extends SelectionMatchFindAction {
constructor() {
@ -359,6 +363,7 @@ export class NextSelectionMatchFindAction extends SelectionMatchFindAction {
}
}
@editorAction
export class PreviousSelectionMatchFindAction extends SelectionMatchFindAction {
constructor() {
@ -379,6 +384,7 @@ export class PreviousSelectionMatchFindAction extends SelectionMatchFindAction {
}
}
@editorAction
export class StartFindReplaceAction extends EditorAction {
constructor() {
@ -514,6 +520,7 @@ export abstract class SelectPreviousFindMatchAction extends EditorAction {
}
}
@editorAction
export class AddSelectionToNextFindMatchAction extends SelectNextFindMatchAction {
constructor() {
@ -542,6 +549,7 @@ export class AddSelectionToNextFindMatchAction extends SelectNextFindMatchAction
}
}
@editorAction
export class AddSelectionToPreviousFindMatchAction extends SelectPreviousFindMatchAction {
constructor() {
@ -566,6 +574,7 @@ export class AddSelectionToPreviousFindMatchAction extends SelectPreviousFindMat
}
}
@editorAction
export class MoveSelectionToNextFindMatchAction extends SelectNextFindMatchAction {
constructor() {
@ -594,6 +603,7 @@ export class MoveSelectionToNextFindMatchAction extends SelectNextFindMatchActio
}
}
@editorAction
export class MoveSelectionToPreviousFindMatchAction extends SelectPreviousFindMatchAction {
constructor() {
@ -644,6 +654,7 @@ export abstract class AbstractSelectHighlightsAction extends EditorAction {
}
}
@editorAction
export class SelectHighlightsAction extends AbstractSelectHighlightsAction {
constructor() {
super({
@ -659,6 +670,7 @@ export class SelectHighlightsAction extends AbstractSelectHighlightsAction {
}
}
@editorAction
export class CompatChangeAll extends AbstractSelectHighlightsAction {
constructor() {
super({
@ -834,24 +846,6 @@ export class SelectionHighlighter extends Disposable implements editorCommon.IEd
}
}
CommonEditorRegistry.registerEditorAction(new SelectHighlightsAction());
// register SelectHighlightsAction again to replace the now removed Change All action
CommonEditorRegistry.registerEditorAction(new CompatChangeAll());
// register actions
CommonEditorRegistry.registerEditorAction(new StartFindAction());
CommonEditorRegistry.registerEditorAction(new NextMatchFindAction());
CommonEditorRegistry.registerEditorAction(new PreviousMatchFindAction());
CommonEditorRegistry.registerEditorAction(new NextSelectionMatchFindAction());
CommonEditorRegistry.registerEditorAction(new PreviousSelectionMatchFindAction());
CommonEditorRegistry.registerEditorAction(new StartFindReplaceAction());
CommonEditorRegistry.registerEditorAction(new MoveSelectionToNextFindMatchAction());
CommonEditorRegistry.registerEditorAction(new MoveSelectionToPreviousFindMatchAction());
CommonEditorRegistry.registerEditorAction(new AddSelectionToNextFindMatchAction());
CommonEditorRegistry.registerEditorAction(new AddSelectionToPreviousFindMatchAction());
const FindCommand = EditorCommand.bindToContribution<CommonFindController>(CommonFindController.getFindController);
CommonEditorRegistry.registerEditorCommand2(new FindCommand({

View file

@ -13,7 +13,7 @@ import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {TPromise} from 'vs/base/common/winjs.base';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {Range} from 'vs/editor/common/core/range';
import {ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {ICodeEditor, IEditorMouseEvent} from 'vs/editor/browser/editorBrowser';
import {EditorBrowserRegistry} from 'vs/editor/browser/editorBrowserExtensions';
import {IFoldingRange} from 'vs/editor/contrib/folding/common/foldingRange';
@ -658,6 +658,7 @@ abstract class FoldingAction extends EditorAction {
}
}
@editorAction
class UnfoldAction extends FoldingAction {
constructor() {
@ -678,6 +679,7 @@ class UnfoldAction extends FoldingAction {
}
}
@editorAction
class UnFoldRecursivelyAction extends FoldingAction {
constructor() {
@ -698,6 +700,7 @@ class UnFoldRecursivelyAction extends FoldingAction {
}
}
@editorAction
class FoldAction extends FoldingAction {
constructor() {
@ -718,6 +721,7 @@ class FoldAction extends FoldingAction {
}
}
@editorAction
class FoldRecursivelyAction extends FoldingAction {
constructor() {
@ -738,6 +742,7 @@ class FoldRecursivelyAction extends FoldingAction {
}
}
@editorAction
class FoldAllAction extends FoldingAction {
constructor() {
@ -758,6 +763,7 @@ class FoldAllAction extends FoldingAction {
}
}
@editorAction
class UnfoldAllAction extends FoldingAction {
constructor() {
@ -797,12 +803,6 @@ class FoldLevelAction extends FoldingAction {
EditorBrowserRegistry.registerEditorContribution(FoldingController);
CommonEditorRegistry.registerEditorAction(new UnfoldAction());
CommonEditorRegistry.registerEditorAction(new UnFoldRecursivelyAction());
CommonEditorRegistry.registerEditorAction(new FoldAction());
CommonEditorRegistry.registerEditorAction(new FoldRecursivelyAction());
CommonEditorRegistry.registerEditorAction(new FoldAllAction());
CommonEditorRegistry.registerEditorAction(new UnfoldAllAction());
CommonEditorRegistry.registerEditorAction(
new FoldLevelAction({
id: FoldLevelAction.ID(1),

View file

@ -11,7 +11,7 @@ import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {TPromise} from 'vs/base/common/winjs.base';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {KbExpr} from 'vs/platform/keybinding/common/keybinding';
import {ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {OnTypeFormattingEditProviderRegistry} from 'vs/editor/common/modes';
import {getOnTypeFormattingEdits, getDocumentFormattingEdits, getDocumentRangeFormattingEdits} from '../common/format';
import {EditOperationsCommand} from './formatCommand';
@ -135,6 +135,7 @@ class FormatOnType implements editorCommon.IEditorContribution {
}
}
@editorAction
export class FormatAction extends EditorAction {
constructor() {
@ -204,5 +205,4 @@ export class FormatAction extends EditorAction {
}
// register action
CommonEditorRegistry.registerEditorAction(new FormatAction());
CommonEditorRegistry.registerEditorContribution(FormatOnType);

View file

@ -21,7 +21,7 @@ import {IEditorService} from 'vs/platform/editor/common/editor';
import {IMessageService} from 'vs/platform/message/common/message';
import {Range} from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {IActionOptions, ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, IActionOptions, ServicesAccessor, EditorAction} from 'vs/editor/common/editorCommonExtensions';
import {Location, DefinitionProviderRegistry} from 'vs/editor/common/modes';
import {ICodeEditor, IEditorMouseEvent, IMouseTarget} from 'vs/editor/browser/editorBrowser';
import {EditorBrowserRegistry} from 'vs/editor/browser/editorBrowserExtensions';
@ -146,6 +146,7 @@ const goToDeclarationKb = platform.isWeb
? KeyMod.CtrlCmd | KeyCode.F12
: KeyCode.F12;
@editorAction
export class GoToDefinitionAction extends DefinitionAction {
public static ID = 'editor.action.goToDeclaration';
@ -168,6 +169,7 @@ export class GoToDefinitionAction extends DefinitionAction {
}
}
@editorAction
export class OpenDefinitionToSideAction extends DefinitionAction {
public static ID = 'editor.action.openDeclarationToTheSide';
@ -186,6 +188,7 @@ export class OpenDefinitionToSideAction extends DefinitionAction {
}
}
@editorAction
export class PeekDefinitionAction extends DefinitionAction {
constructor() {
super(new DefinitionActionConfig(void 0, true, false), {
@ -485,10 +488,4 @@ class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorC
}
}
// register actions
CommonEditorRegistry.registerEditorAction(new PeekDefinitionAction());
CommonEditorRegistry.registerEditorAction(new GoToDefinitionAction());
CommonEditorRegistry.registerEditorAction(new OpenDefinitionToSideAction());
EditorBrowserRegistry.registerEditorContribution(GotoDefinitionWithMouseEditorContribution);

View file

@ -23,7 +23,7 @@ import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {Position} from 'vs/editor/common/core/position';
import {Range} from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {ServicesAccessor, IActionOptions, EditorAction, EditorCommand, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, IActionOptions, EditorAction, EditorCommand, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {ICodeEditor} from 'vs/editor/browser/editorBrowser';
import {EditorBrowserRegistry} from 'vs/editor/browser/editorBrowserExtensions';
import {ZoneWidget} from 'vs/editor/contrib/zoneWidget/browser/zoneWidget';
@ -512,6 +512,7 @@ class MarkerController implements editorCommon.IEditorContribution {
}
}
@editorAction
class NextMarkerAction extends MarkerNavigationAction {
constructor() {
super(true, {
@ -527,6 +528,7 @@ class NextMarkerAction extends MarkerNavigationAction {
}
}
@editorAction
class PrevMarkerAction extends MarkerNavigationAction {
constructor() {
super(false, {
@ -546,10 +548,6 @@ var CONTEXT_MARKERS_NAVIGATION_VISIBLE = new KbCtxKey<boolean>('markersNavigatio
const MarkerCommand = EditorCommand.bindToContribution<MarkerController>(MarkerController.getMarkerController);
// register actions
CommonEditorRegistry.registerEditorAction(new NextMarkerAction());
CommonEditorRegistry.registerEditorAction(new PrevMarkerAction());
CommonEditorRegistry.registerEditorCommand2(new MarkerCommand({
id: 'closeMarkersNavigation',
precondition: CONTEXT_MARKERS_NAVIGATION_VISIBLE,

View file

@ -14,7 +14,7 @@ import {IOpenerService} from 'vs/platform/opener/common/opener';
import {IModeService} from 'vs/editor/common/services/modeService';
import {Range} from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction} from 'vs/editor/common/editorCommonExtensions';
import {ICodeEditor, IEditorMouseEvent} from 'vs/editor/browser/editorBrowser';
import {EditorBrowserRegistry} from 'vs/editor/browser/editorBrowserExtensions';
import {ModesContentHoverWidget} from './modesContentHover';
@ -143,6 +143,7 @@ class ModesHoverController implements editorCommon.IEditorContribution {
}
}
@editorAction
class ShowHoverAction extends EditorAction {
constructor() {
@ -166,4 +167,3 @@ class ShowHoverAction extends EditorAction {
}
EditorBrowserRegistry.registerEditorContribution(ModesHoverController);
CommonEditorRegistry.registerEditorAction(new ShowHoverAction());

View file

@ -9,7 +9,7 @@ import {KeyCode, KeyMod} from 'vs/base/common/keyCodes';
import {TPromise} from 'vs/base/common/winjs.base';
import {Range} from 'vs/editor/common/core/range';
import {EditorContextKeys, IEditorContribution, CodeEditorStateFlag, ICommonCodeEditor, IModelDecorationsChangeAccessor} from 'vs/editor/common/editorCommon';
import {ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {IInplaceReplaceSupportResult} from 'vs/editor/common/modes';
import {IEditorWorkerService} from 'vs/editor/common/services/editorWorkerService';
import {InPlaceReplaceCommand} from './inPlaceReplaceCommand';
@ -125,6 +125,7 @@ class InPlaceReplaceController implements IEditorContribution {
}
}
@editorAction
class InPlaceReplaceUp extends EditorAction {
constructor() {
@ -145,6 +146,7 @@ class InPlaceReplaceUp extends EditorAction {
}
}
@editorAction
class InPlaceReplaceDown extends EditorAction {
constructor() {
@ -166,5 +168,3 @@ class InPlaceReplaceDown extends EditorAction {
}
CommonEditorRegistry.registerEditorContribution(InPlaceReplaceController);
CommonEditorRegistry.registerEditorAction(new InPlaceReplaceUp());
CommonEditorRegistry.registerEditorAction(new InPlaceReplaceDown());

View file

@ -6,11 +6,12 @@
import * as nls from 'vs/nls';
import {TPromise} from 'vs/base/common/winjs.base';
import {ICommonCodeEditor, EditorContextKeys} from 'vs/editor/common/editorCommon';
import {ServicesAccessor, IActionOptions, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, IActionOptions, EditorAction} from 'vs/editor/common/editorCommonExtensions';
import {IndentationToSpacesCommand, IndentationToTabsCommand} from 'vs/editor/contrib/indentation/common/indentationCommands';
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IModelService} from 'vs/editor/common/services/modelService';
@editorAction
export class IndentationToSpacesAction extends EditorAction {
public static ID = 'editor.action.indentationToSpaces';
@ -37,6 +38,7 @@ export class IndentationToSpacesAction extends EditorAction {
}
}
@editorAction
export class IndentationToTabsAction extends EditorAction {
public static ID = 'editor.action.indentationToTabs';
@ -102,6 +104,7 @@ export class ChangeIndentationSizeAction extends EditorAction {
}
}
@editorAction
export class IndentUsingTabs extends ChangeIndentationSizeAction {
public static ID = 'editor.action.indentUsingTabs';
@ -116,6 +119,7 @@ export class IndentUsingTabs extends ChangeIndentationSizeAction {
}
}
@editorAction
export class IndentUsingSpaces extends ChangeIndentationSizeAction {
public static ID = 'editor.action.indentUsingSpaces';
@ -130,6 +134,7 @@ export class IndentUsingSpaces extends ChangeIndentationSizeAction {
}
}
@editorAction
export class DetectIndentation extends EditorAction {
public static ID = 'editor.action.detectIndentation';
@ -156,6 +161,7 @@ export class DetectIndentation extends EditorAction {
}
}
@editorAction
export class ToggleRenderWhitespaceAction extends EditorAction {
constructor() {
@ -174,6 +180,7 @@ export class ToggleRenderWhitespaceAction extends EditorAction {
}
}
@editorAction
export class ToggleRenderControlCharacterAction extends EditorAction {
constructor() {
@ -191,12 +198,3 @@ export class ToggleRenderControlCharacterAction extends EditorAction {
});
}
}
// register actions
CommonEditorRegistry.registerEditorAction(new IndentationToSpacesAction());
CommonEditorRegistry.registerEditorAction(new IndentationToTabsAction());
CommonEditorRegistry.registerEditorAction(new IndentUsingSpaces());
CommonEditorRegistry.registerEditorAction(new IndentUsingTabs());
CommonEditorRegistry.registerEditorAction(new DetectIndentation());
CommonEditorRegistry.registerEditorAction(new ToggleRenderWhitespaceAction());
CommonEditorRegistry.registerEditorAction(new ToggleRenderControlCharacterAction());

View file

@ -9,7 +9,7 @@ import {KeyCode, KeyMod} from 'vs/base/common/keyCodes';
import {SortLinesCommand} from 'vs/editor/contrib/linesOperations/common/sortLinesCommand';
import {TrimTrailingWhitespaceCommand} from 'vs/editor/common/commands/trimTrailingWhitespaceCommand';
import {EditorContextKeys, Handler, ICommand, ICommonCodeEditor} from 'vs/editor/common/editorCommon';
import {ServicesAccessor, IActionOptions, EditorAction, HandlerEditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, IActionOptions, EditorAction, HandlerEditorAction} from 'vs/editor/common/editorCommonExtensions';
import {CopyLinesCommand} from './copyLinesCommand';
import {DeleteLinesCommand} from './deleteLinesCommand';
import {MoveLinesCommand} from './moveLinesCommand';
@ -38,6 +38,7 @@ abstract class AbstractCopyLinesAction extends EditorAction {
}
}
@editorAction
class CopyLinesUpAction extends AbstractCopyLinesAction {
constructor() {
super(false, {
@ -54,6 +55,7 @@ class CopyLinesUpAction extends AbstractCopyLinesAction {
}
}
@editorAction
class CopyLinesDownAction extends AbstractCopyLinesAction {
constructor() {
super(true, {
@ -94,6 +96,7 @@ abstract class AbstractMoveLinesAction extends EditorAction {
}
}
@editorAction
class MoveLinesUpAction extends AbstractMoveLinesAction {
constructor() {
super(false, {
@ -110,6 +113,7 @@ class MoveLinesUpAction extends AbstractMoveLinesAction {
}
}
@editorAction
class MoveLinesDownAction extends AbstractMoveLinesAction {
constructor() {
super(true, {
@ -146,6 +150,7 @@ abstract class AbstractSortLinesAction extends EditorAction {
}
}
@editorAction
class SortLinesAscendingAction extends AbstractSortLinesAction {
constructor() {
super(false, {
@ -161,6 +166,7 @@ class SortLinesAscendingAction extends AbstractSortLinesAction {
}
}
@editorAction
class SortLinesDescendingAction extends AbstractSortLinesAction {
constructor() {
super(true, {
@ -176,6 +182,7 @@ class SortLinesDescendingAction extends AbstractSortLinesAction {
}
}
@editorAction
export class TrimTrailingWhitespaceAction extends EditorAction {
public static ID = 'editor.action.trimTrailingWhitespace';
@ -251,6 +258,7 @@ abstract class AbstractRemoveLinesAction extends EditorAction {
}
}
@editorAction
class DeleteLinesAction extends AbstractRemoveLinesAction {
constructor() {
@ -279,6 +287,7 @@ class DeleteLinesAction extends AbstractRemoveLinesAction {
}
}
@editorAction
class IndentLinesAction extends HandlerEditorAction {
constructor() {
super({
@ -295,6 +304,7 @@ class IndentLinesAction extends HandlerEditorAction {
}
}
@editorAction
class OutdentLinesAction extends HandlerEditorAction {
constructor() {
super({
@ -311,6 +321,7 @@ class OutdentLinesAction extends HandlerEditorAction {
}
}
@editorAction
class InsertLineBeforeAction extends HandlerEditorAction {
constructor() {
super({
@ -327,6 +338,7 @@ class InsertLineBeforeAction extends HandlerEditorAction {
}
}
@editorAction
class InsertLineAfterAction extends HandlerEditorAction {
constructor() {
super({
@ -342,17 +354,3 @@ class InsertLineAfterAction extends HandlerEditorAction {
});
}
}
// register actions
CommonEditorRegistry.registerEditorAction(new DeleteLinesAction());
CommonEditorRegistry.registerEditorAction(new SortLinesAscendingAction());
CommonEditorRegistry.registerEditorAction(new SortLinesDescendingAction());
CommonEditorRegistry.registerEditorAction(new TrimTrailingWhitespaceAction());
CommonEditorRegistry.registerEditorAction(new MoveLinesDownAction());
CommonEditorRegistry.registerEditorAction(new MoveLinesUpAction());
CommonEditorRegistry.registerEditorAction(new CopyLinesDownAction());
CommonEditorRegistry.registerEditorAction(new CopyLinesUpAction());
CommonEditorRegistry.registerEditorAction(new IndentLinesAction());
CommonEditorRegistry.registerEditorAction(new OutdentLinesAction());
CommonEditorRegistry.registerEditorAction(new InsertLineBeforeAction());
CommonEditorRegistry.registerEditorAction(new InsertLineAfterAction());

View file

@ -16,7 +16,7 @@ import {IKeyboardEvent} from 'vs/base/browser/keyboardEvent';
import {IMessageService} from 'vs/platform/message/common/message';
import {IOpenerService} from 'vs/platform/opener/common/opener';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction} from 'vs/editor/common/editorCommonExtensions';
import {LinkProviderRegistry} from 'vs/editor/common/modes';
import {IEditorWorkerService} from 'vs/editor/common/services/editorWorkerService';
import {IEditorMouseEvent, ICodeEditor} from 'vs/editor/browser/editorBrowser';
@ -315,6 +315,7 @@ class LinkDetector implements editorCommon.IEditorContribution {
}
}
@editorAction
class OpenLinkAction extends EditorAction {
constructor() {
@ -335,5 +336,4 @@ class OpenLinkAction extends EditorAction {
}
}
CommonEditorRegistry.registerEditorAction(new OpenLinkAction());
EditorBrowserRegistry.registerEditorContribution(LinkDetector);

View file

@ -7,8 +7,9 @@
import * as nls from 'vs/nls';
import {KeyCode, KeyMod} from 'vs/base/common/keyCodes';
import {Handler, ICommonCodeEditor, EditorContextKeys, ISelection} from 'vs/editor/common/editorCommon';
import {ServicesAccessor, EditorAction, HandlerEditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction, HandlerEditorAction} from 'vs/editor/common/editorCommonExtensions';
@editorAction
class InsertCursorAbove extends HandlerEditorAction {
constructor() {
super({
@ -29,6 +30,7 @@ class InsertCursorAbove extends HandlerEditorAction {
}
}
@editorAction
class InsertCursorBelow extends HandlerEditorAction {
constructor() {
super({
@ -49,6 +51,7 @@ class InsertCursorBelow extends HandlerEditorAction {
}
}
@editorAction
class InsertCursorAtEndOfEachLineSelected extends EditorAction {
constructor() {
@ -95,9 +98,3 @@ class InsertCursorAtEndOfEachLineSelected extends EditorAction {
editor.setSelections(newSelections);
}
}
// register actions
CommonEditorRegistry.registerEditorAction(new InsertCursorAbove());
CommonEditorRegistry.registerEditorAction(new InsertCursorBelow());
CommonEditorRegistry.registerEditorAction(new InsertCursorAtEndOfEachLineSelected());

View file

@ -10,7 +10,7 @@ import { dispose } from 'vs/base/common/lifecycle';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ICommonCodeEditor, IEditorContribution, EditorContextKeys, ModeContextKeys } from 'vs/editor/common/editorCommon';
import { KbExpr } from 'vs/platform/keybinding/common/keybinding';
import { ServicesAccessor, EditorAction, EditorCommand, CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions';
import { editorAction, ServicesAccessor, EditorAction, EditorCommand, CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { EditorBrowserRegistry } from 'vs/editor/browser/editorBrowserExtensions';
import { ParameterHintsWidget } from './parameterHintsWidget';
@ -57,6 +57,7 @@ class ParameterHintsController implements IEditorContribution {
}
}
@editorAction
export class TriggerParameterHintsAction extends EditorAction {
constructor() {
@ -83,8 +84,6 @@ const ParameterHintsCommand = EditorCommand.bindToContribution<ParameterHintsCon
EditorBrowserRegistry.registerEditorContribution(ParameterHintsController);
CommonEditorRegistry.registerEditorAction(new TriggerParameterHintsAction());
CommonEditorRegistry.registerEditorCommand2(new ParameterHintsCommand({
id: 'closeParameterHints',
precondition: Context.Visible,

View file

@ -14,7 +14,7 @@ import {IMarkerService} from 'vs/platform/markers/common/markers';
import {IMessageService} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {ICommonCodeEditor, EditorContextKeys, ModeContextKeys, IEditorContribution, IRange} from 'vs/editor/common/editorCommon';
import {ServicesAccessor, EditorAction, EditorCommand, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction, EditorCommand, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {ICodeEditor} from 'vs/editor/browser/editorBrowser';
import {EditorBrowserRegistry} from 'vs/editor/browser/editorBrowserExtensions';
import {IQuickFix2} from '../common/quickFix';
@ -114,6 +114,7 @@ export class QuickFixController implements IEditorContribution {
}
}
@editorAction
export class QuickFixAction extends EditorAction {
constructor() {
@ -139,7 +140,6 @@ var CONTEXT_QUICK_FIX_WIDGET_VISIBLE = new KbCtxKey<boolean>('quickFixWidgetVisi
const QuickFixCommand = EditorCommand.bindToContribution<QuickFixController>(QuickFixController.getQuickFixController);
// register action
CommonEditorRegistry.registerEditorAction(new QuickFixAction());
CommonEditorRegistry.registerEditorCommand2(new QuickFixCommand({
id: 'acceptQuickFixSuggestion',
precondition: CONTEXT_QUICK_FIX_WIDGET_VISIBLE,

View file

@ -1,11 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {GotoLineAction} from './gotoLine';
// Contribute Ctrl+G to "Go to line" using quick open
CommonEditorRegistry.registerEditorAction(new GotoLineAction());

View file

@ -12,7 +12,7 @@ import {IAutoFocus, Mode} from 'vs/base/parts/quickopen/common/quickOpen';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {ICodeEditor, IDiffEditor} from 'vs/editor/browser/editorBrowser';
import {BaseEditorQuickOpenAction, IDecorator} from './editorQuickOpen';
import {ServicesAccessor} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor} from 'vs/editor/common/editorCommonExtensions';
import {KeyCode, KeyMod} from 'vs/base/common/keyCodes';
import EditorContextKeys = editorCommon.EditorContextKeys;
@ -149,6 +149,7 @@ export class GotoLineEntry extends QuickOpenEntry {
}
}
@editorAction
export class GotoLineAction extends BaseEditorQuickOpenAction {
constructor() {

View file

@ -1,11 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {QuickCommandAction} from './quickCommand';
// Contribute "Quick Command" to context menu
CommonEditorRegistry.registerEditorAction(new QuickCommandAction());

View file

@ -13,7 +13,7 @@ import {IAutoFocus, Mode} from 'vs/base/parts/quickopen/common/quickOpen';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IEditorAction, ICommonCodeEditor, IEditor, EditorContextKeys} from 'vs/editor/common/editorCommon';
import {BaseEditorQuickOpenAction} from './editorQuickOpen';
import {ServicesAccessor} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor} from 'vs/editor/common/editorCommonExtensions';
import {KeyCode, KeyMod} from 'vs/base/common/keyCodes';
import * as browser from 'vs/base/browser/browser';
@ -67,6 +67,7 @@ export class EditorActionCommandEntry extends QuickOpenEntryGroup {
}
}
@editorAction
export class QuickCommandAction extends BaseEditorQuickOpenAction {
constructor() {

View file

@ -1,11 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {QuickOutlineAction} from './quickOutline';
// Contribute "Quick Outline" to context menu
CommonEditorRegistry.registerEditorAction(new QuickOutlineAction());

View file

@ -17,7 +17,7 @@ import {ICommonCodeEditor, IRange, ModeContextKeys, EditorContextKeys} from 'vs/
import {SymbolInformation, SymbolKind, DocumentSymbolProviderRegistry} from 'vs/editor/common/modes';
import {BaseEditorQuickOpenAction, IDecorator} from './editorQuickOpen';
import {getDocumentSymbols, IOutline} from 'vs/editor/contrib/quickOpen/common/quickOpen';
import {ServicesAccessor} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor} from 'vs/editor/common/editorCommonExtensions';
import {KeyCode, KeyMod} from 'vs/base/common/keyCodes';
let SCOPE_PREFIX = ':';
@ -107,6 +107,7 @@ class SymbolEntry extends QuickOpenEntryGroup {
}
}
@editorAction
export class QuickOutlineAction extends BaseEditorQuickOpenAction {
constructor() {

View file

@ -16,7 +16,7 @@ import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegi
import {Position} from 'vs/editor/common/core/position';
import {Range} from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {Location} from 'vs/editor/common/modes';
import {IPeekViewService, PeekContext, getOuterEditor} from 'vs/editor/contrib/zoneWidget/browser/peekViewWidget';
import {provideReferences} from '../common/referenceSearch';
@ -54,6 +54,7 @@ export class ReferenceController implements editorCommon.IEditorContribution {
}
}
@editorAction
export class ReferenceAction extends EditorAction {
constructor() {
@ -131,7 +132,6 @@ let showReferencesCommand: ICommandHandler = (accessor:ServicesAccessor, resourc
// register action
CommonEditorRegistry.registerEditorContribution(ReferenceController);
CommonEditorRegistry.registerEditorAction(new ReferenceAction());
CommandsRegistry.registerCommand('editor.action.findReferences', findReferencesCommand);

View file

@ -15,7 +15,7 @@ import {IEventService} from 'vs/platform/event/common/event';
import {KbCtxKey, IKeybindingContextKey, IKeybindingService, KbExpr} from 'vs/platform/keybinding/common/keybinding';
import {IMessageService} from 'vs/platform/message/common/message';
import {IProgressService} from 'vs/platform/progress/common/progress';
import {ServicesAccessor, EditorAction, EditorCommand, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction, EditorCommand, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {EditorBrowserRegistry} from 'vs/editor/browser/editorBrowserExtensions';
import {IRange, ICommonCodeEditor, EditorContextKeys, ModeContextKeys, IEditorContribution} from 'vs/editor/common/editorCommon';
import {BulkEdit, createBulkEdit} from 'vs/editor/common/services/bulkEdit';
@ -145,6 +145,7 @@ class RenameController implements IEditorContribution {
// ---- action implementation
@editorAction
export class RenameAction extends EditorAction {
constructor() {
@ -173,8 +174,6 @@ EditorBrowserRegistry.registerEditorContribution(RenameController);
const RenameCommand = EditorCommand.bindToContribution<RenameController>(RenameController.get);
CommonEditorRegistry.registerEditorAction(new RenameAction());
CommonEditorRegistry.registerEditorCommand2(new RenameCommand({
id: 'acceptRenameInput',
precondition: CONTEXT_RENAME_INPUT_VISIBLE,

View file

@ -7,8 +7,9 @@
import * as nls from 'vs/nls';
import {KeyCode, KeyMod} from 'vs/base/common/keyCodes';
import {Handler, EditorContextKeys} from 'vs/editor/common/editorCommon';
import {HandlerEditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, HandlerEditorAction} from 'vs/editor/common/editorCommonExtensions';
@editorAction
class SelectBracketAction extends HandlerEditorAction {
constructor() {
super({
@ -24,6 +25,3 @@ class SelectBracketAction extends HandlerEditorAction {
});
}
}
// register actions
CommonEditorRegistry.registerEditorAction(new SelectBracketAction());

View file

@ -11,7 +11,7 @@ import {TPromise} from 'vs/base/common/winjs.base';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {Range} from 'vs/editor/common/core/range';
import {ICommonCodeEditor, ICursorPositionChangedEvent, EditorContextKeys, IEditorContribution} from 'vs/editor/common/editorCommon';
import {ServicesAccessor, IActionOptions, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, IActionOptions, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {TokenSelectionSupport, ILogicalSelectionEntry} from './tokenSelectionSupport';
// --- selection state machine
@ -156,6 +156,7 @@ abstract class AbstractSmartSelect extends EditorAction {
}
}
@editorAction
class GrowSelectionAction extends AbstractSmartSelect {
constructor() {
super(true, {
@ -172,6 +173,7 @@ class GrowSelectionAction extends AbstractSmartSelect {
}
}
@editorAction
class ShrinkSelectionAction extends AbstractSmartSelect {
constructor() {
super(false, {
@ -190,5 +192,3 @@ class ShrinkSelectionAction extends AbstractSmartSelect {
// register actions
CommonEditorRegistry.registerEditorContribution(SmartSelectController);
CommonEditorRegistry.registerEditorAction(new GrowSelectionAction());
CommonEditorRegistry.registerEditorAction(new ShrinkSelectionAction());

View file

@ -10,7 +10,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { KbExpr } from 'vs/platform/keybinding/common/keybinding';
import { ICommonCodeEditor, IEditorContribution, EditorContextKeys, ModeContextKeys } from 'vs/editor/common/editorCommon';
import { ServicesAccessor, EditorAction, EditorCommand, CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions';
import { editorAction, ServicesAccessor, EditorAction, EditorCommand, CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions';
import { ISuggestSupport, SuggestRegistry } from 'vs/editor/common/modes';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { EditorBrowserRegistry } from 'vs/editor/browser/editorBrowserExtensions';
@ -179,6 +179,7 @@ export class SuggestController implements IEditorContribution {
}
}
@editorAction
export class TriggerSuggestAction extends EditorAction {
constructor() {
@ -200,8 +201,6 @@ export class TriggerSuggestAction extends EditorAction {
}
}
CommonEditorRegistry.registerEditorAction(new TriggerSuggestAction());
const weight = CommonEditorRegistry.commandWeight(90);
const SuggestCommand = EditorCommand.bindToContribution<SuggestController>(SuggestController.getController);

View file

@ -8,7 +8,7 @@ import * as nls from 'vs/nls';
import {Registry} from 'vs/platform/platform';
import {TPromise} from 'vs/base/common/winjs.base';
import {ICommonCodeEditor, EditorContextKeys} from 'vs/editor/common/editorCommon';
import {ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction} from 'vs/editor/common/editorCommonExtensions';
import {getSnippetController, CodeSnippet} from 'vs/editor/contrib/snippet/common/snippet';
import {IQuickOpenService, IPickOpenEntry} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {ISnippetsRegistry, Extensions, ISnippet} from 'vs/editor/common/modes/snippetsRegistry';
@ -17,6 +17,7 @@ interface ISnippetPick extends IPickOpenEntry {
snippet: ISnippet;
}
@editorAction
class ShowSnippetsActions extends EditorAction {
constructor() {
@ -52,5 +53,3 @@ class ShowSnippetsActions extends EditorAction {
});
}
}
CommonEditorRegistry.registerEditorAction(new ShowSnippetsActions());

View file

@ -7,9 +7,10 @@
import * as nls from 'vs/nls';
import {KeyCode, KeyMod} from 'vs/base/common/keyCodes';
import {ICommonCodeEditor} from 'vs/editor/common/editorCommon';
import {ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction} from 'vs/editor/common/editorCommonExtensions';
import {TabFocus} from 'vs/editor/common/config/commonEditorConfig';
@editorAction
export class ToggleTabFocusModeAction extends EditorAction {
public static ID = 'editor.action.toggleTabFocusMode';
@ -33,6 +34,3 @@ export class ToggleTabFocusModeAction extends EditorAction {
TabFocus.setTabFocusMode(!oldValue);
}
}
// register actions
CommonEditorRegistry.registerEditorAction(new ToggleTabFocusModeAction());

View file

@ -7,8 +7,9 @@
import * as nls from 'vs/nls';
import {KeyCode, KeyMod} from 'vs/base/common/keyCodes';
import {ICommonCodeEditor, EditorContextKeys} from 'vs/editor/common/editorCommon';
import {ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction} from 'vs/editor/common/editorCommonExtensions';
@editorAction
class ToggleWordWrapAction extends EditorAction {
constructor() {
@ -40,6 +41,3 @@ class ToggleWordWrapAction extends EditorAction {
});
}
}
// register actions
CommonEditorRegistry.registerEditorAction(new ToggleWordWrapAction());

View file

@ -6,9 +6,9 @@
'use strict';
import 'vs/editor/browser/editor.all';
import 'vs/editor/contrib/quickOpen/browser/quickOutline.contribution';
import 'vs/editor/contrib/quickOpen/browser/gotoLine.contribution';
import 'vs/editor/contrib/quickOpen/browser/quickCommand.contribution';
import 'vs/editor/contrib/quickOpen/browser/quickOutline';
import 'vs/editor/contrib/quickOpen/browser/gotoLine';
import 'vs/editor/contrib/quickOpen/browser/quickCommand';
import 'vs/languages/languages.main';
import 'vs/languages/php/common/php.contribution';

View file

@ -8,8 +8,9 @@
import nls = require('vs/nls');
import {BasicEmmetEditorAction} from 'vs/workbench/parts/emmet/node/emmetActions';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction} from 'vs/editor/common/editorCommonExtensions';
@editorAction
class BalanceInwardAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -21,6 +22,7 @@ class BalanceInwardAction extends BasicEmmetEditorAction {
}
}
@editorAction
class BalanceOutwardAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -31,6 +33,3 @@ class BalanceOutwardAction extends BasicEmmetEditorAction {
);
}
}
CommonEditorRegistry.registerEditorAction(new BalanceInwardAction());
CommonEditorRegistry.registerEditorAction(new BalanceOutwardAction());

View file

@ -14,12 +14,13 @@ import {dirname, join, normalize, isValidBasename} from 'vs/base/common/paths';
import {EmmetEditorAction, EmmetActionContext} from 'vs/workbench/parts/emmet/node/emmetActions';
import {Action} from 'vs/base/common/actions';
import {ServicesAccessor, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {ServicesAccessor, editorAction} from 'vs/editor/common/editorCommonExtensions';
import {EditorContextKeys} from 'vs/editor/common/editorCommon';
import {IMessageService, Severity} from 'vs/platform/message/common/message';
import {IQuickOpenService, IInputOptions} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IWorkspaceContextService} from 'vs/workbench/services/workspace/common/contextService';
@editorAction
class EncodeDecodeDataUrlAction extends EmmetEditorAction {
private imageFilePath: string = null;
@ -134,5 +135,3 @@ class EncodeDecodeDataUrlAction extends EmmetEditorAction {
return /(?:src=|url\()['"]?data:/.test(data);
}
}
CommonEditorRegistry.registerEditorAction(new EncodeDecodeDataUrlAction());

View file

@ -8,8 +8,9 @@
import nls = require('vs/nls');
import {BasicEmmetEditorAction} from 'vs/workbench/parts/emmet/node/emmetActions';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction} from 'vs/editor/common/editorCommonExtensions';
@editorAction
class PreviousEditPointAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -21,6 +22,7 @@ class PreviousEditPointAction extends BasicEmmetEditorAction {
}
}
@editorAction
class NextEditPointAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -31,6 +33,3 @@ class NextEditPointAction extends BasicEmmetEditorAction {
);
}
}
CommonEditorRegistry.registerEditorAction(new PreviousEditPointAction());
CommonEditorRegistry.registerEditorAction(new NextEditPointAction());

View file

@ -8,8 +8,9 @@
import nls = require('vs/nls');
import {BasicEmmetEditorAction} from 'vs/workbench/parts/emmet/node/emmetActions';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction} from 'vs/editor/common/editorCommonExtensions';
@editorAction
class EvaluateMathAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -20,5 +21,3 @@ class EvaluateMathAction extends BasicEmmetEditorAction {
);
}
}
CommonEditorRegistry.registerEditorAction(new EvaluateMathAction());

View file

@ -8,12 +8,13 @@
import nls = require('vs/nls');
import {BasicEmmetEditorAction} from 'vs/workbench/parts/emmet/node/emmetActions';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction} from 'vs/editor/common/editorCommonExtensions';
import {Handler, ICommonCodeEditor, EditorContextKeys} from 'vs/editor/common/editorCommon';
import {KeyCode} from 'vs/base/common/keyCodes';
import {KbExpr} from 'vs/platform/keybinding/common/keybinding';
@editorAction
class ExpandAbbreviationAction extends BasicEmmetEditorAction {
constructor() {
@ -40,5 +41,3 @@ class ExpandAbbreviationAction extends BasicEmmetEditorAction {
editor.trigger('emmet', Handler.Tab, {});
}
}
CommonEditorRegistry.registerEditorAction(new ExpandAbbreviationAction());

View file

@ -8,8 +8,9 @@
import nls = require('vs/nls');
import {BasicEmmetEditorAction} from 'vs/workbench/parts/emmet/node/emmetActions';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction} from 'vs/editor/common/editorCommonExtensions';
@editorAction
class IncrementNumberByOneTenthAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -21,6 +22,7 @@ class IncrementNumberByOneTenthAction extends BasicEmmetEditorAction {
}
}
@editorAction
class IncrementNumberByOneAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -32,6 +34,7 @@ class IncrementNumberByOneAction extends BasicEmmetEditorAction {
}
}
@editorAction
class IncrementNumberByTenAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -43,6 +46,7 @@ class IncrementNumberByTenAction extends BasicEmmetEditorAction {
}
}
@editorAction
class DecrementNumberByOneTenthAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -54,6 +58,7 @@ class DecrementNumberByOneTenthAction extends BasicEmmetEditorAction {
}
}
@editorAction
class DecrementNumberByOneAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -65,6 +70,7 @@ class DecrementNumberByOneAction extends BasicEmmetEditorAction {
}
}
@editorAction
class DecrementNumberByTenAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -75,10 +81,3 @@ class DecrementNumberByTenAction extends BasicEmmetEditorAction {
);
}
}
CommonEditorRegistry.registerEditorAction(new IncrementNumberByOneTenthAction());
CommonEditorRegistry.registerEditorAction(new IncrementNumberByOneAction());
CommonEditorRegistry.registerEditorAction(new IncrementNumberByTenAction());
CommonEditorRegistry.registerEditorAction(new DecrementNumberByOneTenthAction());
CommonEditorRegistry.registerEditorAction(new DecrementNumberByOneAction());
CommonEditorRegistry.registerEditorAction(new DecrementNumberByTenAction());

View file

@ -8,8 +8,9 @@
import nls = require('vs/nls');
import {BasicEmmetEditorAction} from 'vs/workbench/parts/emmet/node/emmetActions';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction} from 'vs/editor/common/editorCommonExtensions';
@editorAction
class GoToMatchingPairAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -20,5 +21,3 @@ class GoToMatchingPairAction extends BasicEmmetEditorAction {
);
}
}
CommonEditorRegistry.registerEditorAction(new GoToMatchingPairAction());

View file

@ -8,8 +8,9 @@
import nls = require('vs/nls');
import {BasicEmmetEditorAction} from 'vs/workbench/parts/emmet/node/emmetActions';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction} from 'vs/editor/common/editorCommonExtensions';
@editorAction
class MergeLinesAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -20,5 +21,3 @@ class MergeLinesAction extends BasicEmmetEditorAction {
);
}
}
CommonEditorRegistry.registerEditorAction(new MergeLinesAction());

View file

@ -8,8 +8,9 @@
import nls = require('vs/nls');
import {BasicEmmetEditorAction} from 'vs/workbench/parts/emmet/node/emmetActions';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction} from 'vs/editor/common/editorCommonExtensions';
@editorAction
class ReflectCSSValueAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -20,5 +21,3 @@ class ReflectCSSValueAction extends BasicEmmetEditorAction {
);
}
}
CommonEditorRegistry.registerEditorAction(new ReflectCSSValueAction());

View file

@ -8,8 +8,9 @@
import nls = require('vs/nls');
import {BasicEmmetEditorAction} from 'vs/workbench/parts/emmet/node/emmetActions';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction} from 'vs/editor/common/editorCommonExtensions';
@editorAction
class RemoveTagAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -20,5 +21,3 @@ class RemoveTagAction extends BasicEmmetEditorAction {
);
}
}
CommonEditorRegistry.registerEditorAction(new RemoveTagAction());

View file

@ -8,8 +8,9 @@
import nls = require('vs/nls');
import {BasicEmmetEditorAction} from 'vs/workbench/parts/emmet/node/emmetActions';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction} from 'vs/editor/common/editorCommonExtensions';
@editorAction
class SelectPreviousItemAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -21,6 +22,7 @@ class SelectPreviousItemAction extends BasicEmmetEditorAction {
}
}
@editorAction
class SelectNextItemAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -31,6 +33,3 @@ class SelectNextItemAction extends BasicEmmetEditorAction {
);
}
}
CommonEditorRegistry.registerEditorAction(new SelectPreviousItemAction());
CommonEditorRegistry.registerEditorAction(new SelectNextItemAction());

View file

@ -8,8 +8,9 @@
import nls = require('vs/nls');
import {BasicEmmetEditorAction} from 'vs/workbench/parts/emmet/node/emmetActions';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction} from 'vs/editor/common/editorCommonExtensions';
@editorAction
class SplitJoinTagAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -20,5 +21,3 @@ class SplitJoinTagAction extends BasicEmmetEditorAction {
);
}
}
CommonEditorRegistry.registerEditorAction(new SplitJoinTagAction());

View file

@ -8,8 +8,9 @@
import nls = require('vs/nls');
import {BasicEmmetEditorAction} from 'vs/workbench/parts/emmet/node/emmetActions';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction} from 'vs/editor/common/editorCommonExtensions';
@editorAction
class ToggleCommentAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -20,5 +21,3 @@ class ToggleCommentAction extends BasicEmmetEditorAction {
);
}
}
CommonEditorRegistry.registerEditorAction(new ToggleCommentAction());

View file

@ -8,8 +8,9 @@
import nls = require('vs/nls');
import {BasicEmmetEditorAction} from 'vs/workbench/parts/emmet/node/emmetActions';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {editorAction} from 'vs/editor/common/editorCommonExtensions';
@editorAction
class UpdateImageSizeAction extends BasicEmmetEditorAction {
constructor() {
super(
@ -20,5 +21,3 @@ class UpdateImageSizeAction extends BasicEmmetEditorAction {
);
}
}
CommonEditorRegistry.registerEditorAction(new UpdateImageSizeAction());

View file

@ -8,10 +8,11 @@
import nls = require('vs/nls');
import {EmmetEditorAction, EmmetActionContext} from 'vs/workbench/parts/emmet/node/emmetActions';
import {ServicesAccessor, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {ServicesAccessor, editorAction} from 'vs/editor/common/editorCommonExtensions';
import {EditorContextKeys} from 'vs/editor/common/editorCommon';
import {IQuickOpenService, IInputOptions} from 'vs/workbench/services/quickopen/common/quickOpenService';
@editorAction
class UpdateTagAction extends EmmetEditorAction {
constructor() {
@ -42,5 +43,3 @@ class UpdateTagAction extends EmmetEditorAction {
}
}
}
CommonEditorRegistry.registerEditorAction(new UpdateTagAction());

View file

@ -8,10 +8,11 @@
import nls = require('vs/nls');
import {EmmetEditorAction, EmmetActionContext} from 'vs/workbench/parts/emmet/node/emmetActions';
import {ServicesAccessor, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {ServicesAccessor, editorAction} from 'vs/editor/common/editorCommonExtensions';
import {EditorContextKeys} from 'vs/editor/common/editorCommon';
import {IQuickOpenService, IInputOptions} from 'vs/workbench/services/quickopen/common/quickOpenService';
@editorAction
class WrapWithAbbreviationAction extends EmmetEditorAction {
constructor() {
@ -41,5 +42,3 @@ class WrapWithAbbreviationAction extends EmmetEditorAction {
}
}
}
CommonEditorRegistry.registerEditorAction(new WrapWithAbbreviationAction());