1# Elixir
2
3- Tree Sitter: [tree-sitter-elixir](https://github.com/elixir-lang/tree-sitter-elixir)
4- Language Server: [elixir-ls](https://github.com/elixir-lsp/elixir-ls)
5
6### Setting up `elixir-ls`
7
81. Install `elixir`:
9
10```bash
11brew install elixir
12```
13
142. Install `elixir-ls`:
15
16```bash
17brew install elixir-ls
18```
19
203. Restart Zed
21
22> If `elixir-ls` is not running in an elixir project, check the error log via the command palette action `zed: open log`. If you find an error message mentioning: `invalid LSP message header "Shall I install Hex? (if running non-interactively, use \"mix local.hex --force\") [Yn]`, you might need to install [`Hex`](https://hex.pm). You run `elixir-ls` from the command line and accept the prompt to install `Hex`.
23
24### Formatting with Mix
25
26If you prefer to format your code with [Mix](https://hexdocs.pm/mix/Mix.html), use the following snippet in your `settings.json` file to configure it as an external formatter. Formatting will occur on file save.
27
28```json
29{
30 "languages": {
31 "Elixir": {
32 "format_on_save": {
33 "external": {
34 "command": "mix",
35 "arguments": ["format", "--stdin-filename", "{buffer_path}", "-"]
36 }
37 }
38 }
39 }
40}
41```
42
43### Additional workspace configuration options (requires Zed `0.128.0`):
44
45You can pass additional elixir-ls workspace configuration options via lsp settings in `settings.json`.
46
47The following example disables dialyzer:
48
49```json
50"lsp": {
51 "elixir-ls": {
52 "settings": {
53 "dialyzerEnabled": false
54 }
55 }
56}
57```
58
59See [ElixirLS configuration settings](https://github.com/elixir-lsp/elixir-ls#elixirls-configuration-settings) for more options.