Skip to content

elixirls

https://github.com/elixir-lsp/elixir-ls

elixir-ls can be installed by following the instructions here.

curl -fLO https://github.com/elixir-lsp/elixir-ls/releases/latest/download/elixir-ls.zip
unzip elixir-ls.zip -d /path/to/elixir-ls
# Unix
chmod +x /path/to/elixir-ls/language_server.sh

By default, elixir-ls doesn't have a cmd set. This is because nvim-lspconfig does not make assumptions about your path. You must add the following to your init.vim or init.lua to set cmd to the absolute path ($HOME and ~ are not expanded) of your unzipped elixir-ls.

require'lspconfig'.elixirls.setup{
    -- Unix
    cmd = { "/path/to/elixir-ls/language_server.sh" };
    -- Windows
    cmd = { "/path/to/elixir-ls/language_server.bat" };
    ...
}

Setup

require'lspconfig'.elixirls.setup{}

Default values

filetypes = { "elixir", "eelixir" }
root_dir = function(fname)
      return util.root_pattern('mix.exs', '.git')(fname) or vim.loop.os_homedir()
    end,

Available settings

elixirLS.dialyzerEnabled

  • Type: boolean
  • Default: true

Run ElixirLS\'s rapid Dialyzer when code is saved

elixirLS.dialyzerFormat

  • Type: enum { "dialyzer", "dialyxir_short", "dialyxir_long" }
  • Default: "dialyzer"

Formatter to use for Dialyzer warnings

elixirLS.dialyzerWarnOpts

  • Type: array
  • Default: {}
  • Array items:

Dialyzer options to enable or disable warnings. See Dialyzer\'s documentation for options. Note that the \"race_conditions\" option is unsupported

elixirLS.fetchDeps

  • Type: boolean
  • Default: true

Automatically fetch project dependencies when compiling

elixirLS.mixEnv

  • Type: string
  • Default: "test"

Mix environment to use for compilation

elixirLS.projectDir

  • Type: string

Subdirectory containing Mix project if not in the project root

elixirLS.suggestSpecs

  • Type: boolean
  • Default: true

Suggest \@spec annotations inline using Dialyzer\'s inferred success typings (Requires Dialyzer)

Back to top