lite-xl / lite-xl-lsp

LSP Plugin for Lite XL editor
MIT License
160 stars 21 forks source link

[LSP] servers registered but not installed #15

Closed andresmeireles closed 3 years ago

andresmeireles commented 3 years ago

First of all I want to say that this library is amazing and that I really want to use it. Installed normally I follow the instructions to setup the lsp, but whenever I open a file I get this message, that mine did not install the server, even with the servers installed correctly and using those in other editors.

The message Screenshot from 2021-10-28 09-56-45

The installed server: Screenshot from 2021-10-28 09-58-51

my config (i'm not touch anything, all is the same, except the lsp config): Screenshot from 2021-10-28 10-02-33

i'm really a beginner on lite-xl and his plugins, and my english is poor, so sorry if this is my fault or bad config. I use asdf to manage program language verions.

jgmdev commented 3 years ago

I think the issue is that lite-xl isn't able to access the $PATH environment variable set by your zsh setup which contains the reference to /home/andresmeireles/.asdf/shims

Solutions

  1. Running lite-xl from the zsh shell should work by giving lite-xl access to the same PATH environment variable as the shell.

  2. (Easy solution), setting the absolute path to the lsp server on your init.lua:

    lspconfig.intelephense.setup {
    command = {
      "/home/andresmeireles/.asdf/shims/intelephense",
      "--stdio"
    },
    init_options = {
      storagePath = "/home/andresmeireles/.cache/intelephense"
    }
    }
  3. (Harder solution), you could export the asdf shims directory system wide by doing something like:

    # create script executed at startup
    sudo touch /etc/profile.d/global_asdf.sh
    # make the script executable
    sudo chmod 0755 /etc/profile.d/global_asdf.sh

    Then edit that file sudo nano /etc/profile.d/global_asdf.sh and add the following to it:

    export PATH="/home/andresmeireles/.asdf/shims:$PATH"

    Reboot your system and lite-xl should now be able to find the lsp servers installed on that path.

andresmeireles commented 3 years ago

Hi, i tried both easy and hard solution, none worked for me. For now i think the only solution is remove asdf. Many thanks for reply

jgmdev commented 3 years ago

Strange... giving the path directly to /home/andresmeireles/.asdf/shims/intelephense should have worked unless asdf is doing some strange stuff, also launching lite-xl directly from the zsh shell should have worked, not sure what could be causing the issue in your setup.

andresmeireles commented 3 years ago

I did what you said more carefully and lsp worked, in fact even not doing the suggestions you said and open lite-xl direct from zsh, lsp work. Do you know why it behaves like this?

jgmdev commented 3 years ago

As mentioned before it seems that asdf was configured to set proper paths on your zsh setup (the shell setup for your user), but those paths are not accessible to most linux applications which call directly to sh or bash.

You can try running sh --version or sh --help to see which shell is the default system one and set for it the PATH environment variable.

andresmeireles commented 3 years ago

thanks for the answer, i will check this later