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
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
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
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
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
Hello everyone,
I try to use an Javascript Event Handler in my root.html.leex file.
Therefore I created a function in the app.js file: ...
New
Hi!
Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
Other popular topics
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
I would like to know what is the best IDE for elixir development?
New
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar.
I p...
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
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
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










