{"id":13576317,"url":"https://github.com/elixir-lsp/elixir-ls","last_synced_at":"2025-04-29T14:37:56.621Z","repository":{"id":37579968,"uuid":"126746886","full_name":"elixir-lsp/elixir-ls","owner":"elixir-lsp","description":"A frontend-independent IDE \"smartness\" server for Elixir. Implements the \"Language Server Protocol\" standard and provides debugger support via the \"Debug Adapter Protocol\"","archived":false,"fork":false,"pushed_at":"2025-03-28T08:22:50.000Z","size":8419,"stargazers_count":1590,"open_issues_count":62,"forks_count":211,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-04-25T20:03:55.379Z","etag":null,"topics":["debug-adapter-protocol","elixir","language-server","language-server-protocol","lsp"],"latest_commit_sha":null,"homepage":"https://elixir-lsp.github.io/elixir-ls/","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elixir-lsp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-25T22:45:34.000Z","updated_at":"2025-04-23T23:15:07.000Z","dependencies_parsed_at":"2023-11-23T03:07:19.839Z","dependency_job_id":"ba36452f-92c5-4f44-8a3a-d2035cf2f533","html_url":"https://github.com/elixir-lsp/elixir-ls","commit_stats":{"total_commits":1480,"total_committers":119,"mean_commits":"12.436974789915967","dds":"0.44999999999999996","last_synced_commit":"a990116e3225697b614f7120d88099350a4eb28c"},"previous_names":[],"tags_count":84,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-lsp%2Felixir-ls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-lsp%2Felixir-ls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-lsp%2Felixir-ls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-lsp%2Felixir-ls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elixir-lsp","download_url":"https://codeload.github.com/elixir-lsp/elixir-ls/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251520203,"owners_count":21602444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debug-adapter-protocol","elixir","language-server","language-server-protocol","lsp"],"created_at":"2024-08-01T15:01:09.104Z","updated_at":"2025-04-29T14:37:56.596Z","avatar_url":"https://github.com/elixir-lsp.png","language":"Elixir","readme":"# ElixirLS - Elixir Language Server and Debug Adapter\n\n[![Actions Status](https://img.shields.io/github/actions/workflow/status/elixir-lsp/elixir-ls/ci.yml?branch=master)](github/actions/workflow/status/elixir-lsp/elixir-ls/ci.yml?branch=master)\n[![Slack](https://img.shields.io/badge/slack-join-orange.svg)](https://elixir-lang.slack.com/archives/C7D272G6N)\n\nElixirLS is provides two components: a language server driving code intelligence and a debug adapter that allows step through debugging of Elixir projects. Language server adheres to the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/). Debug adapter implements [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol/).\n\n## This is the main elixir-ls repo\n\nThis repo is a community maintained fork. The original repository [JakeBecker/elixir-ls](https://github.com/JakeBecker/elixir-ls) has now been deprecated in favor of this one.\n\n## Features\n\n- Debugger support\n- Automatic, incremental Dialyzer analysis\n- Automatic inline suggestion of @specs based on Dialyzer's inferred success typings\n- Inline reporting of build warnings and errors\n- Documentation lookup on hover\n- Go-to-definition\n- Code completion\n- Code formatter\n- Find references to functions and modules (Thanks to @mattbaker)\n- Quick symbol lookup in file (Thanks to @mattbaker)\n- Quick symbol lookup in workspace and stdlib (both Elixir and erlang) (@lukaszsamson)\n\n![Screenshot](images/screenshot.png?raw=true)\n\nNote: On its first run, Dialyzer will build a PLT cache.  This will take a considerable amount of CPU time (usually 10+ minutes). After that is complete, the CPU usage will go back to normal. Alternatively, instead of waiting you can disable Dialyzer in the settings.\n\n## IDE plugins\n\n| IDE          | Plugin                                                                                             | Support                                                                    |\n| ------------ | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |\n| BBEdit       | [bbpackage](https://github.com/chipotle/Elixir.bbpackage)                                          |                                                                            |\n| Emacs        | [eglot](https://github.com/joaotavora/eglot)                                                       |                                                                            |\n| Emacs        | [lsp-mode](https://github.com/emacs-lsp/lsp-mode)                                                  | Supports debug adapter via [dap-mode](https://github.com/yyoncho/dap-mode) |\n| Kakoune      | [kak-lsp](https://github.com/kak-lsp/kak-lsp)                                                      | [Limitations](https://github.com/kak-lsp/kak-lsp/#limitations)             |\n| Kate         | [built-in LSP Client plugin](https://kate-editor.org/post/2020/2020-01-01-kate-lsp-client-status/) | Does not support debug adapter                                             |\n| Neovim       | [coc.nvim](https://github.com/neoclide/coc.nvim)                                                   | Does not support debug adapter                                             |\n| Neovim       | [nvim-dap](https://github.com/mfussenegger/nvim-dap)                                               | Supports debug adapter only                                                |\n| Neovim       | [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)                                         | Does not support debug adapter                                             |\n| Nova         | [nova-elixir-ls](https://github.com/raulchedrese/nova-elixir-ls)                                   |                                                                            |\n| Sublime Text | [LSP-elixir](https://github.com/sublimelsp/LSP-elixir)                                             | Does not support debug adapter                                             |\n| Vim/Neovim   | [ALE](https://github.com/w0rp/ale)                                                                 | Does not support debug adapter or @spec suggestions                        |\n| Vim/Neovim   | [elixir-lsp/coc-elixir](https://github.com/elixir-lsp/coc-elixir)                                  | Does not support debug adapter                                             |\n| Vim/Neovim   | [vim-lsp](https://github.com/prabirshrestha/vim-lsp)                                               | Does not support debug adapter                                             |\n| VS Code      | [elixir-lsp/vscode-elixir-ls](https://github.com/elixir-lsp/vscode-elixir-ls)                      | Supports all ElixirLS features                                             |\n| Helix        | [elixir-lsp](https://github.com/helix-editor/helix/wiki/Language-Server-Configurations#elixir)     | Supports all ElixirLS features                                             |\n| Zed          | [elixir language support](https://zed.dev/docs/languages/elixir)                                   | Supports all ElixirLS features                                             |\n\nPlease feel free to create and publish your own client packages and add them to this list!\n\n## Detailed Installation Instructions\n\nThe installation process for ElixirLS depends on your editor.\n\n\u003cdetails\u003e\n  \u003csummary\u003eVSCode\u003c/summary\u003e\n\nPlease install the extension via the following link: https://marketplace.visualstudio.com/items?itemName=JakeBecker.elixir-ls\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eEmacs Installation Instructions\u003c/summary\u003e\n\nDownload the\n[latest release](https://github.com/elixir-lsp/elixir-ls/releases/latest) and unzip it into a\ndirectory. (This is the directory referred to as the `\"path-to-elixir-ls/release\"`, below.)\n\nIf you will be using `lsp-mode`, add this configuration:\n\n```elisp\n  (use-package lsp-mode\n    :commands lsp\n    :ensure t\n    :diminish lsp-mode\n    :hook\n    (elixir-mode . lsp)\n    :init\n    (add-to-list 'exec-path \"path-to-elixir-ls/release\"))\n```\n\nFor `eglot`, use:\n\n```elisp\n(require 'eglot)\n\n;; This is optional. It automatically runs `M-x eglot` for you whenever you are in `elixir-mode`:\n(add-hook 'elixir-mode-hook 'eglot-ensure)\n\n;; Be sure to edit the path appropriately; use the `.bat` script instead for Windows:\n(add-to-list 'eglot-server-programs '(elixir-mode \"path-to-elixir-ls/release/language_server.sh\"))\n```\n\nIf you access any projects via symlinks, and the lsp crashes immediately on startup in those projects, you might need this:\n\n```elisp\n(setq find-file-visit-truename t)\n```\n\n\u003c/details\u003e\n\n## Supported Elixir and OTP versions\n\nElixir itself supports the last five released versions with security updates:\nhttps://hexdocs.pm/elixir/compatibility-and-deprecations.html#content\n\nOTP supports the last three versions with security updates:\nhttps://github.com/erlang/otp/blob/master/SECURITY.md#supported-versions\nhttps://www.erlang.org/doc/system/misc.html#supported-releases\n\nElixirLS generally aims to support all supported versions of Elixir on all compatible versions of OTP. However this is not a hard and fast rule and may change in the future.\n\n### Support matrix\n\n|  OTP Versions   | Elixir Versions | Supports ElixirLS |                          Issue(s)                          |\n| :-------------: | :-------------: | :---------------: | :--------------------------------------------------------: |\n|      any        |     \u003c= 1.13     |        No         |              Broken, no support for required APIs                  |\n|      22         |       1.13      |        ?        |         Erlang docs not working (requires EIP 48), May still work but no longer supported          |\n|      23         |       1.13   |        ?        |          May still work but no longer supported                            |\n|      24         |       1.13   |        ?        |          May still work but no longer supported                            |\n|      25         |      1.13.4  |        ?        |         May still work but no longer supported                            |\n|      23         |       1.14   |        Yes        |                            None                            |\n|      24         |   1.14 - 1.16   |        Yes        |                            None                            |\n|      25         |  1.14 - 1.18  |        Yes        |                            None                            |\n| 26.0.0 - 26.0.1 |       any       |        No         | [#886](https://github.com/elixir-lsp/elixir-ls/issues/886) |\n| 26.0.2 - 26.1.2 |  1.14.5 - 1.18  |    *nix only      | [#927](https://github.com/elixir-lsp/elixir-ls/issues/927), [#1023](https://github.com/elixir-lsp/elixir-ls/issues/1023) |\n|   \u003e= 26.2.0     |  1.14.5 - 1.18  |        Yes        |                            None                            |\n|      any        |     1.15.5      |        Yes        |  Broken formatter [#975](https://github.com/elixir-lsp/elixir-ls/issues/975) |\n|      27         |    1.17 - 1.18  |        Yes        |                            None                            |\n\n### Version management\n\nIt is generally recommended to install Elixir and Erlang via a version manager so that you can have different projects using different versions of Elixir without having to change your system-installed version. Supported managers include:\n\n- [asdf](https://asdf-vm.com/)\n- [mise](https://mise.jdx.dev/)\n- [vfox](https://vfox.dev/)\n\nElixirLS launch script will attempt to activate found version manager.\n\n#### Windows\n\nVersion managers are currently not supported on Windows. mise and vfox may work if activated.\n\n## Debugger support\n\nElixirLS provides debug adapter support adhering to the [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol/), which is closely related to the Language Server Protocol.\n\nWhen debugging in Elixir or Erlang, only modules that have been \"interpreted\" (using `:int.ni/1` or `:int.i/1`) will accept breakpoints or show up in stack traces. The debugger in ElixirLS automatically interprets all modules in the Mix project and its dependencies before launching the Mix task. Therefore, you can set breakpoints anywhere in your project or dependency modules.\n\nPlease note that there is currently a limit of 100 breakpoints.\n\nTo debug modules in `.exs` files (such as tests), they must be specified under `requireFiles` in your launch configuration so that they can be loaded and interpreted before running the task. For example, the default launch configuration for `mix test` in the VSCode plugin is shown below:\n\n```json\n{\n  \"type\": \"mix_task\",\n  \"name\": \"mix test\",\n  \"request\": \"launch\",\n  \"task\": \"test\",\n  \"taskArgs\": [\"--trace\"],\n  \"startApps\": true,\n  \"projectDir\": \"${workspaceRoot}\",\n  \"requireFiles\": [\"test/**/test_helper.exs\", \"test/**/*_test.exs\"]\n}\n```\n\nCurrently, to debug a single test or a single test file, it is necessary to modify `taskArgs` and ensure that no other tests are required in `requireFiles`.\n\n```json\n{\n  \"type\": \"mix_task\",\n  \"name\": \"mix test\",\n  \"request\": \"launch\",\n  \"task\": \"test\",\n  \"taskArgs\": [\"tests/some_test.exs:123\"],\n  \"startApps\": true,\n  \"projectDir\": \"${workspaceRoot}\",\n  \"requireFiles\": [\"test/**/test_helper.exs\", \"test/some_test.exs\"]\n}\n```\n\n### Debugging Phoenix apps\n\nTo debug Phoenix applications using ElixirLS, you can use the following launch configuration:\n\n```json\n{\n  \"type\": \"mix_task\",\n  \"name\": \"phx.server\",\n  \"request\": \"launch\",\n  \"task\": \"phx.server\",\n  \"projectDir\": \"${workspaceRoot}\",\n  \"debugAutoInterpretAllModules\": false,\n  \"debugInterpretModulesPatterns\": [\"MyApp*\", \"MyAppWeb*\"],\n  \"exitAfterTaskReturns\": false\n}\n```\n\nIn case of phoenix apps it is generally not advised to interpret all modules. Cowboy and ecto have known performance issues when run in interpreted mode. The example configuration disables auto interpreting and instead makes the DAP interpret only a subset of modules.\n\nNote that `exitAfterTaskReturns` is set to `false`. Otherwise DAP session will end immediately after starting because mix task `phx.server` returns control to the caller.\n\nPlease make sure that `startApps` is not set to `true`. To clarify, `startApps` is a configuration option in the ElixirLS debug adapter. It controls whether or not to start the applications in the Mix project before running the task. In the case of Phoenix applications, setting `startApps` to `true` can interfere with the application's normal startup process and cause issues.\n\nIf you are running tests in the Phoenix application, you may need to set `startApps` to true. This will ensure that the necessary applications are started before the tests run.\n\n#### Known issues\n\n- Phoenix live reload and CodeReloader is not compatible with debug adapter. It will purge and recompile beams running in interpreted mode, unset breakpoints and corrupt the debug session [phoenix_live_reload issue](https://github.com/phoenixframework/phoenix_live_reload/issues/133)\n\n- When cowboy and/or ecto modules are interpreted the DAP server leaks enormous amount of heap memory on every request. The reason is unknown. [GH issue](https://github.com/elixir-lsp/elixir-ls/issues/1017)\n\n### NIF modules limitation\n\nIt's important to note that NIF (Native Implemented Function) modules cannot be interpreted due to limitations in `:int`. Therefore, these modules need to be excluded, using the `excludeModules` option. This option can also be used to disable interpretation for specific modules when it's not desirable, such as when performance is unsatisfactory.\n\n```json\n{\n  \"type\": \"mix_task\",\n  \"name\": \"mix test\",\n  \"request\": \"launch\",\n  \"task\": \"test\",\n  \"taskArgs\": [\"--trace\"],\n  \"projectDir\": \"${workspaceRoot}\",\n  \"requireFiles\": [\"test/**/test_helper.exs\", \"test/**/*_test.exs\"],\n  \"excludeModules\": [\":some_nif\", \"Some.SlowModule\"]\n}\n```\n\n### Function breakpoints\n\nFunction breakpoints in ElixirLS allow you to break on the first line of every clause of a specific function. In order to set a function breakpoint, you need to specify the function in the format of MFA (module, function, arity).\n\nFor example, to set a function breakpoint on the `foo` function in the `MyModule` module that takes one argument, you would specify it as `MyModule.foo/1`.\n\nPlease note that function breakpoints only work for public functions and do not support breaking on private functions.\n\n### Conditional breakpoints\n\nBreak conditions allow you to specify an expression that, when evaluated, determines whether the breakpoint should be triggered or not. The expression is evaluated within the context of the breakpoint, which includes all bound variables.\n\nFor example, you could set a breakpoint on a line of code that sets a variable `x`, adding a break condition of `x \u003e 10`. This would cause the breakpoint to trigger when that line of code is executed, but only if the value of `x` is greater than `10` when that line of code is executed.\n\nHowever, it's important to note that the expression evaluator used by ElixirLS has some limitations. For example, it doesn't support some Elixir language features, such as macros and some built-in functions. In addition, the expression evaluator is not as powerful as the one used by the Elixir interpreter, so some expressions that work in the interpreter may not work in ElixirLS.\n\n### Hit conditions\n\nA \"hit condition\" is an optional parameter that can be set on a breakpoint to control how many times a breakpoint should be hit before stopping the process. It is expressed as an integer and can be used to filter out uninteresting hits, allowing the process to continue until a certain condition is met.\n\nFor example, if you have a loop that runs 10 times and you want to stop the process only when the loop reaches the 5th iteration, you can set a breakpoint with a hit condition of five. This will cause the breakpoint to be hit only on the 5th iteration of the loop; the process will continue to run until then.\n\n### Log points\n\n\"Log points\" are a type of breakpoint that logs a message to the standard output without stopping program execution. When a log point is hit, the message is evaluated and printed to the console. The message can include interpolated expressions enclosed in curly braces `{}`, e.g. `my_var is {inspect(my_var)}`. These expressions will be evaluated in the context of the breakpoint. To escape the curly braces, you can use the escape sequence `\\{` and `\\}`.\n\nIt's important to note that as of version 1.51 of the Debug Adapter Protocol specification, log messages are not supported on function breakpoints.\n\n### Expression evaluator\n\nThe debugger's expression evaluator has some limitations due to how the Erlang VM works. Specifically, the evaluator is implemented using `:int`, which works at the level of individual BEAM instructions. As a result, it returns multiple versions of variables in Static Single Assignment form, without indicating which one is valid in the current Elixir scope.\n\nTo work around this, the evaluator uses a heuristic to select the highest versions of variables. However this doesn't always behave correctly in all cases. For example, in the following code snippet:\n\n```elixir\na = 4\nif true do\n  a = 5\nend\nsome\n```\n\nIf a breakpoint is set on the line with `some_function()`, the last bound value for `a` seen by the expression breakpoint evaluator will be `5`, even though it should be `4`.\n\nAdditionally, although all bound variables are accessible in the expression evaluator, the evaluator doesn't support accessing module attributes (because these are determined at compile time).\n\n### Connecting to debug adapter\n\nIt may be useful to connect to a running debug adapter node via OTP distribution. This enables inspecting the running application and remotely triggering debugged functions. In order to do so, set `ELS_ELIXIR_OPTS` environment variable in the launch configuration (VSCode only) or **Local setup script** and pass in the appropriate node `name/sname` and `cookie`.\n\n```json\n{\n  \"env\": {\n    \"ELS_ELIXIR_OPTS\": \"--name mynode@localhost --cookie secret\"\n  }\n}\n```\n\n### Attaching to remote nodes\n\nElixirLS debug adapter is capable of remote debugging OTP cluster nodes. This functionality relies on OTP debugger. In order to attach to a remote node `some@host` a special launch config with request `attach` is needed. The launch config must specify `remoteNode`. Remember to provide `ELS_ELIXIR_OPTS` environment variable in the launch configuration (VSCode only) or **Local setup script** with `cookie` and `name` or `sname` for local DAP node.\n\n```json\n{\n  \"type\": \"mix_task\",\n  \"name\": \"attach\",\n  \"request\": \"attach\",\n  \"projectDir\": \"${workspaceRoot}\",\n  \"remoteNode\": \"some@host\",\n  \"debugAutoInterpretAllModules\": false,\n  \"debugInterpretModulesPatterns\": [\"MyApp.*\"],\n  \"env\": {\n    \"ELS_ELIXIR_OPTS\": \"--sname elixir_ls_dap --cookie mysecret\"\n  }\n}\n```\n\n#### Troubleshooting\n\n- Ensure that the remote node is accessible and accepting connections\n- Ensure that erlang cookie is correct\n- Ensure that OTP `debugger` application is loadable on remote node. This may require including it in `extra_applications`\n- If connecting to an OTP release, ensure that it is built with `strip_beams` set to `false`. Note that it defaults to `true`\n- Ensure that remote node application has not been compiled with `debug_info` set to `false` via `elixirc_options` or `@compile` attribute\n- Ensure that both source files and compiled beams are available in the project directory\n\n#### Limitations\n\nRemote debugger has several limitations compared to local debugger:\n\n- `dbg` macro breakpoints are not supported\n- conditional breakpoints, hit conditional breakpoints and log points are not supported\n- pausing non interpreted processes is not supported\n- expressions are evaluated on local node\n\n#### Warning\n\nElixirLS debug adapter interprets modules with [`:int.ni/1`](https://www.erlang.org/doc/apps/debugger/int.html#ni/1) on all connected nodes. It attempts to uninterpret all modules on debug session end but that may not be possible due to loss of connectivity. This may affect production workloads. Use remote debugging with caution.\n\n## Automatic builds and error reporting\n\nElixirLS provides automatic builds and error reporting. By default, builds are triggered automatically when files are saved, but you can also enable \"autosave\" in your IDE to trigger builds as you type. If you prefer to disable automatic builds, you can set the `elixirLS.autoBuild` configuration option to `false`.\n\nInternally, ElixirLS uses the `mix compile` task to compile Elixir code. When errors or warnings are encountered during compilation, they are returned as LSP diagnostics. Your IDE may display them inline in your code as well as in the \"Problems\" pane. This allows you to quickly identify and fix errors in your code as you work.\n\n## Dialyzer integration\n\n[Dialyzer](http://erlang.org/doc/apps/dialyzer/dialyzer_chapter.html) is a static analysis tool used to identify type discrepancies, unused code, unreachable code, and other warnings in Erlang and Elixir code. ElixirLS provides automatic integration with Dialyzer to help catch issues early on in the development process.\n\nAfter each successful build, ElixirLS automatically analyzes the project with Dialyzer and maintains a \"manifest\" file in .elixir_ls/dialyzer_manifest to store the results of the analysis. The initial analysis of a project can take a few minutes, but subsequent analyses are usually very fast, often taking less than a second. ElixirLS also looks at your modules' abstract code to determine whether they reference any modules that haven't been analyzed and includes them automatically.\n\nYou can control which warnings are shown by using the `elixirLS.dialyzerWarnOpts` setting in your project or IDE's `settings.json`. You can find available options in [dialyzer documentation](http://erlang.org/doc/man/dialyzer.html), under the section \"Warning options\".\n\nTo disable Dialyzer completely, set `elixirLS.dialyzerEnabled` to false.\n\nIf Dialyzer gets stuck and emits incorrect or outdated warnings, it's best to restart the language server.\n\n## Code completion\n\nElixirLS provides an advanced code completion provider. This provider uses two main mechanisms to provide suggestions to the user.\n\nThe first mechanism is reflection, which involves getting information about compiled modules from the Erlang and Elixir APIs. This mechanism provides precise results, but it is not well suited for on-demand completion of symbols from the currently edited file. The compiled version of the code may be outdated or the file may not even compile, which can lead to inaccurate results.\n\nThe second mechanism used by the code completion provider is AST analysis of the current text buffer. This mechanism helps in cases where reflection is not accurate enough (e.g., completing symbols from the currently edited file). However, it also has its limitations. Due to the metaprogramming-heavy nature of Elixir, it is infeasible to be 100% accurate with AST analysis.\n\nThe completions include:\n\n- keywords\n- special form snippets\n- functions\n- macros\n- modules\n- variables\n- sigils\n- struct fields (only if the struct type is explicitly stated or can be inferred from the variable binding)\n- atom map keys (if map keys can be inferred from variable binding)\n- attributes\n- binary modifiers\n- types (in typespecs)\n- behaviour callbacks (inside the body of implementing module)\n- protocol functions (inside the body of implementing module)\n- keys in keyword functions arguments (if defined in spec)\n- function returns (if defined in spec)\n\n## Workspace Symbols\n\nWith Dialyzer integration enabled, ElixirLS will build an index of symbols (modules, functions, types, and callbacks). The symbols are taken from the current workspace, all dependencies, and stdlib (Elixir and Erlang). This feature enables quick navigation to symbol definitions.\n\n## ElixirLS configuration settings\n\nBelow is a list of configuration options supported by the ElixirLS language server. Please refer to your editor's documentation to determine how to configure language servers.\n\n\u003cdl\u003e\n\u003cdt\u003eelixirLS.autoBuild\u003c/dt\u003e\u003cdd\u003eTrigger ElixirLS build when code is saved\u003c/dd\u003e\n\u003cdt\u003eelixirLS.dialyzerEnabled\u003c/dt\u003e\u003cdd\u003eRun ElixirLS's rapid Dialyzer when code is saved\u003c/dd\u003e\n\u003cdt\u003eelixirLS.incrementalDialyzer\u003c/dt\u003e\u003cdd\u003eUse OTP incremental dialyzer (available on OTP 26+)\u003c/dd\u003e\n\u003cdt\u003eelixirLS.dialyzerWarnOpts\u003c/dt\u003e\u003cdd\u003eDialyzer options to enable or disable warnings - See Dialyzer's documentation for options. Note that the \u003ccode\u003erace_conditions\u003c/code\u003e option is unsupported.\u003c/dd\u003e\n\u003cdt\u003eelixirLS.dialyzerFormat\u003c/dt\u003e\u003cdd\u003eFormatter to use for Dialyzer warnings\u003c/dd\u003e\n\u003cdt\u003eelixirLS.envVariables\u003c/dt\u003e\u003cdd\u003eEnvironment variables to use for compilation\u003c/dd\u003e\n\u003cdt\u003eelixirLS.mixEnv\u003c/dt\u003e\u003cdd\u003eMix environment to use for compilation\u003c/dd\u003e\n\u003cdt\u003eelixirLS.mixTarget\u003c/dt\u003e\u003cdd\u003eMix target to use for compilation\u003c/dd\u003e\n\u003cdt\u003eelixirLS.projectDir\u003c/dt\u003e\u003cdd\u003eSubdirectory containing the Mix project, if it is not in the project root\u003c/dd\u003e\n\u003cdt\u003eelixirLS.fetchDeps\u003c/dt\u003e\u003cdd\u003eAutomatically fetch project dependencies when compiling.\u003c/dd\u003e\n\u003cdt\u003eelixirLS.suggestSpecs\u003c/dt\u003e\u003cdd\u003eSuggest \u003ccode\u003e@spec\u003c/code\u003e annotations inline, using Dialyzer's inferred success typings (Requires Dialyzer).\u003c/dd\u003e\n\u003cdt\u003eelixirLS.trace.server\u003c/dt\u003e\u003cdd\u003eTraces communication between VS Code and the Elixir language server.\u003c/dd\u003e\n\u003cdt\u003eelixirLS.autoInsertRequiredAlias\u003c/dt\u003e\u003cdd\u003eEnable auto-insert required alias - By default, this option is \u003ccode\u003etrue\u003c/code\u003e (enabled).\u003c/dd\u003e\n\u003cdt\u003eelixirLS.signatureAfterComplete\u003c/dt\u003e\u003cdd\u003eShow signature help after confirming autocomplete.\u003c/dd\u003e\n\u003cdt\u003eelixirLS.enableTestLenses\u003c/dt\u003e\u003cdd\u003eShow code lenses to run tests in terminal.\u003c/dd\u003e\n\u003cdt\u003eelixirLS.additionalWatchedExtensions\u003c/dt\u003e\u003cdd\u003eAdditional file types capable of triggering a build on change\u003c/dd\u003e\n\u003cdt\u003eelixirLS.languageServerOverridePath\u003c/dt\u003e\u003cdd\u003eAbsolute path to an alternative ElixirLS release that will override the packaged release\u003c/dd\u003e\n\u003cdt\u003eelixirLS.stdlibSrcDir\u003c/dt\u003e\u003cdd\u003ePath to Elixir's std lib source code. See [here](https://github.com/elixir-lsp/elixir_sense/pull/277) for more info\u003c/dd\u003e\n\u003c/dl\u003e\n\n## Debug Adapter configuration options\n\nBelow is a list of configuration options supported by the ElixirLS Debug Adapter. Configuration options can be supplied via launch configuration. Please refer to your editor's documentation on how to configure debug adapters.\n\n\u003cdl\u003e\n  \u003cdt\u003estartApps\u003c/dt\u003e\u003cdd\u003eRun \u003ccode\u003emix app.start\u003c/code\u003e before launching the debugger. Some tasks (such as Phoenix tests) expect apps to already be running before the test files are required. Defaults to \u003ccode\u003efalse\u003c/code\u003e.\u003c/dd\u003e\n  \u003cdt\u003etask\u003c/dt\u003e\u003cdd\u003eMix task to run with debugger - Defaults to task set under \u003ccode\u003e:default_task\u003c/code\u003e key in mixfile.\u003c/dd\u003e\n  \u003cdt\u003etaskArgs\u003c/dt\u003e\u003cdd\u003eA list of arguments to mix task\u003c/dd\u003e\n  \u003cdt\u003edebugAutoInterpretAllModules\u003c/dt\u003e\u003cdd\u003eAuto interpret all modules from project build path. Defaults to \u003ccode\u003etrue\u003c/code\u003e.\u003c/dd\u003e\n  \u003cdt\u003eenv\u003c/dt\u003e\u003cdd\u003eAn object with environment variables - To set Object keys, specify environment variables; values should be strings.\u003c/dd\u003e\n  \u003cdt\u003estackTraceMode\u003c/dt\u003e\u003cdd\u003eOption passed to \u003ccode\u003e:int.stack_trace/1\u003c/code\u003e. See \u003ca href='https://www.erlang.org/doc/man/int#stack_trace/1'\u003e:int.stack_trace/1\u003c/a\u003e for details. Allowed values are \u003ccode\u003eall\u003c/code\u003e, \u003ccode\u003eno_tail\u003c/code\u003e, and \u003ccode\u003efalse\u003c/code\u003e.\u003c/dd\u003e\n  \u003cdt\u003erequireFiles\u003c/dt\u003e\u003cdd\u003eA list of additional files that should be required and interpreted - This is especially useful for debugging tests.\u003c/dd\u003e\n  \u003cdt\u003edebugInterpretModulesPatterns\u003c/dt\u003e\u003cdd\u003eA list of globs specifying modules that should be interpreted\u003c/dd\u003e\n  \u003cdt\u003eprojectDir\u003c/dt\u003e\u003cdd\u003eAn absolute path to the directory where `mix.exs` is located - In VSCode, \u003ccode\u003e${workspaceRoot}\u003c/code\u003e can be used.\u003c/dd\u003e\n  \u003cdt\u003eexcludeModules\u003c/dt\u003e\u003cdd\u003eA list of modules that should not be interpreted\u003c/dd\u003e\n  \u003cdt\u003eexitAfterTaskReturns\u003c/dt\u003e\u003cdd\u003eShould the debug session stop when mix task returns. Tasks that return early while the code continues running asynchronously require \u003ccode\u003efalse\u003c/code\u003e setting. Defaults to \u003ccode\u003etrue\u003c/code\u003e.\u003c/dd\u003e\n  \u003cdt\u003enoDebug\u003c/dt\u003e\u003cdd\u003eRun mix task without debugging. Defaults to \u003ccode\u003efalse\u003c/code\u003e.\u003c/dd\u003e\n  \u003cdt\u003ebreakOnDbg\u003c/dt\u003e\u003cdd\u003eShould the debugger break on Kernel.dbg/2 macro. Defaults to \u003ccode\u003etrue\u003c/code\u003e.\u003c/dd\u003e\n\u003c/dl\u003e\n\n## Troubleshooting\n\nBasic troubleshooting steps:\n\n- Make sure you have `hex` and `git` installed.\n- Make sure `github.com` and `hex.pm` are accessible. You may need to configure an HTTPS proxy. If your setup uses TLS man-in-the-middle inspection, you may need to set `HEX_UNSAFE_HTTPS=1`.\n- If ElixirLS fails to start, you can try cleaning the `Mix.install` directory (location on your system can be obtained by calling `Path.join(Mix.Utils.mix_cache(), \"installs\")` from `iex` session)\n- Restart ElixirLS with the custom command `restart`.\n- Run `mix clean` or `mix clean --deps` in ElixirLS with the custom command `mixClean`.\n- Restart your editor (which will restart ElixirLS).\n- After stopping your editor, remove the entire `.elixir_ls` directory, then restart your editor.\n  - NOTE: This will cause you to have to re-run the entire dialyzer build.\n\nYou may need to set `elixirLS.mixEnv`, `elixirLS.mixTarget`, and `elixirLS.projectDir` if your project requires this. By default, ElixirLS compiles code with `MIX_ENV=test` and `MIX_TARGET=host`; it assumes that `mix.exs` is located in the workspace root directory.\n\nIf you get an error like the following immediately on startup:\n\n```\n[Warn  - 1:56:04 PM] ** (exit) exited in: GenServer.call(ElixirLS.LanguageServer.JsonRpc, {:packet, %{...snip...}}, 5000)\n    ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started\n```\n\nand you installed Elixir and Erlang from the Erlang Solutions repository, you may not have a full installation of Erlang. This can be solved with `sudo apt-get install esl-erlang`. (This was originally reported in [#208](https://github.com/elixir-lsp/elixir-ls/issues/208)).\n\nOn Fedora Linux, if you only install the Elixir package you will not have a full Erlang installation. This can be fixed by running `sudo dnf install erlang` (This was reported in [#231](https://github.com/elixir-lsp/elixir-ls/issues/231)).\n\n## Known Issues/Limitations\n\n- `.exs` files don't return compilation errors.\n- \"Fetching n dependencies\" sometimes get stuck (remove the `.elixir_ls` directory to fix).\n- \"Go to definition\" does not work within the `scope` of a Phoenix router.\n- On first launch, Dialyzer will cause high CPU usage for a considerable time.\n- Dialyzer does not pick up changes involving remote types (https://github.com/elixir-lsp/elixir-ls/issues/502)\n\n## Building and running\n\nThere are two ways of building the release: `Mix.install` based (recommended) and `.ez` archives (deprecated).\n\n### `Mix.install` based release\n\n```bash\nmix deps.get\nMIX_ENV=prod mix compile\nMIX_ENV=prod mix elixir_ls.release2 -o \u003crelease_dir\u003e\n```\n\nThis copies language server and debugger adapter launch scripts to the `\u003crelease_dir\u003e` and includes a `VERSION` manifest file. The launch scripts install a release specified by the version manifest via `Mix.install` and then launch it. This ensures that ElixirLS is built with the correct combination of Elixir and OTP.\n\n### Local setup\n\nThis section provides additional information on how to set up the ElixirLS locally.\n\nWhen launching ElixirLS from an IDE that is itself launched from a graphical shell, the environment may not be complete enough to find or run the correct Elixir/OTP version. To address this on Unix or Linux, the ElixirLS wrapper scripts try to configure [ASDF](https://github.com/asdf-vm/asdf) (a version manager for Elixir and other languages), but that may not always be what is needed.\n\nTo ensure that the correct environment is set up, you can create a setup script. The setup script location varies based on platform and shell:\n- Unix-based systems using bash or zsh: `$XDG_CONFIG_HOME/elixir_ls/setup.sh` (by default `~/.config/elixir_ls/setup.sh`)\n- Unix-based systems using fish: `$XDG_CONFIG_HOME/elixir_ls/setup.fish` (by default `~/.config/elixir_ls/setup.fish`)\n- Windows-based systems `%APPDATA%\\elixir_ls\\setup.bat`\n\nIn the setup script, the environment variable `ELS_MODE` is available and set to either `debug_adapter` or `language_server` to help you decide what to do.\n\nNote: The setup script must not read from `stdin` or write to `stdout`. On Unix, Linux, and macOS\nthis might be accomplished by adding `\u003e/dev/null` at the end of any line that produces\noutput; for a Windows batch script, you will want to add `@echo off` at the top and use `\u003enul`.\n\nIf you want to debug your setup script you can write to stderr.\n\n### Development\n\nPlease refer to [DEVELOPMENT.md](DEVELOPMENT.md).\n\n## Environment variables\n\nElixirLS supports the following environment variables.\n\n\u003cdl\u003e\n\n  \u003cdt\u003eELS_INSTALL_PREFIX\u003c/dt\u003e\u003cdd\u003e(not supported on Windows) The folder where the language server was installed - If set, this makes maintaining multiple versions/instances on the same host much easier. If it is not set or empty, a heuristic will be used to discover the install location.\u003c/dd\u003e\n\n  \u003cdt\u003eELS_LOCAL\u003c/dt\u003e\u003cdd\u003eIf set to \u003ccode\u003e1\u003c/code\u003e, this will make ElixirLS run a local release. If this is not set, a published release matching \u003ccode\u003eVERSION\u003c/code\u003e will be used (default).\u003c/dd\u003e\n\n  \u003cdt\u003eELS_ELIXIR_OPTS\u003c/dt\u003e\u003cdd\u003eOptional parameters to pass to elixir CLI - May be used to set a node name and cookie.\u003c/dd\u003e\n\n  \u003cdt\u003eELS_ERL_OPTS\u003c/dt\u003e\u003cdd\u003eOptional parameters to pass to the erl CLI\u003c/dd\u003e\n\n  \u003cdt\u003eASDF_DIR\u003c/dt\u003e\u003cdd\u003e(not supported on Windows)(deprecated, not used with asdf v0.16+) If this is set, ElixirLS will look for the \u003ca href=\"https://asdf-vm.com/\"\u003easdf\u003c/a\u003e script in a directory given by that variable.\u003c/dd\u003e\n\n\u003c/dl\u003e\n\n## Telemetry\n\nElixirLS language server sends telemetry information to the client via [LSP Telemetry notification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#telemetry_event), [DAP Output event](https://microsoft.github.io/debug-adapter-protocol/specification#Events_Output) and [DAP ErrorResponse](https://microsoft.github.io/debug-adapter-protocol/specification#Base_Protocol_ErrorResponse). Telemetry data include usage, performance, environment info and error reports. Please refer to your client and/or extension documentation on telemetry.\n\n## Acknowledgements and related projects\n\nElixirLS incorporates code intelligence providers that were originally developed in [Elixir Sense](https://github.com/elixir-lsp/elixir_sense) and still uses this library for lower lever operations. Other prior work includes [Alchemist Server](https://github.com/tonini/alchemist-server/), [Elixir plugin for Atom](https://github.com/msaraiva/atom-elixir), [VSCode Elixir](https://github.com/fr1zle/vscode-elixir). Credit for those projects goes to their respective authors.\n\n## License\n\nElixirLS source code is released under Apache License 2.0.\n\nSee [LICENSE](LICENSE) for more information.\n\nElixirLS includes parts of other projects, please see the respective licenses which apply to them.\n","funding_links":[],"categories":["Elixir","Tooling","Languages"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-lsp%2Felixir-ls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felixir-lsp%2Felixir-ls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-lsp%2Felixir-ls/lists"}