lang/javascript: add +javascript/refactor-menu
This commit is contained in:
parent
e69ed84e8a
commit
3b36f52db4
1 changed files with 29 additions and 1 deletions
|
@ -31,9 +31,37 @@
|
||||||
(setq-local flycheck-javascript-eslint-executable eslint))))
|
(setq-local flycheck-javascript-eslint-executable eslint))))
|
||||||
(add-hook 'flycheck-mode-hook #'+javascript|init-flycheck-elint)
|
(add-hook 'flycheck-mode-hook #'+javascript|init-flycheck-elint)
|
||||||
|
|
||||||
|
(def-menu! +javascript/refactor-menu
|
||||||
|
"Refactoring commands for `js2-mode' buffers."
|
||||||
|
'(("Extract into function" :exec js2r-extract-function :region t)
|
||||||
|
("Extract into method" :exec js2r-extract-method :region t)
|
||||||
|
("Introduce parameter to function" :exec js2r-introduce-parameter :region t)
|
||||||
|
("Localize parameter" :exec js2r-localize-parameter :region nil)
|
||||||
|
("Expand object" :exec js2r-expand-object :region nil)
|
||||||
|
("Expand function" :exec js2r-expand-function :region nil)
|
||||||
|
("Expand array" :exec js2r-expand-array :region nil)
|
||||||
|
("Contract object" :exec js2r-contract-object :region nil)
|
||||||
|
("Contract function" :exec js2r-contract-function :region nil)
|
||||||
|
("Contract array" :exec js2r-contract-array :region nil)
|
||||||
|
("Wrap buffer in IIFE" :exec js2r-wrap-buffer-in-iife :region nil)
|
||||||
|
("Inject global into IIFE" :exec js2r-inject-global-in-iife :region t)
|
||||||
|
("Add to globals annotation" :exec js2r-add-to-globals-annotation :region nil)
|
||||||
|
("Extract variable" :exec js2r-extract-var :region t)
|
||||||
|
("Inline variable" :exec js2r-inline-var :region t)
|
||||||
|
("Rename variable" :exec js2r-rename-var :region nil)
|
||||||
|
("Replace var with this" :exec js2r-var-to-this :region nil)
|
||||||
|
("Arguments to object" :exec js2r-arguments-to-object :region nil)
|
||||||
|
("Ternary to if" :exec js2r-ternary-to-if :region nil)
|
||||||
|
("Split var declaration" :exec js2r-split-var-declaration :region nil)
|
||||||
|
("Split string" :exec js2r-split-string :region nil)
|
||||||
|
("Unwrap" :exec js2r-unwrap :region t)
|
||||||
|
("Log this" :exec js2r-log-this)
|
||||||
|
("Debug this" :exec js2r-debug-this))
|
||||||
|
:prompt "Refactor: ")
|
||||||
|
|
||||||
(map! :map js2-mode-map
|
(map! :map js2-mode-map
|
||||||
:localleader
|
:localleader
|
||||||
"r" #'+javascript/refactor
|
"r" #'+javascript/refactor-menu
|
||||||
"S" #'+javascript/skewer-this-buffer))
|
"S" #'+javascript/skewer-this-buffer))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue