syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.58k stars 4.9k forks source link

Support lexical as a language server provider for Elixir #16219

Closed x-ji closed 6 months ago

x-ji commented 6 months ago

Currently the Elixir layer only supports alchemist or elixir-ls. lexical is a new language server that has worked for me on some larger projects where elixir-ls fails (e.g. autocompletion list doesn't pop up). It would be great to have lexical support as well.

x-ji commented 6 months ago

For now I have been able to make it work by manually adding

  (use-package elixir-mode
    :ensure t
    :custom
    (lsp-elixir-server-command '("~/Projects/Elixir/lexical/_build/dev/package/lexical/bin/start_lexical.sh")))

in dotspacemacs/user-config.

smile13241324 commented 6 months ago

I have added some instructions for using lexical. Can you do a short test and close this ticket when its ok?

smile13241324 commented 6 months ago

Please reopen when its not working, thanks.

x-ji commented 6 months ago

Hi @smile13241324 thanks for the update. Though just setting

  (elixir :variables elixir-backend 'lsp
                     lsp-elixir-server-command "*path to folder*/lexical/bin/start_lexical.sh")

as described in the instructions doesn't seem to work for some reason. I get the error

Error running timer: (wrong-type-argument listp "~/Projects/Elixir/lexical/_build/dev/package/lexical/bin/start_lexical.sh")

I had to also add

  (use-package elixir-mode
    :ensure t
    :custom
    (lsp-elixir-server-command '("~/Projects/Elixir/lexical/_build/dev/package/lexical/bin/start_lexical.sh")))

under user-config as I described.

Did that work for you?

x-ji commented 6 months ago

(And seems that I don't have the permission to reopen it. I can only add comments.)

smile13241324 commented 6 months ago

Ups, that variable needs a list not a string....

Ok the correct line for your dotfile should be:

     (elixir :variables elixir-backend 'lsp
             lsp-elixir-server-command '("*path to folder*/lexical/bin/start_lexical.sh"))

Can you have another go @x-ji?

x-ji commented 6 months ago

@smile13241324 Thanks, this works!