Git Product home page Git Product logo

elixir-lsp / elixir-ls Goto Github PK

View Code? Open in Web Editor NEW
1.4K 1.4K 183.0 6.85 MB

A frontend-independent IDE "smartness" server for Elixir. Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"

Home Page: https://elixir-lsp.github.io/elixir-ls/

License: Apache License 2.0

Elixir 99.26% Batchfile 0.09% Shell 0.64% Dockerfile 0.01%
debug-adapter-protocol elixir language-server language-server-protocol lsp

elixir-ls's Introduction

ElixirLS - Elixir Language Server and Debug Adapter

Actions Status Slack

ElixirLS 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. Debug adapter implements Debug Adapter Protocol.

This is the main elixir-ls repo

This repo is a community maintained fork. The original repository JakeBecker/elixir-ls has now been deprecated in favor of this one.

Features

  • Debugger support
  • Automatic, incremental Dialyzer analysis
  • Automatic inline suggestion of @specs based on Dialyzer's inferred success typings
  • Inline reporting of build warnings and errors
  • Documentation lookup on hover
  • Go-to-definition
  • Code completion
  • Code formatter
  • Find references to functions and modules (Thanks to @mattbaker)
  • Quick symbol lookup in file (Thanks to @mattbaker)
  • Quick symbol lookup in workspace and stdlib (both Elixir and erlang) (@lukaszsamson)

Screenshot

Note: 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.

IDE plugins

IDE Plugin Support
BBEdit bbpackage
Emacs eglot
Emacs lsp-mode Supports debug adapter via dap-mode
Kakoune kak-lsp Limitations
Kate built-in LSP Client plugin Does not support debug adapter
Neovim coc.nvim Does not support debug adapter
Neovim nvim-dap Supports debug adapter only
Neovim nvim-lspconfig Does not support debug adapter
Nova nova-elixir-ls
Sublime Text LSP-elixir Does not support debug adapter
Vim/Neovim ALE Does not support debug adapter or @spec suggestions
Vim/Neovim elixir-lsp/coc-elixir Does not support debug adapter
Vim/Neovim vim-lsp Does not support debug adapter
VS Code elixir-lsp/vscode-elixir-ls Supports all ElixirLS features
Helix elixir-lsp Supports all ElixirLS features

Please feel free to create and publish your own client packages and add them to this list!

Detailed Installation Instructions

The installation process for ElixirLS depends on your editor.

VSCode

Please install the extension via the following link: https://marketplace.visualstudio.com/items?itemName=JakeBecker.elixir-ls

Emacs Installation Instructions

Download the latest release and unzip it into a directory. (This is the directory referred to as the "path-to-elixir-ls/release", below.)

If you will be using lsp-mode, add this configuration:

  (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"))

For eglot, use:

(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)

;; Be 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"))

Supported Elixir and OTP versions

Elixir itself supports five versions with security updates: https://hexdocs.pm/elixir/compatibility-and-deprecations.html#content

OTP supports the last three versions: http://erlang.2086793.n4.nabble.com/OTP-Versions-and-Maint-Branches-td4722416.html

ElixirLS generally aims to support the last three released versions of Elixir and the last three versions of OTP. However this is not a hard and fast rule and may change in the future.

Support matrix

OTP Versions Elixir Versions Supports ElixirLS Issue(s)
any <= 1.12 No No support for Code.Fragment
22 1.12 Yes Erlang docs not working (requires EIP 48)
23 1.12 - 1.14 Yes None
24 1.12 - 1.16 Yes None
25 1.13.4 - 1.16 Yes None
26.0.0 - 26.0.1 any No #886
26.0.2 - 26.1.2 1.14.5 - 1.16 *nix only #927, #1023
>= 26.2.0 1.14.5 - 1.16 Yes None
any 1.15.5 Yes Broken formatter #975

Version management

It is generally recommended to install Elixir and Erlang via ASDF so that you can have different projects using different versions of Elixir without having to change your system-installed version. ElixirLS can detect and use the versions of Elixir and Erlang that you have configured in ASDF.

Debugger support

ElixirLS provides debug adapter support adhering to the Debug Adapter Protocol, which is closely related to the Language Server Protocol.

When 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.

Please note that there is currently a limit of 100 breakpoints.

To 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:

{
  "type": "mix_task",
  "name": "mix test",
  "request": "launch",
  "task": "test",
  "taskArgs": ["--trace"],
  "startApps": true,
  "projectDir": "${workspaceRoot}",
  "requireFiles": ["test/**/test_helper.exs", "test/**/*_test.exs"]
}

Currently, 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.

{
  "type": "mix_task",
  "name": "mix test",
  "request": "launch",
  "task": "test",
  "taskArgs": ["tests/some_test.exs:123"],
  "startApps": true,
  "projectDir": "${workspaceRoot}",
  "requireFiles": ["test/**/test_helper.exs", "test/some_test.exs"]
}

Debugging Phoenix apps

To debug Phoenix applications using ElixirLS, you can use the following launch configuration:

{
  "type": "mix_task",
  "name": "phx.server",
  "request": "launch",
  "task": "phx.server",
  "projectDir": "${workspaceRoot}"
}

Please 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.

If 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.

NIF modules limitation

It'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.

{
  "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"]
}

Function breakpoints

Function 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).

For 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.

Please note that function breakpoints only work for public functions and do not support breaking on private functions.

Conditional breakpoints

Break 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.

For example, you could set a breakpoint on a line of code that sets a variable x, adding a break condition of x > 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.

However, 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.

Hit conditions

A "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.

For 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.

Log points

"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 \}.

It's important to note that as of version 1.51 of the Debug Adapter Protocol specification, log messages are not supported on function breakpoints.

Expression evaluator

The 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.

To 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:

a = 4
if true do
  a = 5
end
some

If 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.

Additionally, 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).

Connecting to debug adapter

It 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 in the launch configuration and pass in the appropriate node name/sname and cookie.

{
  "env": {
    "ELS_ELIXIR_OPTS": "--name mynode@localhost --cookie secret"
  }
}

Automatic builds and error reporting

ElixirLS 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.

Internally, 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.

Dialyzer integration

Dialyzer 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.

After 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.

You 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, under the section "Warning options".

To disable Dialyzer completely, set elixirLS.dialyzerEnabled to false.

If Dialyzer gets stuck and emits incorrect or outdated warnings, it's best to restart the language server.

Code completion

ElixirLS provides an advanced code completion provider. This provider uses two main mechanisms to provide suggestions to the user.

The 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.

The 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.

The completions include:

  • keywords
  • special form snippets
  • functions
  • macros
  • modules
  • variables
  • sigils
  • struct fields (only if the struct type is explicitly stated or can be inferred from the variable binding)
  • atom map keys (if map keys can be inferred from variable binding)
  • attributes
  • binary modifiers
  • types (in typespecs)
  • behaviour callbacks (inside the body of implementing module)
  • protocol functions (inside the body of implementing module)
  • keys in keyword functions arguments (if defined in spec)
  • function returns (if defined in spec)

Workspace Symbols

With 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.

ElixirLS configuration settings

Below 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.

elixirLS.autoBuild
Trigger ElixirLS build when code is saved
elixirLS.dialyzerEnabled
Run ElixirLS's rapid Dialyzer when code is saved
elixirLS.incrementalDialyzer
Use OTP incremental dialyzer (available on OTP 26+)
elixirLS.dialyzerWarnOpts
Dialyzer options to enable or disable warnings - See Dialyzer's documentation for options. Note that the race_conditions option is unsupported.
elixirLS.dialyzerFormat
Formatter to use for Dialyzer warnings
elixirLS.envVariables
Environment variables to use for compilation
elixirLS.mixEnv
Mix environment to use for compilation
elixirLS.mixTarget
Mix target to use for compilation
elixirLS.projectDir
Subdirectory containing the Mix project, if it is not in the project root
elixirLS.fetchDeps
Automatically fetch project dependencies when compiling.
elixirLS.suggestSpecs
Suggest @spec annotations inline, using Dialyzer's inferred success typings (Requires Dialyzer).
elixirLS.trace.server
Traces communication between VS Code and the Elixir language server.
elixirLS.autoInsertRequiredAlias
Enable auto-insert required alias - By default, this option is true (enabled).
elixirLS.signatureAfterComplete
Show signature help after confirming autocomplete.
elixirLS.enableTestLenses
Show code lenses to run tests in terminal.
elixirLS.additionalWatchedExtensions
Additional file types capable of triggering a build on change
elixirLS.languageServerOverridePath
Absolute path to an alternative ElixirLS release that will override the packaged release

