Ale: `elixir-ls` language server does not start

Created on 30 Jan 2019  路  16Comments  路  Source: dense-analysis/ale

Information

VIM version
NVIM v0.3.1

OS
Arch Linux

What went wrong

elixir-ls doesn't start when editing an elixir file, and manually running :ALELint does nothing. My g:ale_elixir_elixir_ls_release variable is set correctly. This may have to do with me using asdf to manage elixir versions, although manually running the language server executable from vim with !~/.language-servers/elixir-ls-release/language_server.sh does work.

:ALEInfo

 Current Filetype: elixir
Available Linters: ['credo', 'dialyxir', 'dogma', 'elixir-ls', 'mix']
  Enabled Linters: ['elixir-ls']
 Suggested Fixers: 
  'mix_format' - Apply mix format to a file.
  'remove_trailing_lines' - Remove all blank lines at the end of a file.
  'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
 Linter Variables:

 Global Variables:

let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = v:null
let g:ale_completion_delay = 100
let g:ale_completion_enabled = 1
let g:ale_completion_max_suggestions = 50
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 1
let g:ale_fixers = {'reason': ['refmt'], 'elixir': ['mix_format'], 'vue': ['prettier', 'eslint'], 'html': ['prettier'], 'javascript': ['prettier', 'eslint'], 'ocaml': ['ocamlformat'], 'python': ['yapf']}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 0
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'always'
let g:ale_linter_aliases = {}
let g:ale_linters = {'reason': ['merlin'], 'elixir': ['elixir-ls'], 'javascript': ['eslint'], 'ocaml': ['merlin']}
let g:ale_linters_explicit = 0
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_lsp_root = {}
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_info = '--'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '>>'
let g:ale_sign_style_warning = '--'
let g:ale_sign_warning = '--'
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
  Command History:
**[[THIS IS EMPTY]]**



Most helpful comment

I got this to work with the following...and it is awesome.

  1. What @mhanberg said is spot on
  2. asdf install elixir ref:v1.81 # I think the important part having the source for ale and elixir_ls to look up.
  3. asdf global elixir ref:v1.8.1
  4. let g:ale_elixir_elixir_ls_release = $HOME.'/lsps/elixir-ls/rel'. # obviously you're path would be diff.

For listing make sure you have your fixers and linters set properly.

Plug 'w0rp/ale'
let g:ale_linters = {
\  'elixir': ['credo', 'dialyxir', 'elixir-ls'],
\  'ruby': ['rubocop', 'solargraph'],
\  'javascript': ['prettier', 'eslint', 'tsserver'],
\}

let g:ale_fixers = {
\  '*': ['remove_trailing_lines', 'trim_whitespace'],
\  'javascript': ['prettier'],
\  'html': ['prettier'],
\  'ruby': ['rubocop'],
\  'elixir': ['mix_format'],
\}

Hope that helps.

All 16 comments

yeah I am in this same boat. I have done all the configuration I can think of and when I do ALEInfo it never shows it trying to talk to the ls

actually might have found the issue for me. If I set the g:ale_elixir_elixir_ls_release to a path that contains home as ~ then it cant find it. When a do the path spelled out it works fine.

I don't know if this is the right way to handle this (new to vim) but having it this way in my vimrc worked

let g:ale_elixir_elixir_ls_release = $HOME . '/elixir-ls/rel'

I didn't want to hard code the home patch because on my machines its a little different. If I have something wrong here I would like the feedback. Or if this is something that is a known issue we should get it documented

After I replaced the ~ with a hard-coded path ALE does start the elixir-ls server, but I'm still not getting any errors.

and :ALEGoToDefinition isn't working?

It appears to be working part of the time...

I got mine working consistently, it takes a sec to start up but it works afterwards. If you want to bounce ideas off of each other to see if its something in your vimrc let me know.

My experience: the first time I run :ALEGoToDefinition, the CPU goes to 50% for 45 seconds or so, and nothing happens in the vim UI. After that, :ALEGoToDefinition works as expected, sub-second response time. (Note: I had to use an absolute path for the elixir-ls/rel directory...)

I did notice a slow start up. Tomorrow I will run again with diagnostics and see if I get the same cpu spike.

So :ALEGoToDefinition may be working, but there's still no linting indicators for me. Is that happening with you too?

Seeing the same thing here. Anyone closer to figuring this out?

Make sure that the elixir-ls was built with the same elixir and erlang versions that your project is using.

I got this to work with the following...and it is awesome.

  1. What @mhanberg said is spot on
  2. asdf install elixir ref:v1.81 # I think the important part having the source for ale and elixir_ls to look up.
  3. asdf global elixir ref:v1.8.1
  4. let g:ale_elixir_elixir_ls_release = $HOME.'/lsps/elixir-ls/rel'. # obviously you're path would be diff.

For listing make sure you have your fixers and linters set properly.

Plug 'w0rp/ale'
let g:ale_linters = {
\  'elixir': ['credo', 'dialyxir', 'elixir-ls'],
\  'ruby': ['rubocop', 'solargraph'],
\  'javascript': ['prettier', 'eslint', 'tsserver'],
\}

let g:ale_fixers = {
\  '*': ['remove_trailing_lines', 'trim_whitespace'],
\  'javascript': ['prettier'],
\  'html': ['prettier'],
\  'ruby': ['rubocop'],
\  'elixir': ['mix_format'],
\}

Hope that helps.

You might also want to try setting b:ale_lsp_root to some project root path, if ALE can't discover the project root automatically.

@mhanberg's solution works for me. Can we close?

Yes, that makes sense. You can also use b:ale_elixir_elixir_ls_release in an ftplugin file so you can set different releases for different projects.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

plexigras picture plexigras  路  3Comments

alexlafroscia picture alexlafroscia  路  4Comments

EdmundsEcho picture EdmundsEcho  路  3Comments

trevordmiller picture trevordmiller  路  4Comments

ilyakopy picture ilyakopy  路  4Comments