elixir-lsp / coc-elixir

Elixir language server extension based on elixir-ls for coc.nvim
MIT License
168 stars 11 forks source link

it may fail when using asdf and other versioning tools #47

Open jalberto opened 3 years ago

jalberto commented 3 years ago

I work in different elixir projects that use different erlang and elixir versions, to manage this I use asdf so each project has a local file to define the correct versions and the system versions also come into play.

Is there a way to make elixir-lsp aware of this? so it rebuilds a new version when necessary with the correct combination.

wulymammoth commented 3 years ago

I use asdf as well...

I think the way to manage this is using "workspace" configuration: https://github.com/neoclide/coc.nvim/wiki/Using-the-configuration-file#configuration-file-resolve

What I'm gleaning is that you want to specify a different coc-settings.json depending on project

According to the README, you can specify where the pre-compiled language server binary is:

{
  "elixir.pathToElixirLS": "~/.elixir-ls/release/language_server.sh"
}

I'd consider just just dumping it in my home directory under: ~/.elixir-ls/release/<version number>/language_server.sh

Instructions on how to build a language server for each version of Elixir that you're on can be found in the LS repo's README: https://github.com/elixir-lsp/elixir-ls

dylan-chong commented 3 years ago

So what fixed it for me was i already had set up this for a previous version of elixir https://github.com/elixir-lsp/coc-elixir#troubleshooting

I had to make sure the global version of elixir and erlang matched the version in the project, delete ~/.elixir-ls then run the commands in the readme link above to recompile the project