[elixir] layer improevements
- declare lsp layer dependency if elixir-backind is lsp - "C-j" now properly indents line - add toggle breakpoint for elixir-mode update CHANGELOG.develop
This commit is contained in:
parent
0cec3d0a69
commit
135a1fd460
|
@ -1419,10 +1419,14 @@ Other:
|
||||||
- Added ~SPC m o R~ to macroexpand print region
|
- Added ~SPC m o R~ to macroexpand print region
|
||||||
- Added elixir format keybind (thanks to Perry Fraser)
|
- Added elixir format keybind (thanks to Perry Fraser)
|
||||||
- ~SPC m =~ to format current buffer
|
- ~SPC m =~ to format current buffer
|
||||||
- Change binding of =alchemist-project-find-test= from
|
- Change binding of =alchemist-project-find-test= from
|
||||||
~SPC m p t~ to ~SPC m t F~ (thanks to Lyuben Petrov)
|
~SPC m p t~ to ~SPC m t F~ (thanks to Lyuben Petrov)
|
||||||
- Mark alchemist jump handler as async (thanks to Lukasz Czaplinski)
|
- Mark alchemist jump handler as async (thanks to Lukasz Czaplinski)
|
||||||
- Added elixir-ls backend (thanks to mpanarin)
|
- Added elixir-ls backend (thanks to mpanarin)
|
||||||
|
- Added breakpoint toggle to alchemist binds (thanks to mpanarin)
|
||||||
|
- Added ~SPC m d b~ to toggle IEx.pry breakpoint
|
||||||
|
- lsp layer is a dependency when backend is set to 'lsp (thanks to mpanarin)
|
||||||
|
- "C-j" indents line properly (thanks to mpanarin)
|
||||||
**** Elm
|
**** Elm
|
||||||
- Fixed flycheck initialization (thanks to Kevin W. van Rooijen)
|
- Fixed flycheck initialization (thanks to Kevin W. van Rooijen)
|
||||||
- Added =elm-test-runner= (thanks to Juan Edi)
|
- Added =elm-test-runner= (thanks to Juan Edi)
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
- [[#hex-packages][Hex (packages)]]
|
- [[#hex-packages][Hex (packages)]]
|
||||||
- [[#macro-expand][Macro expand]]
|
- [[#macro-expand][Macro expand]]
|
||||||
- [[#formatting][Formatting]]
|
- [[#formatting][Formatting]]
|
||||||
|
- [[#debugging][Debugging]]
|
||||||
- [[#lsp][LSP]]
|
- [[#lsp][LSP]]
|
||||||
|
|
||||||
* Description
|
* Description
|
||||||
|
@ -333,5 +334,11 @@ Hex is the package manager for Elixir & Erlang ecosystem. See [[https://hex.pm]]
|
||||||
|-------------+---------------------------|
|
|-------------+---------------------------|
|
||||||
| ~SPC m =~ | Format the current buffer |
|
| ~SPC m =~ | Format the current buffer |
|
||||||
|
|
||||||
|
*** Debugging
|
||||||
|
|
||||||
|
| Key binding | Description |
|
||||||
|
|-------------+---------------------------|
|
||||||
|
| ~SPC m d b~ | Toggle IEx.pry breakpoint |
|
||||||
|
|
||||||
** LSP
|
** LSP
|
||||||
You find and overview of all the key bindings on the [[https://github.com/syl20bnr/spacemacs/tree/develop/layers/%2Btools/lsp#key-bindings][lsp layer description]].
|
You find and overview of all the key bindings on the [[https://github.com/syl20bnr/spacemacs/tree/develop/layers/%2Btools/lsp#key-bindings][lsp layer description]].
|
||||||
|
|
|
@ -65,6 +65,14 @@
|
||||||
|
|
||||||
;; others
|
;; others
|
||||||
|
|
||||||
|
(defun spacemacs//elixir-default ()
|
||||||
|
"Default settings for elixir buffers"
|
||||||
|
|
||||||
|
;; highlight all breakpoints
|
||||||
|
(spacemacs/elixir-annotate-pry)
|
||||||
|
;; make C-j work the same way as RET
|
||||||
|
(local-set-key (kbd "C-j") 'newline-and-indent))
|
||||||
|
|
||||||
(defun spacemacs//elixir-looking-back-special-p (expr)
|
(defun spacemacs//elixir-looking-back-special-p (expr)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(when (or (looking-back " ")
|
(when (or (looking-back " ")
|
||||||
|
@ -93,3 +101,20 @@
|
||||||
(flycheck-mix-setup)
|
(flycheck-mix-setup)
|
||||||
;; enable credo only if there are no compilation errors
|
;; enable credo only if there are no compilation errors
|
||||||
(flycheck-add-next-checker 'elixir-mix '(warning . elixir-credo))))
|
(flycheck-add-next-checker 'elixir-mix '(warning . elixir-credo))))
|
||||||
|
|
||||||
|
(defun spacemacs/elixir-annotate-pry ()
|
||||||
|
"Highlight breakpoint lines."
|
||||||
|
(interactive)
|
||||||
|
(highlight-lines-matching-regexp "require IEx; IEx.pry"))
|
||||||
|
|
||||||
|
(defun spacemacs/elixir-toggle-breakpoint ()
|
||||||
|
"Add a breakpoint line or clear it if line is already a breakpoint."
|
||||||
|
(interactive)
|
||||||
|
(let ((trace "require IEx; IEx.pry")
|
||||||
|
(line (thing-at-point 'line)))
|
||||||
|
(if (and line (string-match trace line))
|
||||||
|
(kill-whole-line)
|
||||||
|
(progn
|
||||||
|
(back-to-indentation)
|
||||||
|
(insert trace)
|
||||||
|
(newline-and-indent)))))
|
||||||
|
|
14
layers/+lang/elixir/layers.el
Normal file
14
layers/+lang/elixir/layers.el
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
;;; layers.el --- Elixir Layer declarations File for Spacemacs
|
||||||
|
;;
|
||||||
|
;; Copyright (c) 2012-2019 Sylvain Benner & Contributors
|
||||||
|
;;
|
||||||
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
||||||
|
;; URL: https://github.com/syl20bnr/spacemacs
|
||||||
|
;;
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
;;
|
||||||
|
;;; License: GPLv3
|
||||||
|
|
||||||
|
(when (and (boundp 'elixir-backend)
|
||||||
|
(eq elixir-backend 'lsp))
|
||||||
|
(configuration-layer/declare-layer 'lsp))
|
|
@ -53,6 +53,7 @@
|
||||||
(spacemacs/declare-prefix-for-mode 'elixir-mode "ms" "iex")
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "ms" "iex")
|
||||||
(spacemacs/declare-prefix-for-mode 'elixir-mode "mt" "test")
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mt" "test")
|
||||||
(spacemacs/declare-prefix-for-mode 'elixir-mode "mx" "execute")
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mx" "execute")
|
||||||
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "md" "debug")
|
||||||
(spacemacs/set-leader-keys-for-major-mode 'elixir-mode
|
(spacemacs/set-leader-keys-for-major-mode 'elixir-mode
|
||||||
"el" 'alchemist-eval-current-line
|
"el" 'alchemist-eval-current-line
|
||||||
"eL" 'alchemist-eval-print-current-line
|
"eL" 'alchemist-eval-print-current-line
|
||||||
|
@ -130,7 +131,9 @@
|
||||||
"oi" 'alchemist-macroexpand-once-region
|
"oi" 'alchemist-macroexpand-once-region
|
||||||
"oI" 'alchemist-macroexpand-once-print-region
|
"oI" 'alchemist-macroexpand-once-print-region
|
||||||
"or" 'alchemist-macroexpand-region
|
"or" 'alchemist-macroexpand-region
|
||||||
"oR" 'alchemist-macroexpand-print-region)
|
"oR" 'alchemist-macroexpand-print-region
|
||||||
|
|
||||||
|
"db" 'spacemacs/elixir-toggle-breakpoint)
|
||||||
|
|
||||||
(dolist (mode (list alchemist-compile-mode-map
|
(dolist (mode (list alchemist-compile-mode-map
|
||||||
alchemist-eval-mode-map
|
alchemist-eval-mode-map
|
||||||
|
@ -165,7 +168,8 @@
|
||||||
(use-package elixir-mode
|
(use-package elixir-mode
|
||||||
:defer t
|
:defer t
|
||||||
:init (spacemacs/add-to-hook 'elixir-mode-hook
|
:init (spacemacs/add-to-hook 'elixir-mode-hook
|
||||||
'(spacemacs//elixir-setup-backend))
|
'(spacemacs//elixir-setup-backend
|
||||||
|
spacemacs//elixir-default))
|
||||||
:config
|
:config
|
||||||
(spacemacs/set-leader-keys-for-major-mode 'elixir-mode
|
(spacemacs/set-leader-keys-for-major-mode 'elixir-mode
|
||||||
"=" 'elixir-format)))
|
"=" 'elixir-format)))
|
||||||
|
|
Loading…
Reference in a new issue