Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please help, everything works except autocompletion #64

Open
hissssst opened this issue Dec 17, 2021 · 7 comments
Open

Please help, everything works except autocompletion #64

hissssst opened this issue Dec 17, 2021 · 7 comments

Comments

@hissssst
Copy link

I've checked and autocompletion works correctly with other languages. In elixir, I am able to have buffer completion, but not LS completion while other features like goto definition and documentation work correctly. There's nothing special in coc log too

@hissssst
Copy link
Author

Hmmm,
Setting elixirLS like described here works correctly with autocompletion
https://github.com/neoclide/coc.nvim/wiki/Language-servers#elixir

@lauriannala
Copy link

lauriannala commented Dec 31, 2021

Autocompletion is not working for me either, setting up elixir-ls on coc-config works.
CocCommand workspace.showOutput reports an error on autocompletion attempt:

[Error  - 1:50:57 PM] Request textDocument/completion failed.
  Message: an exception was raised:
    ** (CaseClauseError) no case clause matching: {:ok, 1, 11, [], [{:atom, {1, 5, nil}, :world}]}
        (elixir_sense 2.0.0) lib/elixir_sense/core/normalized/tokenizer.ex:16: ElixirSense.Core.Normalized.Tokenizer.do_tokenize_1_7/1
        (elixir_sense 2.0.0) lib/elixir_sense/core/parser.ex:230: ElixirSense.Core.Parser.fix_parse_error/3
        (elixir_sense 2.0.0) lib/elixir_sense/core/parser.ex:118: ElixirSense.Core.Parser.string_to_ast/5
        (elixir_sense 2.0.0) lib/elixir_sense/core/parser.ex:32: ElixirSense.Core.Parser.parse_string/4
        (language_server 0.7.0) lib/language_server/providers/completion.ex:100: ElixirLS.LanguageServer.Providers.Completion.completion/4
        (language_server 0.7.0) lib/language_server/server.ex:770: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2
  Code: -32000 
defmodule CocElixirIssue do
  def hello do
    Enum. # <-- Problem experienced here on autocomplete attempt.
    :world
  end
end

Version info:

Started ElixirLS v0.7.0
Elixir version: "1.13.0 (compiled with Erlang/OTP 24)"
Erlang version: "24"
ElixirLS compiled with Elixir 1.8.2 and erlang 21
MIX_ENV: test
MIX_TARGET: host

@cr0t
Copy link

cr0t commented Jan 9, 2022

From this comment elixir-lsp/elixir_sense#148 it seems that the ElixirLS version is outdated.

I (and I might assume as the other participants in this issue) have installed coc-elixir via :CocInstall coc-elixir command that is given in the README of https://github.com/elixir-lsp/coc-elixir.

It turns out that it downloads and installs an outdated (last release was 7 months ago) coc-elixir NPM package, instead of the new one.

@amiralies, is there any way to build and publish a new release to the npmjs?

If not, shall the vim-plug be a preferrable way of using this server? Or any other tips?

@cr0t
Copy link

cr0t commented Jan 9, 2022

This repo seems a little bit abandoned (on activity since May 2020, no tags after version 0.7.0, no releases of new version). @lukaszsamson do you know maintainer of this package, or if anything can be done do update the package? Sorry for disturbing you.

@cr0t
Copy link

cr0t commented Jan 9, 2022

@hissssst @lauriannala I have found a workaround.

  1. Download the latest releases of here https://github.com/elixir-lsp/elixir-ls/releases (download elixir-ls.zip file).
  2. Find where coc.nvim have installed your Elixir's Language Server – you can do it like this:
$ find ~ -name 'language_server.sh'
/Users/cr0t/.config/coc/extensions/node_modules/coc-elixir/els-release/language_server.sh
  1. In my case, I have replaced all the files in my /Users/cr0t/.config/coc/extensions/node_modules/coc-elixir/els-release/ directory with the files from the downloaded zip-archive – like that:
$ rm -rf /Users/cr0t/.config/coc/extensions/node_modules/coc-elixir/els-release/*
$ cd ~/Downloads
$ unzip elixir-ls.zip -d /Users/cr0t/.config/coc/extensions/node_modules/coc-elixir/els-release/

(keep in mind, that in your system -d option to unzip might not work or work differently; I ran these commands on macOS 12.1)

  1. Profit! (Now autocompletion works even in Elixir 1.13 projects!)

@amiralies
Copy link
Collaborator

I've switched to neovim's lsp recently and do not work much on elixir projects at work atm. so I couldn't give attention to this small project.

This extension doesn't do anything fancy it's a wrapper around elixir-ls. so with manual installation mentioned in the readme or using coc's manual configuration same experience should be available for the end user. but with extra steps. achieving out of the box experience is a bit tricky (we should publish with minimum version of elixir and otp supported by the language server to support more users and some small issues that i can't remember now).

With that being said if i find a way to automate build/publish via github actions that would be great (PR welcome).

@vinibrsl
Copy link

@hissssst @lauriannala I have found a workaround.

  1. Download the latest releases of here https://github.com/elixir-lsp/elixir-ls/releases (download elixir-ls.zip file).
  2. Find where coc.nvim have installed your Elixir's Language Server – you can do it like this:
$ find ~ -name 'language_server.sh'
/Users/cr0t/.config/coc/extensions/node_modules/coc-elixir/els-release/language_server.sh
  1. In my case, I have replaced all the files in my /Users/cr0t/.config/coc/extensions/node_modules/coc-elixir/els-release/ directory with the files from the downloaded zip-archive – like that:
$ rm -rf /Users/cr0t/.config/coc/extensions/node_modules/coc-elixir/els-release/*
$ cd ~/Downloads
$ unzip elixir-ls.zip -d /Users/cr0t/.config/coc/extensions/node_modules/coc-elixir/els-release/

(keep in mind, that in your system -d option to unzip might not work or work differently; I ran these commands on macOS 12.1)

  1. Profit! (Now autocompletion works even in Elixir 1.13 projects!)

Thank you! That worked flawlessly :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants