Pilgrim

Pilgrim

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

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!

Pilgrim

Pilgrim OP

@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

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews