dundalek / lazy-lsp.nvim

Neovim plugin to auto install LSP servers
MIT License
197 stars 13 forks source link

ts_ls fails to install #54

Closed arzt-arsch closed 1 hour ago

arzt-arsch commented 3 hours ago

My lazy-lsp looks like this:

      require('lazy-lsp').setup {
        preferred_servers = {
          python = { 'pyright', 'ruff_lsp' },
          c = { 'clangd' },
          javascript = { 'eslint', 'stylelint_lsp', 'ts_ls' },
          typescript = { 'eslint', 'stylelint_lsp', 'ts_ls' },
        },
        excluded_servers = {
          'efm',
          'diagnosticls',
        },
      }

But when I enter any typescript buffer I get this message: Client ts_ls quit with exit code 1 and signal 0.

:LspLog looks like this:

[ERROR][2024-09-24 22:40:19] .../vim/lsp/rpc.lua:774    "rpc"   "nix-shell" "stderr"    "error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:9:12:
            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|

       … while evaluating derivation 'shell'
         whose name attribute is located at /nix/store/h4hjc2hl8frbqp1s9hcs4rjgasc6n5zb-nixpkgs/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'buildInputs' of derivation 'shell'
         at /nix/store/h4hjc2hl8frbqp1s9hcs4rjgasc6n5zb-nixpkgs/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:378:7:
          377|       depsHostHost                = elemAt (elemAt dependencies 1) 0;
          378|       buildInputs                 = elemAt (elemAt dependencies 1) 1;
             |       ^
          379|       depsTargetTarget            = elemAt (elemAt dependencies 2) 0;

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: undefined variable 'typescript-language-server'
       at «string»:1:107:
            1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) \"shell\" { buildInputs = [ (typescript-language-server) (typescript) ]; } \"\"
             |                                                                                                           ^"

Any help is appreciated. Thanks!

dundalek commented 3 hours ago

It is possible you are on older nixpkgs. I recommend to use the unstable channel.

You can check if you are on unstable with nix-channel --list and if so then you can try to update to latest with nix-channel --update.

arzt-arsch commented 1 hour ago

Switching to unstable resolved the issue. Thank you very much for this plugin!