Pilgrim
Emacs Elixir syntax checking not working
I use Emacs and have the following code in my init.el:
(use-package elixir-mode
:ensure t
:hook (elixir-mode . (lambda ()
(add-hook 'before-save-hook 'elixir-format nil t))))
;; Alchemist offers integration with the Mix tool.
(use-package alchemist
:ensure t
:hook (elixir-mode . alchemist-mode)
:delight alchemist-mode)
(use-package flycheck-mix
:ensure t
:init (add-hook 'flycheck-mode-hook #'flycheck-credo-setup))
(use-package flycheck-credo
:ensure t
:defer t
:init (add-hook 'flycheck-mode-hook #'flycheck-credo-setup))
At the moment I can’t get flycheck syntax checking to work. What am I doing wrong?
Most Liked
NobbZ
I’m not using use-package, therefore I can only guess.
I can’t see here that you associate flycheck-mode to elixir-mode. So unless you do global-flycheck-mode anywere, you need to (add-hook 'elixir-mode-hook flycheck-mode) at a place where it is appropriate, maybe use-package has some special syntax for it.
PS: Even though I generally prefer emacs over everything else, I currently use VScode for elixir, because language server support is so much better. I hope LS support will be available in alchemist.el soon!
1
Pilgrim
@dimitarvp yes I do and below is my config:
;; Elixir
(after! lsp-mode
(defun dap-elixir--populate-start-file-args (conf)
"Populate CONF with the required arguments."
(-> conf
(dap--put-if-absent :dap-server-path `("~/lang_servers/elixir-ls/release/debugger.sh"))
(dap--put-if-absent :type "mix_task")
(dap--put-if-absent :name "mix test")
(dap--put-if-absent :request "launch")
(dap--put-if-absent :task "test")
(dap--put-if-absent :taskArgs (list "--trace"))
(dap--put-if-absent :projectDir (lsp-find-session-folder (lsp-session) (buffer-file-name)))
(dap--put-if-absent :cwd (lsp-find-session-folder (lsp-session) (buffer-file-name)))
(dap--put-if-absent :requireFiles (list
"lib/**"
"test/**/test_helper.exs"
"test/**/*_test.exs"))))
(dap-register-debug-provider "Elixir" 'dap-elixir--populate-start-file-args)
(dap-register-debug-template "Elixir Run Configuration"
(list :type "Elixir"
:cwd nil
:request "launch"
:program nil
:name "Elixir::Run"))
;; Enable formatting on save and send reload command to Elixir’s REPL
(add-hook 'elixir-mode-hook
(lambda ()
(add-hook 'before-save-hook 'lsp-format-buffer nil t)
(add-hook 'after-save-hook 'alchemist-iex-reload-module))))
;; Configure ExUnit package
(use-package! exunit)
;; Disable popup quitting for Elixir’s REPL
(set-popup-rule! "^\\*Alchemist-IEx" :quit nil :size 0.3)
Cheers
1
Popular in Questions
Hi,
I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set?
Thanks.
New
In templates/appointment/index.html.eex:
<%= for appointment <- @appointments do %>
<tr>
<td><%= appoi...
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Credo is smart enough to check for (something like) this:
assert length(the_list) == 0
with this response:
Checking if an enum is empt...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
Other popular topics
Update:
How to use the Blogs & Podcasts section
You can post links to your blog posts or podcasts either in one of the Official Blog...
New
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









