This allows the workspace configuration settings to be passed to the
elixir-ls LSP via lsp settings.
This following example settings disable dialyzer in the LSP:
```
"lsp": {
"elixir-ls": {
"settings": {
"dialyzerEnabled": false
}
}
}
```
It follows the same pattern used in
[#8568](https://github.com/zed-industries/zed/pull/8568) and resolves
[#4260](https://github.com/zed-industries/zed/issues/4260).
Zed's language server logs show the settings are being sent to the
language server:
```
Received client configuration via workspace/configuration
%{"dialyzerEnabled" => false}
Registering for workspace/didChangeConfiguration notifications
Starting build with MIX_ENV: test MIX_TARGET: host
client/registerCapability succeeded
Registering for workspace/didChangeWatchedFiles notifications
client/registerCapability succeeded
Received workspace/didChangeConfiguration
Received client configuration via workspace/didChangeConfiguration
%{"dialyzerEnabled" => false}
```
Release Notes:
- Added workspace configuration settings support for elixir-ls language
server. Those can now be configured by setting `{"lsp": {"elixir-ls": {
"settings: { "your-settings-here": "here"} } }` in Zed settings.
[#4260](https://github.com/zed-industries/zed/issues/4260).
1.6 KiB
1.6 KiB
Elixir
- Tree Sitter: tree-sitter-elixir
- Language Server: elixir-ls
Setting up elixir-ls
- Install
elixir:
brew install elixir
- Install
elixir-ls:
brew install elixir-ls
- Restart Zed
If
elixir-lsis not running in an elixir project, check the error log via the command palette actionzed: 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 installHex. You runelixir-lsfrom the command line and accept the prompt to installHex.
Formatting with Mix
If you prefer to format your code with Mix, use the following snippet in your settings.json file to configure it as an external formatter. Formatting will occur on file save.
{
"language_overrides": {
"Elixir": {
"format_on_save": {
"external": {
"command": "mix",
"arguments": ["format", "--stdin-filename", "{buffer_path}", "-"]
}
}
}
}
}
Additional workspace configuration options (requires Zed 0.128.0):
You can pass additional elixir-ls workspace configuration options via lsp settings in settings.json.
The following example disables dialyzer:
"lsp": {
"elixir-ls": {
"settings": {
"dialyzerEnabled": false
}
}
}
See ElixirLS configuration settings for more options.