Debug Adapter configuration options

Below 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.

startApps
Run mix app.start before launching the debugger. Some tasks (such as Phoenix tests) expect apps to already be running before the test files are required. Defaults to false.
task
Mix task to run with debugger - Defaults to task set under :default_task key in mixfile.
taskArgs
A list of arguments to mix task
debugAutoInterpretAllModules
Auto interpret all modules from project build path. Defaults to true.
env
An object with environment variables - To set Object keys, specify environment variables; values should be strings.
stackTraceMode
Option passed to :int.stack_trace/1. See :int.stack_trace/1 for details. Allowed values are all, no_tail, and false.
requireFiles
A list of additional files that should be required and interpreted - This is especially useful for debugging tests.
debugInterpretModulesPatterns
A list of globs specifying modules that should be interpreted
projectDir
An absolute path to the directory where `mix.exs` is located - In VSCode, ${workspaceRoot} can be used.
excludeModules
A list of modules that should not be interpreted
exitAfterTaskReturns
Should the debug session stop when mix task returns. Tasks that return early while the code continues running asynchronously require false setting. Defaults to true.
noDebug
Run mix task without debugging. Defaults to false.
breakOnDbg
Should the debugger break on Kernel.dbg/2 macro. Defaults to true.

Troubleshooting

Basic troubleshooting steps:

  • Make sure you have hex and git installed.
  • 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.
  • 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)
  • Restart ElixirLS with the custom command restart.
  • Run mix clean or mix clean --deps in ElixirLS with the custom command mixClean.
  • Restart your editor (which will restart ElixirLS).
  • After stopping your editor, remove the entire .elixir_ls directory, then restart your editor.
    • NOTE: This will cause you to have to re-run the entire dialyzer build.

You 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.

If you get an error like the following immediately on startup:

[Warn  - 1:56:04 PM] ** (exit) exited in: GenServer.call(ElixirLS.LanguageServer.JsonRpc, {:packet, %{...snip...}}, 5000)
    ** (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

and 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.)

On 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.)

If you are seeing the message "Invalid beam file or no abstract code", you need to make sure that your Mix project is set to use the elixirc compiler option --debug-info, which can be done by adding the following line to your mix.exs project section:

elixirc_options: [debug_info: Mix.env() == :dev]

For example:

