Welcome to Vifm Q&A, where you can ask questions about using Vifm. Registration is optional, anonymous posts are moderated. E-mail and GitHub logins are enabled.
0 votes
in vifm by

When using standalone Vim, the Erlang Language Server works as expected, using the following CocConfig:

{
  "languageserver": {
    "erlang": {
      "command": "erlang_ls",
      "filetypes": ["erlang"]
    }
  }
}

But when I try to open and edit Erlang source files from within Vifm, I get the following error:

erlang client: couldn't create connection to server.
Launching server using command erlang_ls failed. Error: spawn erlang_ls ENOENT

What command should I use in order to spawn the Erlang Lsp from within Vifm?

Thank you in advance.

2 Answers

0 votes
by
 
Best answer

Hard to say as I'm not familiar with these tools, but my guess would be that you might have some extra setup in your shell's configuration file (either the way Vim is run or some environment variables used by erlang_ls. This could make a difference if you are starting vim from the shell, but vifm from a shortcut.

You can dump environment variables from inside Vim like this:

:redir > ~/envs.json
:echo json_encode(environ())
:redir END

If you do that with and without Vifm, the difference might point at the cause of the issue.

by

Exactly, your intuition is correct! It wasn't Vifm's fault.
The problem was how I started Vifm in xfce4. The terminal emulator of xfce4 was not running as a login shell, so that the erlang_ls executable was not in my PATH.

Thank you very much for your quick response and for all the work on this great file manager!

0 votes
by

Please ignore my question. It's not Vifm's fault.
Erlang LS works as expected even from within Vifm. The problem was how I started Vifm in xfce4. The terminal emulator of xfce4 was not running as a login shell, so that the erlang_ls executable was not in my PATH.

Keep up the great work you are doing with Vifm.

...