Skip to content
This repository has been archived by the owner on Oct 16, 2021. It is now read-only.

Add initial elixir-ls support #42

Merged
merged 3 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ end
| cpp | clangd |
| cmake | cmake-language-server |
| css | css-language-features (pulled directly from the latest VSCode release) |
| elixir | Elixir Language Server (elixir-ls) |
| dockerfile | docker-langserver |
| go | gopls |
| graphql | GraphQL language service |
Expand Down
1 change: 1 addition & 0 deletions lua/lspinstall/servers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ local servers = {
["diagnosticls"] = require'lspinstall/servers/diagnosticls',
["dockerfile"] = require'lspinstall/servers/dockerfile',
["efm"] = require'lspinstall/servers/efm',
["elixir"] = require'lspinstall/servers/elixir',
["go"] = require'lspinstall/servers/go',
["graphql"] = require'lspinstall/servers/graphql',
["html"] = require'lspinstall/servers/html',
Expand Down
11 changes: 11 additions & 0 deletions lua/lspinstall/servers/elixir.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
local config = require'lspconfig'.elixirls.document_config
require'lspconfig/configs'.elixirls = nil -- important, immediately unset the loaded config again

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just add config.default_config.cmd = { "./language_server.sh" }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was getting some strange errors with the :LspInstall command completion before when tried with that line, but now it seems to be working

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps you were missing the { } before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried the first time just indexing the cmd field and setting a string value, but it didn't existed, so I also tried to create it before doing that, (which is the same as the line you sent) and both don't cause errors but the lsp doesn't seem to start.
It has started before because I've forgot that I had hardcoded the path in my vimrc's elixirls setup for testing.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does :LspInfo say?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Configured servers: elixirls
Neovim logs at: /home/<user>/.cache/nvim/lsp.log

0 client(s) attached to this buffer: 

0 active client(s): 

Clients that match the filetype elixir:
  
  Config: elixirls
  	cmd:               cmd not defined
  	cmd is executable: cmd not defined
  	identified root:   /home/<user>
  	custom handlers:   

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll commit the current code

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be ./elixir-ls/language_server.sh. The ./ is important to be recognized as a local path.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, I forgot the ./, but even adding it the behaviour and :LspInfo output are still the same.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's very weird. I suspect something in your config is wrong because the code looks fine. Also I just tested it, and it works on my machine.

return vim.tbl_extend('error', config, {
install_script = [[
curl -fLO https://github.com/elixir-lsp/elixir-ls/releases/latest/download/elixir-ls.zip
unzip elixir-ls.zip
chmod +x language_server.sh
rm -f elixir-ls.zip
]],
})