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
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
Hi there,
I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
Good day to you all.
I have been struggling to get a query involving like and ilike to work.
Can anyone assist me on this, please?
pro...
New
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database.
Dep...
New
I have an umbrella app.
Some of the apps inside depend on other apps in the umbrella, unsurprisingly.
I'm writing a test for one of t...
New
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
Hello,
I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these
buyer = %{
id: ...
New
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Other popular topics
Hi! May someone helps me, please!
I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
Manning 2016 Halloween weekend sale via Deal of the Day
Friday, October 28 - Half off all MEAPs - code WM102816LT
Saturday, October 29 ...
New
Hello!
tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability.
After spen...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
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
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
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including.
What is Phoenix LiveV...
New