defmodule MyApp.MixProject do
  use Mix.Project

  def project do
    [
      app: :my_app,
      version: "0.1.0",
      elixir: "~> 1.11",
      elixirc_paths: elixirc_paths(Mix.env()),
      elixirc_options: [debug_info: Mix.env() == :dev],
    ...

If you are using Emacs with lsp-mode, there's a possibility that you have set the wrong directory as the project root (especially if that directory does not have a mix.exs file). To fix that, you should remove the project and re-initialize: #364 (comment)

Known Issues/Limitations

  • .exs files don't return compilation errors.
  • "Fetching n dependencies" sometimes get stuck (remove the .elixir_ls directory to fix).
  • "Go to definition" does not work within the scope of a Phoenix router.
  • On first launch, Dialyzer will cause high CPU usage for a considerable time.
  • Dialyzer does not pick up changes involving remote types (#502)

Building and running

There are two ways of building the release: Mix.install based (recommended) and .ez archives (deprecated).

Mix.install based release

mix deps.get
MIX_ENV=prod mix compile
MIX_ENV=prod mix elixir_ls.release2 -o <release_dir>

This copies language server and debugger adapter launch scripts to the <release_dir> 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.

Deprecated .ez archives release

mix deps.get
MIX_ENV=prod mix compile
MIX_ENV=prod mix elixir_ls.release -o <release_dir>

This builds the language server and debugger as a set of .ez archives and creates .sh and .bat scripts to launch them.

If you're packaging these archives in an IDE plugin, be sure to build using the minimum supported OTP version. This will provide the best backwards compatibility.

Local setup

This section provides additional information on how to set up the ElixirLS locally.

When 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 (a version manager for Elixir and other languages), but that may not always be what is needed.

To ensure that the correct environment is set up, you can create a setup script. The setup script location varies based on platform and shell:

  • Unix-based systems using bash or zsh: $XDG_CONFIG_HOME/elixir_ls/setup.sh (by default ~/.config/elixir_ls/setup.sh)
  • Unix-based systems using fish: $XDG_CONFIG_HOME/elixir_ls/setup.fish (by default ~/.config/elixir_ls/setup.fish)
  • Windows-based systems %APPDATA%\elixir_ls\setup.bat

In 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.

Note: The setup script must not read from stdin or write to stdout. On Unix, Linux, and macOS this might be accomplished by adding >/dev/null at the end of any line that produces output; for a Windows batch script, you will want to add @echo off at the top and use >nul.

If you want to debug your setup script you can write to stderr.

Development

Please refer to DEVELOPMENT.md.

Environment variables

ElixirLS supports the following environment variables.

ELS_INSTALL_PREFIX
(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.
ELS_LOCAL
If set to 1, this will make ElixirLS run a local release. If this is not set, a published release matching VERSION will be used (default).
ELS_ELIXIR_OPTS
Optional parameters to pass to elixir CLI - May be used to set a node name and cookie.
ELS_ERL_OPTS
Optional parameters to pass to the erl CLI
ASDF_DIR
(not supported on Windows) If this is set, ElixirLS will look for the ASDF script in a directory given by that variable.

Telemetry

ElixirLS language server sends telemetry information to the client via LSP Telemetry notification, DAP Output event and DAP ErrorResponse. Telemetry data include usage, performance, environment info and error reports. Please refer to your client and/or extension documentation on telemetry.

Acknowledgements and related projects

ElixirLS incorporates code intelligence providers that were originally developed in Elixir Sense and still uses this library for lower lever operations. Other prior work includes Alchemist Server, Elixir plugin for Atom, VSCode Elixir. Credit for those projects goes to their respective authors.

License

ElixirLS source code is released under Apache License 2.0.

See LICENSE for more information.

ElixirLS includes parts of other projects, please see the respective licenses which apply to them.

elixir-ls's People

Contributors

akash-akya avatar asummers avatar axelson avatar blindingdark avatar bottlenecked avatar danirukun avatar dependabot[bot] avatar gofenix avatar gonzooo avatar hworld avatar jakebecker avatar jjcarstens avatar jtrees avatar lukaszsamson avatar maciej-szlosarczyk avatar mattbaker avatar msaraiva avatar oo6 avatar polvalente avatar princemaple avatar richmorin avatar rodrigues avatar scohen avatar scottming avatar sheldak avatar tcrossland avatar trevoke avatar victorolinasc avatar wingyplus avatar zetaron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elixir-ls's Issues

Discussion: Change packaging approach

Currently ElixirLS is packaged with https://github.com/JakeBecker/mix_task_archive_deps as .ez archives. This approach means that the language server is run by a different version of elixir than it was compiled with which can cause issues such as #107

ElixirLS used to run as an escript but that was changed in v0.2.4: 25 Oct 2017:

Package ElixirLS as .ez archives instead of escripts. This should make asdf installs work.

Goals/Requirements:

  1. End-user's code should be compiled with the version of elixir and erlang that they have in their .tool-versions or installed globally
    a. This means that reported warnings/errors match the version of Elixir that they're using, not earlier or later versions
  2. The majority of the ElixirLS/ElixirSense code should run on the same version of elixir that it was compiled on
  3. For users of the vscode-elixir-ls package it should continue to be a one-click install

Possible approaches:

  1. Continue to use mix_task_archive_deps
  2. Use escripts
  3. Use a release
  4. Other?
  5. Separate BEAM instance with source code (being fleshed out in #136)

Potential issues to be aware of:

  1. With mix_task_archive_deps there can only be one version of a dependency running which is mainly an issue for Jason and Dialyxir (but if we added more dependencies it could become a larger issue)
  2. Compiled Elixir code relies on Elixir internals that could change (see #107 for an example)
    a. This is the issue that is currently causing the most trouble
  3. Elixir releases are generally recommended to be built on the same version of OS that they will run on
  4. Escripts require Erlang to be installed on the target system

I will come back and flesh out the issues and possible approaches later, along with more clear guidelines on what the requirements are.
Edit: added above

Please tag your releases!

Hello, I run into this when trying to set up Emacs integration with Elixir LS. At first, I went to the releases page to fetch the latest release, where I noticed that the latest version (v0.2.18) was released almost half a year ago. Then I opened Changelog, and it turned out that there were actually eight more releases with the latest one (v0.2.26) released 12 days ago. It's a little confusing for newcomers, so please, create Git tags for new releases!

Emacs lsp-mode not registering file watchers

Environment

  • Elixir & Erlang versions (elixir --version): 1.81 (OTP 20)
  • Client (editor or IDE): Emacs 25 (lsp-mode)

Problem Description

I use emacs with lsp-mode for a number of different programming languages. I found a problem when using elixir-ls in that compilation errors were not appearing in the emacs buffer.
Upon further inspection, I found that the lsp-mode client sent a textDocument/didChange notification instead of a workspace/didChangeWatchedFiles notification, which would trigger a build.

This behaviour is not replicated on VS Code. VS Code seems to eagerly create file watchers without being specifically prompted by the server. From the LSP specification:

It is recommended that servers register for these file events using the registration mechanism. In former implementations clients pushed file events without the server actively asking for it.

This is fine for the plugin, since it is known that the server does support file watchers. However, it seems that Emacs lsp-mode acts more conservatively in this respect, and does not create file watches unless specifically asked to.

Proposed Solution

Digging into the source code, I've found the infrastructure to send requests is present. By sending an additional message to the client, Emacs lsp-mode takes care of everything else and syntax highlighting and re-building work as intended.

Provide easy configuration for limiting resource (mainly CPU) usage?

Environment

  • Elixir & Erlang versions (elixir --version): 1.9.2
  • Operating system: Linux Mint 19
  • Client (editor or IDE): Vim

I installed Elixir-LS a little bit ago, and I've noticed that it is a very resource intensive program. Since I usually leave vim open while doing other things, it will chew up a lot of CPU, making my computer relatively slow.

I was able to remedy this by editing the startup script to restrict the number of schedulers so that it was never taking up too much of my machine (now 2 cores out of the 8 available with elixir --erl "+S 2:2" -e "ElixirLS.LanguageServer.CLI.main()"), but I'm betting most Elixir users won't know how to do this, and it might affect their experience.

Maybe it would be nice if there was a way to let users easily configure how much of their machine's CPU they want Elixir-LS to have access to?

Guidance on what version the language server should run

Environment

  • Elixir & Erlang versions (elixir --version): Lots :)
  • Operating system: Linux
  • Client (editor or IDE): Emacs 26.2 / Spacemacs development branch.

Description

I run a single Emacs server, and graphical or terminal clients; at any given time, I may have one or more Elixir projects open (using projectile) and I'm switching through a wide variety of Elixir/OTP version requirements, all neatly handled by asdf-vm.

As far as I can tell, only one language server is started by Emacs and shared by all the projects. I'm not sure whether that's intended or not but it does beg the question what version the language server should run under. Currently, Emacs starts language_server.sh from whatever project directory is current, and this version may be too old (or too new?) for other projects.

My hunch is that elixir-ls should be compiled with the lowest supported version and run with the highest supported version so that it understands everything that various projects throw at it, but I'm not sure. In any case, it smells to me that "what version to run this with" is a tad under-documented.

Fix the tests

The tests are currently broken and we should try to fix them.

MatchError when :dialyzer.format_warning/1 returns an error

message = String.trim(to_string(:dialyzer.format_warning(raw_warning)))

The log:

** (MatchError) no match of right hand side value: {:error, {1, :erl_parse, ['syntax error before: ', '\'?\'']}}
    dialyzer.erl:626: anonymous fn/1 in :dialyzer.sig/2
    dialyzer.erl:541: :dialyzer.call_or_apply_to_string/6
    dialyzer.erl:322: :dialyzer.message_to_string/2
    dialyzer.erl:297: :dialyzer.format_warning/2
    (language_server) lib/language_server/dialyzer.ex:461: ElixirLS.LanguageServer.Dialyzer.dialyzer_raw_warning_message/1
    (language_server) lib/language_server/dialyzer.ex:421: anonymous fn/4 in ElixirLS.LanguageServer.Dialyzer.to_diagnostics/3
    (elixir) lib/enum.ex:1940: Enum."-reduce/3-lists^foldl/2-0-"/3
    (stdlib) maps.erl:232: :maps.fold_1/3
Last message (from #PID<0.2866.0>): {:analysis_finished, :ok, {:plt, #Reference<0.428144727.440533000.7688>, #Reference<0.428144727.440533000.7690>, #Reference<0.428144727.440533000.7689>, #Reference<0.428144727.440533000.7691>, #Reference<0.428144727.440533000.7692>},

What's this project's goal?

Hi, I just stumbled upon this repo and wonder two things:

  • What's this project its goal, or how is it different from Jake Becker's version?
  • Why or when should I use this project instead of Jake Becker's version

KR,
Edward

asdf does not support sh

David Sweeney in this Elixir Forum post recently discovered the issue that our language_server.sh is no longer sh compatible because asdf (added in #78) is not currently sh compatible.

The error manifests itself with an error like:
/home/my_home/.asdf/asdf.sh: 8: /home/my_home/.asdf/asdf.sh: Bad substitution

I have raised an issue on asdf to determine if asdf is meant to support sh/dash, or only bash and other shells.

I see a few possible ways forward but would like to collect other's thoughts about them:

  1. Change language_server.sh to run bash instead of sh (via #!/usr/bin/env bash)
  2. Revert #78
  3. Wait for asdf to support sh

I'm currently leaning towards option 1 because bash is very widespread at this point and I'd imagine most systems will have it and for any that don't, the user will most likely understand how to fix the error.

Does not work on elixir 1.10

Non standard expandMacro request

Comparing this fork with Jake's master, I've found this: JakeBecker/elixir-ls@643bb31

Is this still conformant to the language server protocol?

In the specification, if you search for interface ServerCapabilities, the allowed keys seems to be a very strict set, I'm not sure if adding macro expansion is valid.

Maybe that's the case for a code action instead?

Thanks!

Crashes when using magit's `time-machine-transient-state`

Environment

  • Elixir & Erlang versions (elixir --version): 1.8.1
  • Operating system: MacOS
  • Client (editor or IDE): Emacs 26.3

Crash report template

Delete this section if not reporting a crash

  1. If using a client other than VS Code, please try VS Code's ElixirLS extension. Does it reproduce your failure?
    It doesn't have magit
  2. Create a new Mix project with mix new empty, then open that project with VS Code and open an Elixir file. Is your issue reproducible on the empty project? If not, please publish a repo on Github that does reproduce it.
    Yes
  3. Check the output log by opening View > Output and selecting "ElixirLS" in the dropdown. Please include any output that looks relevant. (If ElixirLS isn't in the dropdown, the server failed to launch.)
    Not in VSCode
  4. Check the developer console by opening Help > Toggle Developer Tools and include any errors that look relevant.
    Not in VSCode

Steps to reproduce

  1. Create a new project
  2. Create at least two git commits
  3. Use time-machine-transient-state to display the state of the file under a previous commit

Dialyzer write manifest crashes on CI on elixir 1.7

Environment

  • Elixir & Erlang versions (elixir --version): 1.7, otp 20.3
  • Operating system: linux

Crash report template

00:20:55.080 [error] Task #PID<0.1544.0> started from #PID<0.1232.0> terminating
** (ArgumentError) argument error
    (stdlib) :ets.select_trap({#Reference<0.1221418905.1456340993.57541>, 2003, 0, #Reference<0.1221418905.1456340994.55827>, [{{Logger, :enable, 1}, {{:c, :atom, [:ok], :unknown}, [:any]}}, {{:erl_types, :t_map_def_key, 2}, {:any, [{:c, :opaque, [{:opaque, :erl_types, :erl_type, [], {:c, :union, [{:c, :atom, [:any, :none, :unit], :unknown}, :none, :none, :none, :none, :none, {:c, :tuple, [{:c, :atom, [:c], :unknown}, {:c, :atom, :any, :unknown}, :any, {:c, :union, [{:c, :atom, [:float, :integer, :nonempty, :pid, :port, ...], :unknown}, :none, :none, :none, :none, :none, {:c, :tuple, ...}, :none, :none, ...], :unknown}], {4, {:c, :atom, [:c], :unknown}}}, :none, :none, :none], :unknown}}], :unknown}, {:c, :union, [{:c, :atom, [:universe], :unknown}, :none, :none, :none, {:c, :list, [{:c, :opaque, [{:opaque, :erl_types, :erl_type, [], {:c, :union, [{:c, :atom, [:any, :none, :unit], :unknown}, :none, :none, :none, :none, :none, {:c, :tuple, [{:c, :atom, ...}, {:c, ...}, :any, ...], {4, {...}}}, :none, :none, :none], :unknown}}], :unknown}, {:c, nil, [], :unknown}], :unknown}, :none, :none, :none, :none, :none], :unknown}]}}, {{:file, :path_eval, 3}, {{:c, :tuple_set, [{2, [{:c, :tuple, [{:c, :atom, [:error], :unknown}, {:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, :none, :none, :none, {:c, :tuple, [{:c, :union, [:none, :none, :none, :none, :none, {:c, :number, {:int_rng, ...}, :integer}, {:c, :tuple, [...], ...}, :none, :none, :none], :unknown}, {:c, :atom, :any, :unknown}, :any], {3, :any}}, :none, :none, :none], :unknown}], {2, {:c, :atom, [:error], :unknown}}}, {:c, :tuple, [{:c, :atom, [:ok], :unknown}, :any], {2, {:c, :atom, [:ok], :unknown}}}]}], :unknown}, [{:c, :list, [{:c, :union, [{:c, :atom, :any, :unknown}, {:c, :binary, [8, 0], :unknown}, :none, :none, {:c, :list, [{:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, :none, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}, {:c, :number, {:int_rng, 0, 1114111}, :integer}, :none, :none, :none, :none], :unknown}, {:c, nil, [], :unknown}], :unknown}, :none, :none, :none, :none, :none], :unknown}, {:c, nil, [], :unknown}], :unknown}, {:c, :union, [{:c, :atom, :any, :unknown}, {:c, :binary, [8, 0], :unknown}, :none, :none, {:c, :list, [{:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, :none, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}, {:c, :number, {:int_rng, 0, 1114111}, :integer}, :none, :none, :none, :none], :unknown}, {:c, nil, [], :unknown}], :unknown}, :none, :none, :none, :none, :none], :unknown}, :any]}}, {{:digraph, :add_vertex, 1}, {:any, [{:c, :opaque, [{:opaque, :digraph, :graph, [], {:c, :tuple, [{:c, :atom, [:digraph], :unknown}, {:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, :none, :none, :none, :none, :none, {:c, :opaque, [{:opaque, :ets, :tid, [], {:c, ...}}], :unknown}, :none], :unknown}, {:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, :none, :none, :none, :none, :none, {:c, :opaque, [{:opaque, :ets, :tid, [], {...}}], :unknown}, :none], :unknown}, {:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, :none, :none, :none, :none, :none, {:c, :opaque, [{:opaque, :ets, :tid, [], ...}], :unknown}, :none], :unknown}, {:c, :atom, [false, true], :unknown}], {5, {:c, :atom, [:digraph], :unknown}}}}], :unknown}]}}, {{Registry, :start_link, 3}, {{:c, :tuple_set, [{2, [{:c, :tuple, [{:c, :atom, [:error], :unknown}, :any], {2, {:c, :atom, [:error], :unknown}}}, {:c, :tuple, [{:c, :atom, [:ok], :unknown}, {:c, :identifier, [:pid], :unknown}], {2, {:c, :atom, [:ok], :unknown}}}]}], :unknown}, [{:c, :atom, [:duplicate, :unique], :unknown}, {:c, :atom, :any, :unknown}, {:c, :list, [{:c, :tuple_set, [{2, [{:c, :tuple, [{:c, :atom, [:keys], :unknown}, {:c, :atom, [:duplicate, :unique], :unknown}], {2, {:c, :atom, [:keys], :unknown}}}, {:c, :tuple, [{:c, :atom, [:listeners], :unknown}, {:c, :list, [{:c, :atom, :any, :unknown}, {:c, nil, [], :unknown}], :unknown}], {2, {:c, :atom, [:listeners], :unknown}}}, {:c, :tuple, [{:c, :atom, [:meta], :unknown}, {:c, :list, [{:c, :tuple, [:any, :any], {2, :any}}, {:c, nil, [], :unknown}], :unknown}], {2, {:c, :atom, [:meta], :unknown}}}, {:c, :tuple, [{:c, :atom, [:name], :unknown}, {:c, :atom, :any, :unknown}], {2, {:c, :atom, [:name], :unknown}}}, {:c, :tuple, [{:c, :atom, [:partitions], :unknown}, {:c, :number, {:int_rng, 1, :pos_inf}, :integer}], {2, {:c, :atom, [:partitions], :unknown}}}]}], :unknown}, {:c, nil, [], :unknown}], :unknown}]}}, {{:hipe_arm_cfg, :init, 1}, {{:c, :tuple, [{:c, :atom, [:cfg], :unknown}, {:c, :opaque, [{:opaque, :gb_trees, :tree, [:any, :any], {:c, :tuple, [{:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, :union, [{:c, :atom, [nil], :unknown}, :none, :none, :none, :none, :none, {:c, :tuple, [:any, :any, :any, :any], {4, :any}}, :none, :none, :none], :unknown}], {2, :any}}}], :unknown}, {:c, :tuple, [{:c, :atom, [:cfg_info], :unknown}, {:c, :tuple, [:any, :any, :any], {3, :any}}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, :atom, [false, true], :unknown}, {:c, :union, [{:c, :atom, [:none], :unknown}, :none, :none, :none, :none, {:c, :number, {:int_rng, 0, 255}, :integer}, :none, :none, :none, :none], :unknown}, {:c, :atom, [false, true], :unknown}, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}], {8, {:c, :atom, [:cfg_info], :unknown}}}, {:c, :tuple, [{:c, :opaque, [{:opaque, :dict, :dict, [:any, :any], {:c, :tuple, [:any, :any, :any, :any, :any, :any, :any, :any, :any], {9, :any}}}], :unknown}, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}], {3, :any}}], {4, {:c, :atom, [:cfg], :unknown}}}, [{:c, :tuple, [{:c, :atom, [:defun], :unknown}, {:c, :tuple, [{:c, :atom, :any, :unknown}, {:c, :atom, :any, :unknown}, {:c, :number, {:int_rng, 0, 255}, :integer}], {3, :any}}, :any, :any, {:c, :tuple, [{:c, :opaque, [{:opaque, :dict, :dict, [:any, :any], {:c, :tuple, [{:c, :atom, [:dict], :unknown}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, :number, {:int_rng, 0, ...}, :integer}, {:c, :number, {:int_rng, ...}, :integer}, {:c, :number, {...}, ...}, {:c, :tuple, ...}, {:c, ...}], {9, {:c, :atom, [:dict], :unknown}}}}], :unknown}, {:c, :list, [{:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, nil, [], :unknown}], :unknown}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}], {3, :any}}, {:c, :atom, [false, true], :unknown}, {:c, :atom, [false, true], :unknown}, :any, :any], {9, {:c, :atom, [:defun], :unknown}}}]}}, {{IO, :module_info, 1}, {:any, [:any]}}, {{:hipe_ppc_specific_fp, :def_use, 2}, {{:c, :tuple, [{:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}], {2, :any}}, [:any, :any]}}, {{:erl_posix_msg, :message, 1}, {:any, [:any]}}, {{Kernel.LexicalTracker, :remote_dispatch, 5}, {{:c, :atom, [:ok], :unknown}, [{:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, {:c, :identifier, [:pid], :unknown}, :none, :none, {:c, :tuple_set, [{2, [{:c, :tuple, [{:c, :atom, :any, :unknown}, :any], {2, :any}}]}, {3, [{:c, :tuple, [{:c, :atom, [:via], :unknown}, :any, :any], {3, {:c, :atom, [:via], :unknown}}}]}], :unknown}, :none, :none, :none], :unknown}, {:c, :atom, :any, :unknown}, :any, :any, :any]}}, {{:group, :interfaces, 1}, {{:c, :list, [{:c, :tuple_set, [{2, [{:c, :tuple, [{:c, :atom, [:shell], :unknown}, :any], {2, {:c, :atom, [:shell], :unknown}}}, {:c, :tuple, [{:c, :atom, [:user_drv], :unknown}, :any], {2, {:c, :atom, [:user_drv], :unknown}}}]}], :unknown}, {:c, nil, [], :unknown}], :unknown}, [:any]}}, {{Registry, :unregister_match, 4}, {{:c, :atom, [:ok], :unknown}, [{:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, :none, :none, :none, :none, :none, {:c, :opaque, [{:opaque, :ets, :tid, [], {:c, :identifier, [:reference], :unknown}}], :unknown}, :none], :unknown}, :any, :any, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}]}}, {{:cerl, :call_module, 1}, {:any, [{:c, :tuple, [{:c, :atom, [:c_call], :unknown}, :any, :any, :any, :any], {5, {:c, :atom, [:c_call], :unknown}}}]}}, {{:elixir_lexical, :module_info, 1}, {:any, [:any]}}, {{:hipe_x86_specific_x87, :breadthorder, 2}, {{:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}, [{:c, :tuple, [{:c, :atom, [:cfg], :unknown}, {:c, :opaque, [{:opaque, :gb_trees, :tree, [:any, :any], {:c, :tuple, [{:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, :union, [{:c, :atom, ...}, :none, :none, ...], :unknown}], {2, :any}}}], :unknown}, {:c, :tuple, [{:c, :atom, [:cfg_info], :unknown}, {:c, :tuple, [{:c, :atom, :any, :unknown}, {:c, :atom, :any, :unknown}, {:c, :number, {:int_rng, 0, 255}, :integer}], {3, :any}}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, :atom, [false, true], :unknown}, {:c, :union, [{:c, :atom, [:none], :unknown}, :none, :none, :none, :none, {:c, :number, ...}, :none, :none, ...], :unknown}, {:c, :atom, [false, true], :unknown}, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}, {:c, :list, [:any, {:c, nil, [], ...}], :unknown}], {8, {:c, :atom, [:cfg_info], :unknown}}}, {:c, :tuple, [{:c, :opaque, [{:opaque, :dict, :dict, [:any, :any], {:c, :tuple, [{:c, ...}, {...}, ...], {9, ...}}}], :unknown}, {:c, :list, [{:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, nil, [], :unknown}], :unknown}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}], {3, :any}}], {4, {:c, :atom, [:cfg], :unknown}}}, :any]}}, {{RuntimeError, :__struct__, 1}, {:any, [:any]}}, {{:hipe_ppc, :pseudo_fmove_src, 1}, {:any, [{:c, :tuple, [{:c, :atom, [:pseudo_fmove], :unknown}, :any, :any], {3, {:c, :atom, [:pseudo_fmove], :unknown}}}]}}, {{:proplists, :lookup, 2}, {{:c, :union, [{:c, :atom, [:none], :unknown}, :none, :none, :none, :none, :none, {:c, :tuple, :any, {:any, :any}}, :none, :none, :none], :unknown}, [:any, {:c, :list, [:any, :any], :unknown}]}}, {{Supervisor, :delete_child, 2}, {:any, [{:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, {:c, :identifier, [:pid], :unknown}, :none, :none, {:c, :tuple_set, [{2, [{:c, :tuple, [{...}, ...], {...}}]}, {3, [{:c, :tuple, [...], ...}]}], :unknown}, :none, :none, :none], :unknown}, :any]}}, {{:dets_utils, :find_allocated, 4}, {:any, [{:c, :tuple, :any, {:any, :any}}, {:c, :number, :any, :unknown}, {:c, :number, :any, :unknown}, :any]}}, {{:binary, :matches, 2}, {:any, [:any, :any]}}, {{BadBooleanError, :__info__, 1}, {:any, [{:c, :atom, [:attributes, :compile, :deprecated, :functions, :macros, :md5, :module], :unknown}]}}, {{:cerl, :string_val, 1}, {:any, [{:c, :tuple, [{:c, :atom, [:c_literal], :unknown}, :any, :any], {3, {:c, :atom, [:c_literal], :unknown}}}]}}, {{System, :endianness, 0}, {{:c, :atom, [:big, :little], :unknown}, []}}, {{Kernel, :"MACRO-defmacro", 3}, {{:c, :tuple, [{:c, :tuple, [{:c, :atom, [:.], :unknown}, {:c, nil, [], :unknown}, {:c, :list, [{:c, :atom, [...], ...}, {:c, nil, ...}], :nonempty}], {3, {:c, :atom, [:.], :unknown}}}, {:c, nil, [], :unknown}, {:c, :list, [:any, {:c, nil, [], :unknown}], :nonempty}], {3, :any}}, [{:c, :union, [:none, :none, :none, :none, :none, :none, {:c, :tuple, [:any, {...}], {2, ...}}, :none, :none, {:c, :map, ...}], :unknown}, :any, :any]}}, {{:hipe_amd64_specific, :is_spill_move, 2}, {{:c, :atom, [false, true], :unknown}, [:any, :any]}}, {{:hipe_llvm, :adj_stack_register, 1}, {:any, [{:c, :tuple, [{:c, :atom, [:llvm_adj_stack], :unknown}, :any, :any, :any], {4, {:c, :atom, [:llvm_adj_stack], :unknown}}}]}}, {{:hipe_sparc_ra_ls, :module_info, 0}, {:any, []}}, {{:proc_lib, :hibernate, 3}, {:any, [{:c, :atom, :any, :unknown}, {:c, :atom, :any, :unknown}, {:c, :list, [:any, :any], :unknown}]}}, {{:gen, :reply, 2}, {{:c, :tuple, [:any, :any], {2, :any}}, [{:c, :tuple, [:any, :any], {2, :any}}, :any]}}, {{Task, :start, 3}, {{:c, :tuple, [{:c, :atom, [:ok], :unknown}, {:c, :identifier, [:pid], :unknown}], {2, {:c, :atom, [:ok], :unknown}}}, [:any, :any, :any]}}, {{:hipe_ppc_cfg, :branch_preds, 1}, {{:c, :list, [{:c, :tuple, [:any, {:c, ...}], {2, :any}}, {:c, nil, [], :unknown}], :unknown}, [{:c, :tuple_set, [{1, [{:c, ...}]}, {2, [{...}, ...]}, {3, [...]}, {5, ...}], :unknown}]}}, {{Access, :__info__, 1}, {:any, [{:c, :atom, [:attributes, :compile, :deprecated, :functions, ...], :unknown}]}}, {{Stream, :dedup_by, 2}, {{:c, :map, {[{{:c, :atom, ...}, :mandatory, {...}}, {{:c, ...}, :mandatory, ...}, {{...}, ...}, {...}], :any, :any}, :unknown}, [:any, :any]}}, {{:hipe_llvm, :mk_indirectbr, 3}, {{:c, :tuple, [{:c, :atom, [...], ...}, :any, :any, :any], {4, {:c, ...}}}, [:any, :any, :any]}}, {{:cerl, :atom_lit, 1}, {{:c, :list, [{:c, :union, ...}, {:c, ...}], :nonempty}, [{:c, :tuple, [{...}, ...], {...}}]}}, {{:disk_log_1, :chunk, 5}, {{:c, :tuple, [:any, :any], {2, ...}}, [:any, :any, :any, :any, ...]}}, {{:erts_debug, :map_info, 1}, {:any, [:any]}}, {{Version.InvalidVersionError, :__struct__, 0}, {{:c, :map, {...}, ...}, []}}, {{:application, :get_application, 0}, {{:c, :union, ...}, []}}, {{String.Chars.Version, :__impl__, 1}, {{:c, ...}, [...]}}, {{Inspect.Port, :module_info, ...}, {:any, ...}}, {{:hipe_icode, ...}, {...}}, {{...}, ...}, {...}, ...], 2760})
    (stdlib) ets.erl:736: :ets.tab2list/1
    (language_server) lib/language_server/dialyzer/manifest.ex:43: anonymous fn/6 in ElixirLS.LanguageServer.Dialyzer.Manifest.write/6
    (elixir) lib/task/supervised.ex:89: Task.Supervised.do_apply/2
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Function: #Function<7.78335674/0 in ElixirLS.LanguageServer.Dialyzer.Manifest.write/6>
    Args: []

Works fine on newer elixir and otp combinations

Exception from Logger when running on a 1.10 project

07:00:03.587 [error] GenServer ElixirLS.LanguageServer.Server terminating
** (UndefinedFunctionError) function Logger.__should_log__/1 is undefined or private
    (logger 1.10.0) Logger.__should_log__(:warn)
    (language_server 0.2.28) lib/language_server/server.ex:164: ElixirLS.LanguageServer.Server.handle_info/2
    (stdlib 3.10) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib 3.10) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib 3.10) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

Note: this doesn't affect the vscode extension because the vscode extension doesn't hit this code path because it usually supplies a workspace/didChangeConfiguration message.

Compiler diagnostics for .exs files

Environment

  • Elixir & Erlang versions (elixir --version): 1.9.4, 22
  • Operating system: macOS 10.14.6
  • Client (editor or IDE): VS Code

Not sure if this is by design, but I'm not getting any hints when things are broken in .exs files. e.g.: If I have a typo calling a function in a test, this doesn't get reported in VS Code, I'll only notice when running the tests.

Error with import MyApp.{ModA, ModB}

Environment

  • Elixir & Erlang versions (elixir --version): Elixir 1.8.0 (compiled with Erlang/OTP 20)
  • Operating system: Linux
  • Client (editor or IDE): Emacs

When visiting a file that is using a module that has a line like import MyApp.{ModA, ModB} in it's __using__ macro, the following error is raised:

LSP :: an exception was raised:
    ** (FunctionClauseError) no function clause matching in Code.ensure_loaded/1
        (elixir) lib/code.ex:985: Code.ensure_loaded({{:., [], [ElixirLsTest, :{}]}, [], [ModA, ModB]})
        (elixir_sense) lib/alchemist/helpers/module_info.ex:64: Alchemist.Helpers.ModuleInfo.get_module_funs/1
        (elixir_sense) lib/alchemist/helpers/module_info.ex:52: Alchemist.Helpers.ModuleInfo.has_function?/2
        (elixir) lib/enum.ex:2948: Enum.find_list/3
        (elixir_sense) lib/elixir_sense/core/introspection.ex:628: ElixirSense.Core.Introspection.find_imported_function/2
        (elixir_sense) lib/elixir_sense/core/introspection.ex:602: ElixirSense.Core.Introspection.actual_mod_fun/4
        (elixir_sense) lib/elixir_sense/providers/docs.ex:12: ElixirSense.Providers.Docs.all/4
        (elixir_sense) lib/elixir_sense.ex:50: ElixirSense.docs/3

I've set up a test repo at https://github.com/manukall/elixir_ls_test. When opening the file lib/elixir_ls_test/using.ex I get the above error.

Compilation error in file lib/language_server/dialyzer/analyzer.ex

Environment

  • Elixir & Erlang versions (elixir --version): Elixir 1.8.2 @ Erlang/OTP 20
  • Operating system: Ubuntu 18.04.2

Problem Description

elixir-ls compilation (mix compile) on master and latest release fails with:

== Compilation error in file lib/language_server/dialyzer/analyzer.ex ==
** (RuntimeError) error parsing file /usr/lib/erlang/lib/dialyzer-3.2.3/src/dialyzer.hrl, got: {:error, :enoent}
    (elixir) lib/record/extractor.ex:84: Record.Extractor.read_file/2
    (elixir) lib/record/extractor.ex:50: Record.Extractor.extract_record/2
    lib/language_server/dialyzer/analyzer.ex:42: (module)
    (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6

Auto completion for struct fields

Environment

  • Elixir & Erlang versions (elixir --version): Elixir 1.9.4
  • Operating system: Mac os catalina
  • Client (editor or IDE): Visual Studio Code

This is not a bug report, I merely have a question regarding the autocomplete for structs.

According to this elixir-ls is supposed to be able to do autocompletion for the names of struct fields. But at least for me, this literally never happens.

I am curious to know if there is something that may need to be done on my end to get this to work and also if this feature only works under certain contexts or not.

Thanks.

Callback info about the 'Elixir.Mix.Task' behaviour is not available

Environment

  • Elixir & Erlang versions (elixir --version): latest
  • Operating system: macos
  • Client (editor or IDE): vscode

Sanity Check List

  1. Create a new Mix project with mix new empty, then open that project with VS Code and open an Elixir file. Is your issue reproducible on the empty project? YES
  2. Check the output log by opening View > Output and selecting "ElixirLS" in the dropdown. Please include any output that looks relevant. (If ElixirLS isn't in the dropdown, the server failed to launch.)
13:14:18.445 [error] Process #PID<0.15210.0> raised an exception
** (SyntaxError) nofile:11: syntax error before: 'Callback'
    (language_server) lib/language_server/providers/document_symbols.ex:41: ElixirLS.LanguageServer.Providers.DocumentSymbols.list_symbols/1
    (language_server) lib/language_server/providers/document_symbols.ex:35: ElixirLS.LanguageServer.Providers.DocumentSymbols.symbols/2
    (language_server) lib/language_server/server.ex:442: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2
  1. Check the developer console by opening Help > Toggle Developer Tools and include any errors that look relevant.
    Nothing relevant.

Comments

Based on the documentation for dialyzer, I believe that starting dialyzer with the option: --apps mix would resolve this matter. When I go to settings however, I am only able to provide warn options.

If my assessment is correct, could someone kindly share with me how I could customize the starting options for dialyzer manually for the time being?

Issue on hover while writing an ExUnit test

Got an exception while writing an exunit test:

10:25:32.006 [error] Process #PID<0.13311.4> raised an exception
** (MatchError) no match of right hand side value: nil
    (elixir_sense) lib/elixir_sense/core/parser.ex:67: ElixirSense.Core.Parser.fix_parse_error/3
    (elixir_sense) lib/elixir_sense/core/parser.ex:53: ElixirSense.Core.Parser.string_to_ast/3
    (elixir_sense) lib/elixir_sense/core/parser.ex:18: ElixirSense.Core.Parser.parse_string/4
    (elixir_sense) lib/elixir_sense.ex:43: ElixirSense.docs/3
    (language_server) lib/language_server/providers/hover.ex:7: ElixirLS.LanguageServer.Providers.Hover.hover/3
    (language_server) lib/language_server/server.ex:419: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2
test "get_community_groups/1 returns only the groups viewable to the user", do
  #                                                                       ^ cursor

This partially makes sense because the code is in an uncompilable state. The exception actually appears to be within elixir_sense.

"completion--some: Wrong type argument: stringp, nil" when trying to select autocompletion at point

Environment

  • Elixir & Erlang versions (elixir --version):
Erlang/OTP 22 [erts-10.5.5] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]
Elixir 1.9.4 (compiled with Erlang/OTP 21)
  • Operating system:
Ubuntu 18.04.3 LTS
  • Client (editor or IDE):

spacemacs on GNU Emacs 26.3

How to reproduce

  1. have auto-completion and elixir-ls in latest version
  2. try typing:

Enum.t (press tab)

  1. the completion-at-point appears, select whatever suggested entry and press enter
  2. nothing happens, the messages buffer contains completion--some: Wrong type argument: stringp, nil log entry after enter was pressed

Desired outcome: Enum.t is replaced by the suggested completion line item.

This issue might be specific to my configuration and setup or might event be not specific to elixir-ls but I would appreciate any help on this issue.

vim-lsc crashes ElixirLS on method `shutdown`

Description

When exiting Neovim using vim-lsc, message "[lsc:Error] ElixirLS has crashed. See Output panel." is shown. Upon investigation, ElixirLS is throwing an exception (below).

Related from root:
JakeBecker/elixir-ls#207

Steps to Reproduce

  1. Open an Elixir file in a (Neo)vim instance using vim-lsc.
  2. Ensure the ElixirLS is running.
  3. Close the file.

Expected Behavior

The language server should exit cleanly.

Actual Behavior

ElixirLS crashes with the following:

21:16:59.997 [error] GenServer ElixirLS.LanguageServer.Server terminating
** (FunctionClauseError) no function clause matching in ElixirLS.LanguageServer.Server.handle_notification/2
    (language_server) lib/language_server/server.ex:216: ElixirLS.LanguageServer.Server.handle_notification(%{"id" => 2, "jsonrpc" => "2.0", "method" => "shutdown"}, %ElixirLS.LanguageServer.Server{analysis_ready?: false, awaiting_contracts: [], build_diagnostics: [], build_ref: nil, build_running?: false, client_capabilities: %{"textDocument" => %{"codeAction" => %{"codeActionLiteralSupport" => %{"codeActionKind" => %{"valueSet" => ["quickfix", "refactor", "source"]}}}, "completion" => %{"completionItem" => %{"snippetSupport" => false}}, "definition" => %{"dynamicRegistration" => false}, "signatureHelp" => %{"dynamicRegistration" => false}, "synchronization" => %{"didSave" => false, "willSave" => false, "willSaveWaitUntil" => false}}, "workspace" => %{"applyEdit" => true}}, dialyzer_diagnostics: [], dialyzer_sup: nil, needs_build?: false, project_dir: nil, received_shutdown?: false, requests: %{}, root_uri: "file:///Users/[redacted]/[project]" settings: nil, source_files: %{}})
    (language_server) lib/language_server/server.ex:144: ElixirLS.LanguageServer.Server.handle_cast/2
    (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {:"$gen_cast", {:receive_packet, %{"id" => 2, "jsonrpc" => "2.0", "method" => "shutdown"}}}
State: %ElixirLS.LanguageServer.Server{analysis_ready?: false, awaiting_contracts: [], build_diagnostics: [], build_ref: nil, build_running?: false, client_capabilities: %{"textDocument" => %{"codeAction" => %{"codeActionLiteralSupport" => %{"codeActionKind" => %{"valueSet" => ["quickfix", "refactor", "source"]}}}, "completion" => %{"completionItem" => %{"snippetSupport" => false}}, "definition" => %{"dynamicRegistration" => false}, "signatureHelp" => %{"dynamicRegistration" => false}, "synchronization" => %{"didSave" => false, "willSave" => false, "willSaveWaitUntil" => false}}, "workspace" => %{"applyEdit" => true}}, dialyzer_diagnostics: [], dialyzer_sup: nil, needs_build?: false, project_dir: nil, received_shutdown?: false, requests: %{}, root_uri: "file:///Users/[redacted]/[project]", settings: nil, source_files: %{}}

Environment

Elixir & Erlang versions (elixir --version):

Erlang/OTP 22 [erts-10.5.6] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.9.4 (compiled with Erlang/OTP 22)

Operating system:

MacOS Catalina - 10.15.3 (19D76)

Client (editor or IDE):

vim-lsc 0.4.0
NVIM v0.4.3
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20191107-85913-1wbgqz6/neovim-0.4.3/build/config -I/tmp/neovim-20191107-85913-1wbgqz6/neovim-0.4.3/src -I/usr/local/include -I/tmp/neovim-20191107-85913-1wbgqz6/neovim-0.4.3/deps-build/include -I/usr/local/opt/gettext/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/tmp/neovim-20191107-85913-1wbgqz6/neovim-0.4.3/build/src/nvim/auto -I/tmp/neovim-20191107-85913-1wbgqz6/neovim-0.4.3/build/include
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.4.3/share/nvim"

Run :checkhealth for more info

Unable to launch test task from VS Code

Environment

  • Elixir & Erlang versions (elixir --version): Erlang/OTP 22 [erts-10.6.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace]
    Elixir 1.10.0 (compiled with Erlang/OTP 22)
  • Operating system: macOS Mojave 10.14.6
  • Editor or IDE name: VSCode (latest)
  • LSP Client name:
  • If using VSCode, are you using "ElixirLS Fork: Elixir support and debugger" (note that it has "Fork" in the name)? yes, the latest available on VSCode marketplace

Crash report template

I'm starting from a brand new Mix project (generated with mix new_project)
I let VSCode create a launch.json file in order to run the tests.
With the generated Configuration I'm able to run the main task, the issue only applies to the mix test task.

The test mix task descriptor looks fine:
{
"type": "mix_task",
"name": "mix test",
"request": "launch",
"task": "test",
"taskArgs": [
"--trace"
],
"startApps": true,
"projectDir": "${workspaceRoot}",
"requireFiles": [
"test//test_helper.exs",
"test/
/*_test.exs"
]
}

By then I try to launch the tests, by choosing "mix test" in the debugger and pressing the run button I get the following error:

Started ElixirLS debugger
Elixir version: "1.10.0 (compiled with Erlang/OTP 22)"
Erlang version: "22"
(Debugger) Initialization failed because an exception was raised:
** (Mix.NoProjectError) Could not find a Mix.Project, please ensure you are running Mix in a directory with a mix.exs file
(mix 1.10.0) lib/mix/project.ex:176: Mix.Project.get!/0
(mix 1.10.0) lib/mix/tasks/compile.ex:89: Mix.Tasks.Compile.run/1
(mix 1.10.0) lib/mix/task.ex:330: Mix.Task.run_task/3
(debugger 0.3.0) lib/debugger/server.ex:456: ElixirLS.Debugger.Server.initialize/1

of course the mix.exs is in the right place ...

Show Dialyzer Report?

Environment

  • Elixir & Erlang versions (elixir --version): Elixir 1.9.4 (compiled with Erlang/OTP 22)
  • Operating system: MacOs
  • Client (editor or IDE): Emacs (spacemacs)

hey folks,
probably I am the idiot here, but is there any way to pretty-print the findings of the dialyzer analysis in emacs or just via console?

I thought that the dialyzer manifest could be used for that, but currently I only see a blob there.

Flycheck (an emacs tool) only displays errors within file in the current buffer, but I would like to see the results for my whole project.
I am not afraid to do some scripting on my own, but currently I am rather benighted how to even read that file.
I would really appreciate if you gave me some pointers here. :)

With kind regards
Peter

Credo integration

Environment

  • Elixir & Erlang versions (elixir --version): 1.8.1
  • Operating system: MacOS
  • Client (editor or IDE): Emacs

The codebase that I'm working on enforces strict credo check on the source code, so it would be nice to have credo working with flycheck, just as is the case by default under alchemist.

Somebody mentioned in ElixirForum that they also tried to do it with the following config:

  (add-hook 'elixir-mode-hook
    (lambda ()
      (flycheck-credo-setup)))

  (add-hook 'lsp-after-initialize-hook
            (lambda ()
              (flycheck-add-next-checker 'lsp-ui
                                         'elixir-credo)))

But it doesn't really work, as credo messages will only be updated in the flycheck buffer, whenever lsp-ui error messages are also updated.

Is there a way to make credo work with lsp? Or is it currently not possible due to some limitations?

Clarificaiton regarding completion response spec

Currently, completion for module attributes returns insertText with @ prefix removed.

ie. if the module have @default_value attribute. @defa<cursor> returns defult_value as insertText.

From the spec CompletionItem.insertText should be complete text including @?

Compilation errors are not showing up

It looks like on the current master branch, compilation errors are not being appropriately reported. This blocks the next release of the extension.

The VSCode extension crashes

I uninstalled the "official" ElixirLS and installed this fork from the marketplace. After restarting the code, I got a crash, and the extension is not working. The old ElixirLS worked just fine.

Environment

  • Elixir & Erlang versions (elixir --version): 1.9.1 && OTP 21
  • Operating system: Ubuntu 19.04
  • Client (editor or IDE): VSCode

Crash report template

  1. Create a new Mix project with mix new empty, then open that project with VS Code and open an Elixir file. Is your issue reproducible on the empty project? If not, please publish a repo on Github that does reproduce it.

The issue is not reproducible on an empty project. Unfortunately, I can't publish the repo in question.

  1. Check the output log by opening View > Output and selecting "ElixirLS" in the dropdown. Please include any output that looks relevant. (If ElixirLS isn't in the dropdown, the server failed to launch.)
** (UndefinedFunctionError) function ElixirLS.Utils.WireProtocol.intercept_output/2 is undefined (module ElixirLS.Utils.WireProtocol is not available)
    ElixirLS.Utils.WireProtocol.intercept_output(&ElixirLS.LanguageServer.JsonRpc.print/1, &ElixirLS.LanguageServer.JsonRpc.print_err/1)
    lib/language_server/cli.ex:6: ElixirLS.LanguageServer.CLI.main/0
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
    (elixir) lib/code.ex:240: Code.eval_string/3
[Error - 8:03:46 PM] Connection to server got closed. Server will not be restarted.

Feature: add support to peek definition of defdelegated code

Environment

Erlang/OTP 21 [erts-10.3] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
Elixir 1.10.1 (compiled with Erlang/OTP 21)
Visual Studio Code 1.42.1
Windows 10
ElixirLS Fork: Elixir support and debugger 0.3.0

Current behavior

Currently peek definition (Alt+F12) will peek into defdelegate not to code it points to. It's very annoying that if you want use defdelegate you'll lose ability to peek actual code.

Feature behavior

Peek definition (Alt+F12) would show code defdelegate points to instead.
This could be under settings to be enabled if not wanted to made enabled by default.

Bug: function nil.text/0 is undefined exception

Got this exception today, not sure how to reproduce yet. Also not sure about the input that caused this.

09:45:52.252 [error] Process #PID<0.5762.0> raised an exception
** (UndefinedFunctionError) function nil.text/0 is undefined
    nil.text()
    (language_server) lib/language_server/server.ex:345: anonymous fn/4 in ElixirLS.LanguageServer.Server.handle_request/2
    (language_server) lib/language_server/server.ex:419: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2

ElixirLS Dialyzer Warnings Support for Umbrellas?

Environment

  • Elixir & Erlang versions (elixir --version): Elixir 1.9.1 (compiled with Erlang/OTP 22)
  • Operating system: MacOS 10.14.6
  • Client (editor or IDE): VSCode 1.38.1 and ST3 v3208 (LSP plugin) as it's an LS issue not a plugin issue

Issue

I can't get Dialyzer warnings to emit in a fresh Phoenix 1.4.9 umbrella project. Here are the steps I took (after setting "tracing" to verbose):

  1. mix phx.new blah
  2. code -n blah

I made this trivial edit to lib/blah_web/controllers/page_controller.ex:

  def index(conn, _params) do
    _a = blah(42)
    render(conn, "index.html")
  end

  def blah(nil), do: false

After a few seconds it works great telling me:

The function call will not succeed.

BlahWeb.PageController.blah(42)

will never return since it differs in arguments with
positions 1st from the success typing arguments:

(nil)
ElixirLS Dialyzer

I can see that warning in the tracing log showing the LS emitted that warning which was rendered properly by VSCode.

Now if I create an umbrella project with mix phx.new blah --umbrella and make the same exact change to page_controller.ex this warning does not show up. Tracing log shows the LS does not send the warning to the frontend even though Dialyzer is started and the dialyzer_manifest_22.0.7_elixir-1.9.1_test file is created properly in /.elixir-ls. There are no error messages or other anomalies in the tracing log.

Compiler warnings always work it's the Dialyzer warnings that are not emitting on umbrella projects. I tested with Jake's LS also and the same thing is happening. Thanks for any help!

[Feature request] VSCode: Display errors above documentation

Environment
  • Elixir & Erlang versions (elixir --version):

    Erlang/OTP 22 [erts-10.6.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]
    
    Elixir 1.10.1 (compiled with Erlang/OTP 21)
    
  • Operating system: Ubuntu 18.04

  • Editor or IDE name (e.g. Emacs/VSCode): VSCode

  • LSP Client name: I'm not sure, is VSCode an "LSP" client?

  • If using VSCode, are you using "ElixirLS Fork: Elixir support and debugger" (note that it has "Fork" in the name)? Yup

Feature request

When VSCode underlines a problem in my code (error or warning), I can hover it to see the error message. If the hovered module is documented, its documentation is shown first and I have to scroll all the way down to see the message (notice the scroll bar):

Screenshot from 2020-02-18 21-44-04

It would be nice to show the errors first.

Edit: I almost forgot: thanks for maintaining this fork. ❤️

Mix process crashing in tests

Environment

  • Elixir & Erlang versions (elixir --version): 1.9.x, 1.10-rc.0
  • Operating system: macos, linux

Crash report template

Running tests result in one of mix application processes crashing. It looks like the tests put mix in some illegal state.

elixir 1.10-rc.0

12:36:34.397 [error] GenServer Mix.ProjectStack terminating
** (FunctionClauseError) no function clause matching in anonymous fn/1 in Mix.ProjectStack.recur/1
    (mix 1.10.0-rc.0) lib/mix/project_stack.ex:183: anonymous fn([]) in Mix.ProjectStack.recur/1
    (mix 1.10.0-rc.0) lib/mix/project_stack.ex:268: Mix.ProjectStack.handle_call/3
    (stdlib 3.11) gen_server.erl:661: :gen_server.try_handle_call/4
    (stdlib 3.11) gen_server.erl:690: :gen_server.handle_msg/6
    (stdlib 3.11) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.92.0>): {:update_stack, #Function<21.19485960/1 in Mix.ProjectStack.recur/1>}
State: {[], []}
Client #PID<0.92.0> is alive

    (stdlib 3.11) gen.erl:167: :gen.do_call/4
    (elixir 1.10.0-rc.0) lib/gen_server.ex:1020: GenServer.call/3
    (mix 1.10.0-rc.0) lib/mix/project_stack.ex:180: Mix.ProjectStack.recur/1
    (mix 1.10.0-rc.0) lib/mix/cli.ex:82: Mix.CLI.run_task/2
    (elixir 1.10.0-rc.0) src/elixir_compiler.erl:75: :elixir_compiler.dispatch/4
    (elixir 1.10.0-rc.0) src/elixir_compiler.erl:60: :elixir_compiler.compile/3
    (elixir 1.10.0-rc.0) src/elixir_lexical.erl:14: :elixir_lexical.run/3
    (elixir 1.10.0-rc.0) src/elixir_compiler.erl:18: :elixir_compiler.quoted/3
    (elixir 1.10.0-rc.0) lib/code.ex:917: Code.require_file/2
    (elixir 1.10.0-rc.0) lib/kernel/cli.ex:549: Kernel.CLI.wrapper/1
    (elixir 1.10.0-rc.0) lib/enum.ex:1396: Enum."-map/2-lists^map/1-0-"/2
    (elixir 1.10.0-rc.0) lib/kernel/cli.ex:76: Kernel.CLI.process_commands/1
    (elixir 1.10.0-rc.0) lib/kernel/cli.ex:30: anonymous fn/2 in Kernel.CLI.main/1
    (elixir 1.10.0-rc.0) lib/kernel/cli.ex:124: anonymous fn/3 in Kernel.CLI.exec_fun/2

elixir 1.9.1

00:20:15.427 [error] GenServer Mix.ProjectStack terminating
** (FunctionClauseError) no function clause matching in anonymous fn/1 in Mix.ProjectStack.recur/1
    (mix) lib/mix/project_stack.ex:210: anonymous fn(%{cache: %{}, post_config: [], stack: []}) in Mix.ProjectStack.recur/1
    (elixir) lib/agent/server.ex:27: Agent.Server.handle_cast/2
    (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {:"$gen_cast", {:cast, #Function<23.36738168/1 in Mix.ProjectStack.recur/1>}}
State: %{cache: %{}, post_config: [], stack: []}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.