Completions


Completions are an awesome way to explore and learn a new API, as well as increase your productivity by orders of magnitude.

Completions are a new feature in Next LS, and are currently gated behind an experimental flag in order to protect users from instability. You can toggle it on if you would like to use it, but if there are bugs, you can toggle it off and await a patch.

To enable completions, you must pass the initialization options to the server. You can find the exact settings for your specific editor on their homepage/README, but in general the shape is:

NOTE: When using completions, Next LS will use a bundled archive of Elixir instead of the one found in your PATH. This requires at OTP 25+.

{
  experimental = {
    completions = {
      enable = true
    }
  }
}

For configurations examples in your editor refer to: Editors

Demo

Demonstration of function completions with documentation in Next LS

Demonstration of struct field completions in Next LS

Caveats

Next LS supports auto-completions for the following features:

  • Modules
  • Global remote functions
  • Local functions - if they are above the cursor (will improve later)
  • Private functions - if they are above the cursor (will improve later)
  • Variables/parameters
  • Module attributes
  • Structs
  • Struct fields
  • Bitstring modifiers
  • Special forms
  • Kernel functions
  • Imported functions (eg, import Foo)
  • Aliased modules (eg, alias Foo.Bar or alias Foo.Bar, as: Baz)
  • Aliased remote functions
  • Snippets

New features coming soon!

Settings

experimental.completions.enable

Controls if the completions feature is activated.

Default: false