From 7f6ed014fd04ec6496d3aae53435f6129cc95235 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 9 Aug 2016 17:55:05 +0200 Subject: [PATCH] Adopt @editorAction --- .../editor/common/editorCommonExtensions.ts | 141 +++++++++--------- .../accessibility/browser/accessibility.ts | 4 +- .../common/carretOperations.ts | 9 +- .../contrib/clipboard/browser/clipboard.ts | 22 +-- .../editor/contrib/comment/common/comment.ts | 12 +- .../contextmenu/browser/contextmenu.ts | 4 +- .../browser/defineKeybinding.ts | 4 +- .../contrib/find/common/findController.ts | 32 ++-- .../editor/contrib/folding/browser/folding.ts | 14 +- .../contrib/format/common/formatActions.ts | 4 +- .../browser/goToDeclaration.ts | 11 +- .../contrib/gotoError/browser/gotoError.ts | 8 +- src/vs/editor/contrib/hover/browser/hover.ts | 4 +- .../inPlaceReplace/common/inPlaceReplace.ts | 6 +- .../contrib/indentation/common/indentation.ts | 18 +-- .../linesOperations/common/linesOperations.ts | 28 ++-- src/vs/editor/contrib/links/browser/links.ts | 4 +- .../contrib/multicursor/common/multicursor.ts | 11 +- .../parameterHints/browser/parameterHints.ts | 5 +- .../contrib/quickFix/browser/quickFix.ts | 4 +- .../browser/gotoLine.contribution.ts | 11 -- .../contrib/quickOpen/browser/gotoLine.ts | 3 +- .../browser/quickCommand.contribution.ts | 11 -- .../contrib/quickOpen/browser/quickCommand.ts | 3 +- .../browser/quickOutline.contribution.ts | 11 -- .../contrib/quickOpen/browser/quickOutline.ts | 3 +- .../browser/referenceSearch.ts | 4 +- .../editor/contrib/rename/browser/rename.ts | 5 +- .../smartSelect/common/jumpToBracket.ts | 6 +- .../contrib/smartSelect/common/smartSelect.ts | 6 +- .../editor/contrib/suggest/browser/suggest.ts | 5 +- .../electron-browser/snippetCompletion.ts | 5 +- .../common/toggleTabFocusMode.ts | 6 +- .../toggleWordWrap/common/toggleWordWrap.ts | 6 +- src/vs/editor/editor.main.ts | 6 +- .../parts/emmet/node/actions/balance.ts | 7 +- .../parts/emmet/node/actions/base64.ts | 5 +- .../parts/emmet/node/actions/editPoints.ts | 7 +- .../parts/emmet/node/actions/evaluateMath.ts | 5 +- .../emmet/node/actions/expandAbbreviation.ts | 5 +- .../emmet/node/actions/incrementDecrement.ts | 15 +- .../parts/emmet/node/actions/matchingPair.ts | 5 +- .../parts/emmet/node/actions/mergeLines.ts | 5 +- .../emmet/node/actions/reflectCssValue.ts | 5 +- .../parts/emmet/node/actions/removeTag.ts | 5 +- .../parts/emmet/node/actions/selectItem.ts | 7 +- .../parts/emmet/node/actions/splitJoinTag.ts | 5 +- .../parts/emmet/node/actions/toggleComment.ts | 5 +- .../emmet/node/actions/updateImageSize.ts | 5 +- .../parts/emmet/node/actions/updateTag.ts | 5 +- .../node/actions/wrapWithAbbreviation.ts | 5 +- 51 files changed, 229 insertions(+), 303 deletions(-) delete mode 100644 src/vs/editor/contrib/quickOpen/browser/gotoLine.contribution.ts delete mode 100644 src/vs/editor/contrib/quickOpen/browser/quickCommand.contribution.ts delete mode 100644 src/vs/editor/contrib/quickOpen/browser/quickOutline.contribution.ts diff --git a/src/vs/editor/common/editorCommonExtensions.ts b/src/vs/editor/common/editorCommonExtensions.ts index 674f57e9d7c..a2dae07324b 100644 --- a/src/vs/editor/common/editorCommonExtensions.ts +++ b/src/vs/editor/common/editorCommonExtensions.ts @@ -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 { + 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; +} + +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) { - (Registry.as(Extensions.EditorCommonContributions)).registerEditorAction(desc); - } + // --- Editor Actions + export function registerEditorAction(desc:EditorAction) { + EditorContributionRegistry.INSTANCE.registerEditorAction(desc); + } export function getEditorActions(): EditorAction[] { - return (Registry.as(Extensions.EditorCommonContributions)).getEditorActions(); + return EditorContributionRegistry.INSTANCE.getEditorActions(); } // --- Editor Contributions + export function registerEditorContribution(ctor:editorCommon.ICommonEditorContributionCtor): void { - (Registry.as(Extensions.EditorCommonContributions)).registerEditorContribution(ctor); + EditorContributionRegistry.INSTANCE.registerEditorContribution(ctor); } export function getEditorContributions(): editorCommon.ICommonEditorContributionDescriptor[] { - return (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 { - 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; -} - -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); diff --git a/src/vs/editor/contrib/accessibility/browser/accessibility.ts b/src/vs/editor/contrib/accessibility/browser/accessibility.ts index e9cd898f392..369a9a869a4 100644 --- a/src/vs/editor/contrib/accessibility/browser/accessibility.ts +++ b/src/vs/editor/contrib/accessibility/browser/accessibility.ts @@ -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.get); diff --git a/src/vs/editor/contrib/carretOperations/common/carretOperations.ts b/src/vs/editor/contrib/carretOperations/common/carretOperations.ts index d4d65e4a236..251af962f86 100644 --- a/src/vs/editor/contrib/carretOperations/common/carretOperations.ts +++ b/src/vs/editor/contrib/carretOperations/common/carretOperations.ts @@ -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()); diff --git a/src/vs/editor/contrib/clipboard/browser/clipboard.ts b/src/vs/editor/contrib/clipboard/browser/clipboard.ts index 70c84fd1a10..68b33563051 100644 --- a/src/vs/editor/contrib/clipboard/browser/clipboard.ts +++ b/src/vs/editor/contrib/clipboard/browser/clipboard.ts @@ -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()); -} diff --git a/src/vs/editor/contrib/comment/common/comment.ts b/src/vs/editor/contrib/comment/common/comment.ts index 52734889e44..8c0903f9333 100644 --- a/src/vs/editor/contrib/comment/common/comment.ts +++ b/src/vs/editor/contrib/comment/common/comment.ts @@ -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()); diff --git a/src/vs/editor/contrib/contextmenu/browser/contextmenu.ts b/src/vs/editor/contrib/contextmenu/browser/contextmenu.ts index 142f6aaaed7..ab90edfe85b 100644 --- a/src/vs/editor/contrib/contextmenu/browser/contextmenu.ts +++ b/src/vs/editor/contrib/contextmenu/browser/contextmenu.ts @@ -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()); diff --git a/src/vs/editor/contrib/defineKeybinding/browser/defineKeybinding.ts b/src/vs/editor/contrib/defineKeybinding/browser/defineKeybinding.ts index d058372e46f..13a88a447de 100644 --- a/src/vs/editor/contrib/defineKeybinding/browser/defineKeybinding.ts +++ b/src/vs/editor/contrib/defineKeybinding/browser/defineKeybinding.ts @@ -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()); diff --git a/src/vs/editor/contrib/find/common/findController.ts b/src/vs/editor/contrib/find/common/findController.ts index c9b8e847be8..0223616c6f7 100644 --- a/src/vs/editor/contrib/find/common/findController.ts +++ b/src/vs/editor/contrib/find/common/findController.ts @@ -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.getFindController); CommonEditorRegistry.registerEditorCommand2(new FindCommand({ diff --git a/src/vs/editor/contrib/folding/browser/folding.ts b/src/vs/editor/contrib/folding/browser/folding.ts index fd815a46fa9..5a852780591 100644 --- a/src/vs/editor/contrib/folding/browser/folding.ts +++ b/src/vs/editor/contrib/folding/browser/folding.ts @@ -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), diff --git a/src/vs/editor/contrib/format/common/formatActions.ts b/src/vs/editor/contrib/format/common/formatActions.ts index 0f6d0897893..e734d15c806 100644 --- a/src/vs/editor/contrib/format/common/formatActions.ts +++ b/src/vs/editor/contrib/format/common/formatActions.ts @@ -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); diff --git a/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts b/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts index f8c38cad4a8..e67f27f6245 100644 --- a/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts +++ b/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts @@ -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); diff --git a/src/vs/editor/contrib/gotoError/browser/gotoError.ts b/src/vs/editor/contrib/gotoError/browser/gotoError.ts index 42f45318cbf..681db22853e 100644 --- a/src/vs/editor/contrib/gotoError/browser/gotoError.ts +++ b/src/vs/editor/contrib/gotoError/browser/gotoError.ts @@ -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('markersNavigatio const MarkerCommand = EditorCommand.bindToContribution(MarkerController.getMarkerController); -// register actions -CommonEditorRegistry.registerEditorAction(new NextMarkerAction()); -CommonEditorRegistry.registerEditorAction(new PrevMarkerAction()); - CommonEditorRegistry.registerEditorCommand2(new MarkerCommand({ id: 'closeMarkersNavigation', precondition: CONTEXT_MARKERS_NAVIGATION_VISIBLE, diff --git a/src/vs/editor/contrib/hover/browser/hover.ts b/src/vs/editor/contrib/hover/browser/hover.ts index 74a092f59b0..7a95a5f17db 100644 --- a/src/vs/editor/contrib/hover/browser/hover.ts +++ b/src/vs/editor/contrib/hover/browser/hover.ts @@ -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()); diff --git a/src/vs/editor/contrib/inPlaceReplace/common/inPlaceReplace.ts b/src/vs/editor/contrib/inPlaceReplace/common/inPlaceReplace.ts index 43e4aecb1e9..7838861dc03 100644 --- a/src/vs/editor/contrib/inPlaceReplace/common/inPlaceReplace.ts +++ b/src/vs/editor/contrib/inPlaceReplace/common/inPlaceReplace.ts @@ -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()); diff --git a/src/vs/editor/contrib/indentation/common/indentation.ts b/src/vs/editor/contrib/indentation/common/indentation.ts index c6b707ab2e0..6c00fb8a395 100644 --- a/src/vs/editor/contrib/indentation/common/indentation.ts +++ b/src/vs/editor/contrib/indentation/common/indentation.ts @@ -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()); diff --git a/src/vs/editor/contrib/linesOperations/common/linesOperations.ts b/src/vs/editor/contrib/linesOperations/common/linesOperations.ts index ae85adae194..cf636c0ef3c 100644 --- a/src/vs/editor/contrib/linesOperations/common/linesOperations.ts +++ b/src/vs/editor/contrib/linesOperations/common/linesOperations.ts @@ -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()); diff --git a/src/vs/editor/contrib/links/browser/links.ts b/src/vs/editor/contrib/links/browser/links.ts index 88914b3f5e1..a5016e4f8bf 100644 --- a/src/vs/editor/contrib/links/browser/links.ts +++ b/src/vs/editor/contrib/links/browser/links.ts @@ -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); diff --git a/src/vs/editor/contrib/multicursor/common/multicursor.ts b/src/vs/editor/contrib/multicursor/common/multicursor.ts index 53e5633df4e..dcc5e9195e7 100644 --- a/src/vs/editor/contrib/multicursor/common/multicursor.ts +++ b/src/vs/editor/contrib/multicursor/common/multicursor.ts @@ -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()); diff --git a/src/vs/editor/contrib/parameterHints/browser/parameterHints.ts b/src/vs/editor/contrib/parameterHints/browser/parameterHints.ts index 103c9fd020a..9df7851e2de 100644 --- a/src/vs/editor/contrib/parameterHints/browser/parameterHints.ts +++ b/src/vs/editor/contrib/parameterHints/browser/parameterHints.ts @@ -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('quickFixWidgetVisi const QuickFixCommand = EditorCommand.bindToContribution(QuickFixController.getQuickFixController); // register action -CommonEditorRegistry.registerEditorAction(new QuickFixAction()); CommonEditorRegistry.registerEditorCommand2(new QuickFixCommand({ id: 'acceptQuickFixSuggestion', precondition: CONTEXT_QUICK_FIX_WIDGET_VISIBLE, diff --git a/src/vs/editor/contrib/quickOpen/browser/gotoLine.contribution.ts b/src/vs/editor/contrib/quickOpen/browser/gotoLine.contribution.ts deleted file mode 100644 index 988fb94b458..00000000000 --- a/src/vs/editor/contrib/quickOpen/browser/gotoLine.contribution.ts +++ /dev/null @@ -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()); \ No newline at end of file diff --git a/src/vs/editor/contrib/quickOpen/browser/gotoLine.ts b/src/vs/editor/contrib/quickOpen/browser/gotoLine.ts index 73d56ff6e9e..97e445cf992 100644 --- a/src/vs/editor/contrib/quickOpen/browser/gotoLine.ts +++ b/src/vs/editor/contrib/quickOpen/browser/gotoLine.ts @@ -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() { diff --git a/src/vs/editor/contrib/quickOpen/browser/quickCommand.contribution.ts b/src/vs/editor/contrib/quickOpen/browser/quickCommand.contribution.ts deleted file mode 100644 index 11ded4cd2fc..00000000000 --- a/src/vs/editor/contrib/quickOpen/browser/quickCommand.contribution.ts +++ /dev/null @@ -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()); diff --git a/src/vs/editor/contrib/quickOpen/browser/quickCommand.ts b/src/vs/editor/contrib/quickOpen/browser/quickCommand.ts index 6a2dcf7db28..2217475a621 100644 --- a/src/vs/editor/contrib/quickOpen/browser/quickCommand.ts +++ b/src/vs/editor/contrib/quickOpen/browser/quickCommand.ts @@ -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() { diff --git a/src/vs/editor/contrib/quickOpen/browser/quickOutline.contribution.ts b/src/vs/editor/contrib/quickOpen/browser/quickOutline.contribution.ts deleted file mode 100644 index e4a6b39fdd6..00000000000 --- a/src/vs/editor/contrib/quickOpen/browser/quickOutline.contribution.ts +++ /dev/null @@ -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()); diff --git a/src/vs/editor/contrib/quickOpen/browser/quickOutline.ts b/src/vs/editor/contrib/quickOpen/browser/quickOutline.ts index ad476c40f4f..a9cd9b60fa3 100644 --- a/src/vs/editor/contrib/quickOpen/browser/quickOutline.ts +++ b/src/vs/editor/contrib/quickOpen/browser/quickOutline.ts @@ -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() { diff --git a/src/vs/editor/contrib/referenceSearch/browser/referenceSearch.ts b/src/vs/editor/contrib/referenceSearch/browser/referenceSearch.ts index 35fc30d5343..551e9a1e303 100644 --- a/src/vs/editor/contrib/referenceSearch/browser/referenceSearch.ts +++ b/src/vs/editor/contrib/referenceSearch/browser/referenceSearch.ts @@ -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); diff --git a/src/vs/editor/contrib/rename/browser/rename.ts b/src/vs/editor/contrib/rename/browser/rename.ts index baef75a4728..ba5c275f987 100644 --- a/src/vs/editor/contrib/rename/browser/rename.ts +++ b/src/vs/editor/contrib/rename/browser/rename.ts @@ -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.get); -CommonEditorRegistry.registerEditorAction(new RenameAction()); - CommonEditorRegistry.registerEditorCommand2(new RenameCommand({ id: 'acceptRenameInput', precondition: CONTEXT_RENAME_INPUT_VISIBLE, diff --git a/src/vs/editor/contrib/smartSelect/common/jumpToBracket.ts b/src/vs/editor/contrib/smartSelect/common/jumpToBracket.ts index 60a64e3db1d..3aa1137f93e 100644 --- a/src/vs/editor/contrib/smartSelect/common/jumpToBracket.ts +++ b/src/vs/editor/contrib/smartSelect/common/jumpToBracket.ts @@ -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()); diff --git a/src/vs/editor/contrib/smartSelect/common/smartSelect.ts b/src/vs/editor/contrib/smartSelect/common/smartSelect.ts index 705d0335f0e..26060bcf660 100644 --- a/src/vs/editor/contrib/smartSelect/common/smartSelect.ts +++ b/src/vs/editor/contrib/smartSelect/common/smartSelect.ts @@ -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()); diff --git a/src/vs/editor/contrib/suggest/browser/suggest.ts b/src/vs/editor/contrib/suggest/browser/suggest.ts index 4cb2de380e6..f19c945f63f 100644 --- a/src/vs/editor/contrib/suggest/browser/suggest.ts +++ b/src/vs/editor/contrib/suggest/browser/suggest.ts @@ -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.getController); diff --git a/src/vs/editor/contrib/suggest/electron-browser/snippetCompletion.ts b/src/vs/editor/contrib/suggest/electron-browser/snippetCompletion.ts index 370e0d139ee..396344af883 100644 --- a/src/vs/editor/contrib/suggest/electron-browser/snippetCompletion.ts +++ b/src/vs/editor/contrib/suggest/electron-browser/snippetCompletion.ts @@ -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()); diff --git a/src/vs/editor/contrib/toggleTabFocusMode/common/toggleTabFocusMode.ts b/src/vs/editor/contrib/toggleTabFocusMode/common/toggleTabFocusMode.ts index f77c6442a3f..1f7bd5cc8ec 100644 --- a/src/vs/editor/contrib/toggleTabFocusMode/common/toggleTabFocusMode.ts +++ b/src/vs/editor/contrib/toggleTabFocusMode/common/toggleTabFocusMode.ts @@ -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()); diff --git a/src/vs/editor/contrib/toggleWordWrap/common/toggleWordWrap.ts b/src/vs/editor/contrib/toggleWordWrap/common/toggleWordWrap.ts index 606ce0d0ede..77fbf077ea2 100644 --- a/src/vs/editor/contrib/toggleWordWrap/common/toggleWordWrap.ts +++ b/src/vs/editor/contrib/toggleWordWrap/common/toggleWordWrap.ts @@ -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()); diff --git a/src/vs/editor/editor.main.ts b/src/vs/editor/editor.main.ts index fead1ad0c56..3a02219caed 100644 --- a/src/vs/editor/editor.main.ts +++ b/src/vs/editor/editor.main.ts @@ -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'; diff --git a/src/vs/workbench/parts/emmet/node/actions/balance.ts b/src/vs/workbench/parts/emmet/node/actions/balance.ts index 8db40aee781..f976be03aba 100644 --- a/src/vs/workbench/parts/emmet/node/actions/balance.ts +++ b/src/vs/workbench/parts/emmet/node/actions/balance.ts @@ -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()); diff --git a/src/vs/workbench/parts/emmet/node/actions/base64.ts b/src/vs/workbench/parts/emmet/node/actions/base64.ts index 1204acbb643..8c6e655e727 100644 --- a/src/vs/workbench/parts/emmet/node/actions/base64.ts +++ b/src/vs/workbench/parts/emmet/node/actions/base64.ts @@ -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()); diff --git a/src/vs/workbench/parts/emmet/node/actions/editPoints.ts b/src/vs/workbench/parts/emmet/node/actions/editPoints.ts index ac90ce28525..8cea6a07167 100644 --- a/src/vs/workbench/parts/emmet/node/actions/editPoints.ts +++ b/src/vs/workbench/parts/emmet/node/actions/editPoints.ts @@ -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()); diff --git a/src/vs/workbench/parts/emmet/node/actions/evaluateMath.ts b/src/vs/workbench/parts/emmet/node/actions/evaluateMath.ts index b22c474ca5b..8253d0985d6 100644 --- a/src/vs/workbench/parts/emmet/node/actions/evaluateMath.ts +++ b/src/vs/workbench/parts/emmet/node/actions/evaluateMath.ts @@ -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()); diff --git a/src/vs/workbench/parts/emmet/node/actions/expandAbbreviation.ts b/src/vs/workbench/parts/emmet/node/actions/expandAbbreviation.ts index 9b53658b561..219d30254b6 100644 --- a/src/vs/workbench/parts/emmet/node/actions/expandAbbreviation.ts +++ b/src/vs/workbench/parts/emmet/node/actions/expandAbbreviation.ts @@ -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()); diff --git a/src/vs/workbench/parts/emmet/node/actions/incrementDecrement.ts b/src/vs/workbench/parts/emmet/node/actions/incrementDecrement.ts index 1007c040342..a55f45a8f9e 100644 --- a/src/vs/workbench/parts/emmet/node/actions/incrementDecrement.ts +++ b/src/vs/workbench/parts/emmet/node/actions/incrementDecrement.ts @@ -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()); diff --git a/src/vs/workbench/parts/emmet/node/actions/matchingPair.ts b/src/vs/workbench/parts/emmet/node/actions/matchingPair.ts index 5856c9ca25f..0a6f8114915 100644 --- a/src/vs/workbench/parts/emmet/node/actions/matchingPair.ts +++ b/src/vs/workbench/parts/emmet/node/actions/matchingPair.ts @@ -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()); diff --git a/src/vs/workbench/parts/emmet/node/actions/mergeLines.ts b/src/vs/workbench/parts/emmet/node/actions/mergeLines.ts index 65984eaf602..ab364072bca 100644 --- a/src/vs/workbench/parts/emmet/node/actions/mergeLines.ts +++ b/src/vs/workbench/parts/emmet/node/actions/mergeLines.ts @@ -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()); diff --git a/src/vs/workbench/parts/emmet/node/actions/reflectCssValue.ts b/src/vs/workbench/parts/emmet/node/actions/reflectCssValue.ts index b65dfedaa18..d829392f12c 100644 --- a/src/vs/workbench/parts/emmet/node/actions/reflectCssValue.ts +++ b/src/vs/workbench/parts/emmet/node/actions/reflectCssValue.ts @@ -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()); diff --git a/src/vs/workbench/parts/emmet/node/actions/removeTag.ts b/src/vs/workbench/parts/emmet/node/actions/removeTag.ts index 2cbd738015c..e91e9844bff 100644 --- a/src/vs/workbench/parts/emmet/node/actions/removeTag.ts +++ b/src/vs/workbench/parts/emmet/node/actions/removeTag.ts @@ -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()); diff --git a/src/vs/workbench/parts/emmet/node/actions/selectItem.ts b/src/vs/workbench/parts/emmet/node/actions/selectItem.ts index 69ba3898a28..ca41d0feaa8 100644 --- a/src/vs/workbench/parts/emmet/node/actions/selectItem.ts +++ b/src/vs/workbench/parts/emmet/node/actions/selectItem.ts @@ -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()); diff --git a/src/vs/workbench/parts/emmet/node/actions/splitJoinTag.ts b/src/vs/workbench/parts/emmet/node/actions/splitJoinTag.ts index 7fed4a8e887..f11597b33ea 100644 --- a/src/vs/workbench/parts/emmet/node/actions/splitJoinTag.ts +++ b/src/vs/workbench/parts/emmet/node/actions/splitJoinTag.ts @@ -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()); diff --git a/src/vs/workbench/parts/emmet/node/actions/toggleComment.ts b/src/vs/workbench/parts/emmet/node/actions/toggleComment.ts index c0ca16d8156..f1754252794 100644 --- a/src/vs/workbench/parts/emmet/node/actions/toggleComment.ts +++ b/src/vs/workbench/parts/emmet/node/actions/toggleComment.ts @@ -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()); diff --git a/src/vs/workbench/parts/emmet/node/actions/updateImageSize.ts b/src/vs/workbench/parts/emmet/node/actions/updateImageSize.ts index 16246659256..9e91eba5a74 100644 --- a/src/vs/workbench/parts/emmet/node/actions/updateImageSize.ts +++ b/src/vs/workbench/parts/emmet/node/actions/updateImageSize.ts @@ -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()); diff --git a/src/vs/workbench/parts/emmet/node/actions/updateTag.ts b/src/vs/workbench/parts/emmet/node/actions/updateTag.ts index d8ff8c55844..89e31a8c97c 100644 --- a/src/vs/workbench/parts/emmet/node/actions/updateTag.ts +++ b/src/vs/workbench/parts/emmet/node/actions/updateTag.ts @@ -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()); diff --git a/src/vs/workbench/parts/emmet/node/actions/wrapWithAbbreviation.ts b/src/vs/workbench/parts/emmet/node/actions/wrapWithAbbreviation.ts index 4947a2f75bf..6ce372c3f7a 100644 --- a/src/vs/workbench/parts/emmet/node/actions/wrapWithAbbreviation.ts +++ b/src/vs/workbench/parts/emmet/node/actions/wrapWithAbbreviation.ts @@ -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());