### Install MkDocs and Material Theme Source: https://github.com/elixir-lsp/elixir-ls/blob/master/DEVELOPMENT.md Install the necessary Python packages for building the documentation website using MkDocs and the Material theme. ```shell pip install mkdocs mkdocs-material ``` -------------------------------- ### Fix Erlang Installation on Debian/Ubuntu Source: https://github.com/elixir-lsp/elixir-ls/blob/master/docs/troubleshooting.md If you encounter startup errors related to GenServer.call and a missing process, ensure a full Erlang installation. This command installs the necessary package. ```bash sudo apt-get install esl-erlang ``` -------------------------------- ### Serve Documentation Website Locally Source: https://github.com/elixir-lsp/elixir-ls/blob/master/DEVELOPMENT.md Start a local web server to preview the documentation website with live reloading. Run this command from the project root. ```shell mkdocs serve ``` -------------------------------- ### Install Dependencies with Mix Source: https://github.com/elixir-lsp/elixir-ls/blob/master/DEVELOPMENT.md Run this command after cloning the repository to fetch project dependencies. ```shell mix deps.get ``` -------------------------------- ### MCP Configuration Example Source: https://github.com/elixir-lsp/elixir-ls/blob/master/README.md Example JSON configuration for setting up ElixirLS with Claude Code or other MCP-compatible tools. Replace the path and port with your specific details. ```json { "mcpServers": { "elixir-ls-bridge": { "command": "elixir", "args": [ "/absolute/path/to/elixir-ls/scripts/tcp_to_stdio_bridge.exs", "4328" ] } } } ``` -------------------------------- ### Fix Erlang Installation on Fedora Source: https://github.com/elixir-lsp/elixir-ls/blob/master/docs/troubleshooting.md If ElixirLS fails to start on Fedora due to incomplete Erlang installation, this command installs the full Erlang package. ```bash sudo dnf install erlang ``` -------------------------------- ### Install erlang-dialyzer on Ubuntu Source: https://github.com/elixir-lsp/elixir-ls/blob/master/guides/incomplete-installation.md Use this command on Ubuntu systems to install the necessary Erlang and Dialyzer packages if ElixirLS fails due to missing Dialyzer. ```bash sudo apt-get install erlang erlang-dialyzer ``` -------------------------------- ### Install erlang-edoc on Fedora Source: https://github.com/elixir-lsp/elixir-ls/blob/master/guides/incomplete-installation.md Execute this command on Fedora systems to install the required Erlang and edoc packages when ElixirLS encounters issues with missing edoc. ```bash sudo dnf install erlang erlang-edoc ``` -------------------------------- ### Build ElixirLS Release Source: https://github.com/elixir-lsp/elixir-ls/blob/master/README.md Steps to get dependencies, compile, and create a release for ElixirLS using MIX_ENV=prod. ```bash mix deps.get MIX_ENV=prod mix compile MIX_ENV=prod mix elixir_ls.release2 -o ``` -------------------------------- ### Run ElixirLS in Docker Container Source: https://github.com/elixir-lsp/elixir-ls/blob/master/DEVELOPMENT.md Start an interactive terminal session within the 'els' Docker container. The project content is copied to /app within the container. ```shell docker run -it els ``` -------------------------------- ### Build Documentation Website for Deployment Source: https://github.com/elixir-lsp/elixir-ls/blob/master/DEVELOPMENT.md Compile the documentation website into static assets located in the 'site' directory, ready for deployment. ```shell mkdocs build ``` -------------------------------- ### Run Tests with Mix Source: https://github.com/elixir-lsp/elixir-ls/blob/master/DEVELOPMENT.md Execute the project's test suite using standard Mix commands. ```shell mix test ``` -------------------------------- ### Run Local Language Server Release Source: https://github.com/elixir-lsp/elixir-ls/blob/master/DEVELOPMENT.md Execute a local release of the language server and debug adapter using provided scripts. Set ELS_LOCAL=1 to use local source, lockfile, and config. ```shell cd path/to/my_project ELS_LOCAL=1 /path/to/elixir-ls/scripts/language_server.sh ``` -------------------------------- ### Extract Configuration Options with jq Source: https://github.com/elixir-lsp/elixir-ls/blob/master/DEVELOPMENT.md Use this jq program to extract configuration options and their descriptions from the VSCode extension's package.json file. ```shell jq -r '.contributes.configuration.properties | to_entries | map("
\(.key)
\(.value.description)
") | join("\n")' package.json ``` -------------------------------- ### Build Docker Image for ElixirLS Source: https://github.com/elixir-lsp/elixir-ls/blob/master/DEVELOPMENT.md Build a Docker image tagged 'els' for testing the project in a containerized environment. ```shell docker build -t els . ``` -------------------------------- ### Add MixProject Dependency Source: https://github.com/elixir-lsp/elixir-ls/blob/master/apps/debug_adapter/test/fixtures/mix_project/README.md Add this to your `mix.exs` file to include the MixProject library in your project dependencies. Ensure the version is compatible with your project. ```elixir def deps do [{:mix_project, "~> 0.1.0"}] end ``` -------------------------------- ### Initialize exec-path-from-shell Source: https://github.com/elixir-lsp/elixir-ls/blob/master/docs/getting-started/emacs.md Ensure your Emacs environment correctly inherits the PATH from your user's shell, which is crucial for ElixirLS to find necessary executables. ```elisp ;; Ensure your Emacs environment looks like your user's shell one (package-require 'exec-path-from-shell) (exec-path-from-shell-initialize) ``` -------------------------------- ### Configure lsp-mode for ElixirLS Source: https://github.com/elixir-lsp/elixir-ls/blob/master/docs/getting-started/emacs.md Add this configuration to your Emacs init file to integrate ElixirLS with lsp-mode. Ensure the path to the ElixirLS release is correctly set. ```elisp (use-package lsp-mode :commands lsp :ensure t :diminish lsp-mode :hook (elixir-mode . lsp) :init (add-to-list 'exec-path "path-to-elixir-ls/release")) ``` -------------------------------- ### VSCode Launch Configuration for Single Test File Source: https://github.com/elixir-lsp/elixir-ls/blob/master/docs/getting-started/vscode.md To debug a single test file or a specific test line, modify 'taskArgs' and 'requireFiles' to target only the desired test. ```json { "type": "mix_task", "name": "mix test", "request": "launch", "task": "test", "taskArgs": ["tests/some_test.exs:123"], "projectDir": "${workspaceRoot}", "requireFiles": [ "test/**/test_helper.exs", "test/some_test.exs" ] } ``` -------------------------------- ### Enable ElixirLS Client Logging Source: https://github.com/elixir-lsp/elixir-ls/blob/master/docs/getting-started/emacs.md Enable client-side logging for ElixirLS to help with troubleshooting. Logs can be viewed using `lsp-workspace-show-log`. ```elisp (setq lsp-log-io t) ``` -------------------------------- ### Default VSCode Launch Configuration for Mix Test Source: https://github.com/elixir-lsp/elixir-ls/blob/master/docs/getting-started/vscode.md This is the default launch configuration for 'mix test'. It ensures all test files and helpers are loaded and interpreted for debugging. ```json { "type": "mix_task", "name": "mix test", "request": "launch", "task": "test", "taskArgs": ["--trace"], "projectDir": "${workspaceRoot}", "requireFiles": [ "test/**/test_helper.exs", "test/**/*_test.exs" ] } ``` -------------------------------- ### Configure eglot for ElixirLS Source: https://github.com/elixir-lsp/elixir-ls/blob/master/docs/getting-started/emacs.md Set up eglot to automatically run ElixirLS for Elixir files. Remember to update the path to the language server executable. ```elisp (require 'eglot) ;; This is optional. It automatically runs `M-x eglot` for you whenever you are in `elixir-mode` (add-hook 'elixir-mode-hook 'eglot-ensure) ;; Make sure to edit the path appropriately, use the .bat script instead for Windows (add-to-list 'eglot-server-programs '(elixir-mode "path-to-elixir-ls/release/language_server.sh")) ``` -------------------------------- ### Launch Configuration for Debugging Phoenix Apps Source: https://github.com/elixir-lsp/elixir-ls/blob/master/README.md Use this configuration to debug Phoenix applications with ElixirLS. It specifies the 'phx.server' task and configures module interpretation to avoid performance issues. ```json { "type": "mix_task", "name": "phx.server", "request": "launch", "task": "phx.server", "projectDir": "${workspaceRoot}", "debugAutoInterpretAllModules": false, "debugInterpretModulesPatterns": ["MyApp*", "MyAppWeb*"], "exitAfterTaskReturns": false } ``` -------------------------------- ### Attach to Remote Elixir Node for Debugging Source: https://github.com/elixir-lsp/elixir-ls/blob/master/README.md Configure a launch setting to attach to a remote OTP cluster node for debugging. Ensure the remote node is accessible and configured with the correct cookie and name/sname. ```json { "type": "mix_task", "name": "attach", "request": "attach", "projectDir": "${workspaceRoot}", "remoteNode": "some@host", "debugAutoInterpretAllModules": false, "debugInterpretModulesPatterns": ["MyApp.*"], "env": { "ELS_ELIXIR_OPTS": "--sname elixir_ls_dap --cookie mysecret" } } ``` -------------------------------- ### VSCode Launch Configuration with Module Exclusion Source: https://github.com/elixir-lsp/elixir-ls/blob/master/docs/getting-started/vscode.md Use 'excludeModules' to prevent specific modules, such as NIFs or slow-performing modules, from being interpreted by the debugger. ```json { "type": "mix_task", "name": "mix test", "request": "launch", "task": "test", "taskArgs": ["--trace"], "projectDir": "${workspaceRoot}", "requireFiles": [ "test/**/test_helper.exs", "test/**/*_test.exs" ], "excludeModules": [ ":some_nif", "Some.SlowModule" ] } ``` -------------------------------- ### Launch Configuration for Debugging Tests with NIF Exclusion Source: https://github.com/elixir-lsp/elixir-ls/blob/master/README.md This configuration is for debugging tests with ElixirLS, specifically excluding NIF modules and other slow modules using the 'excludeModules' option. ```json { "type": "mix_task", "name": "mix test", "request": "launch", "task": "test", "taskArgs": ["--trace"], "projectDir": "${workspaceRoot}", "requireFiles": ["test/**/test_helper.exs", "test/**/*_test.exs"], "excludeModules": [":some_nif", "Some.SlowModule"] } ``` -------------------------------- ### Execute Quick Fix Actions Source: https://github.com/elixir-lsp/elixir-ls/blob/master/docs/getting-started/emacs.md If `lsp-ui-sideline` is enabled, use `lsp-execute-code-action` to trigger quick-fix actions available for the current code. ```emacs-lisp M-x lsp-execute-code-action ``` -------------------------------- ### Show ElixirLS Workspace Log Source: https://github.com/elixir-lsp/elixir-ls/blob/master/docs/getting-started/emacs.md Display the client logs for the current workspace, useful for diagnosing issues with ElixirLS. ```emacs-lisp M-x lsp-workspace-show-log ``` -------------------------------- ### Configure ElixirLS Debug Adapter Options Source: https://github.com/elixir-lsp/elixir-ls/blob/master/README.md Set environment variables for the ElixirLS debug adapter to specify node name and cookie for OTP distribution. ```json { "env": { "ELS_ELIXIR_OPTS": "--name mynode@localhost --cookie secret" } } ``` -------------------------------- ### Format Elixir Code Source: https://github.com/elixir-lsp/elixir-ls/blob/master/DEVELOPMENT.md Ensure code consistency by running the 'mix format' command in both the ElixirLS root and the 'apps/language_server' directory. ```shell mix format ``` -------------------------------- ### Run Language Server with Specific Shell in Docker Source: https://github.com/elixir-lsp/elixir-ls/blob/master/DEVELOPMENT.md Execute the language server script within a Docker container, specifying the shell to use (e.g., ash or bash). ELS_LOCAL=1 ensures local source usage. ```shell ELS_LOCAL=1 SHELL=ash scripts/language_server.sh ``` ```shell ELS_LOCAL=1 SHELL=bash bash scripts/language_server.sh ``` -------------------------------- ### Emacs find-file-visit-truename Configuration Source: https://github.com/elixir-lsp/elixir-ls/blob/master/README.md Set `find-file-visit-truename` to `t` in Emacs to resolve potential issues with LSP crashing on projects accessed via symlinks. ```elisp (setq find-file-visit-truename t) ``` -------------------------------- ### Restart ElixirLS Workspace Source: https://github.com/elixir-lsp/elixir-ls/blob/master/docs/getting-started/emacs.md Use this command to restart the ElixirLS language server for the current workspace, useful after updates or crashes. ```emacs-lisp M-x lsp-workspace-restart ``` -------------------------------- ### Trigger Code Actions with Avy Source: https://github.com/elixir-lsp/elixir-ls/blob/master/docs/getting-started/emacs.md Use `lsp-avy-lens` to display letters next to code lenses, allowing quick triggering of actions by pressing the corresponding letter. ```emacs-lisp M-x lsp-avy-lens ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.