elixir-tools/next-ls

NextLS crashing with: Failed to run completion request

Closed this issue · 0 comments

Here's the full error:

[WARN][2024-03-28 14:31:27] ...lsp/handlers.lua:537"[Next LS] Failed to run completion request: ** (FunctionClauseError) no function clause matching in Sourceror.Zipper.node/1
    (sourceror 1.0.2) lib/sourceror/zipper.ex:100: Sourceror.Zipper.node(nil)
    (next_ls 0.20.2) lib/next_ls/helpers/ast_helpers/env.ex:18: NextLS.ASTHelpers.Env.build/1
    (next_ls 0.20.2) lib/next_ls.ex:593: NextLS.handle_request/2
    (gen_lsp 0.8.1) lib/gen_lsp.ex:277: anonymous fn/2 in GenLSP.loop/3
    (telemetry 1.2.1) /Users/njichev/Projects/next-ls/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
    (gen_lsp 0.8.1) lib/gen_lsp.ex:276: anonymous fn/6 in GenLSP.loop/3
    (gen_lsp 0.8.1) lib/gen_lsp.ex:397: GenLSP.attempt/4
    (stdlib 5.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

This happens a couple of times in the logs until it crashes the top level supervisor and next exits(I start it locally with bin/start --port 9000)

Using neovim 0.9.5 and the following setup:

return {
  "njichev/elixir-tools.nvim",
  version = "*",
  branch = "add-refactor-alias-command",
  event = { "BufReadPre", "BufNewFile" },
  config = function()
    local elixir = require("elixir")
    local elixirls = require("elixir.elixirls")

    elixir.setup {
      nextls = {
        port = 9000,
        enable = true,
        init_options = {
          mix_env = "dev",
          mix_target = "host",
          experimental = {
            completions = {
              enable = true
            }
          }
        },
      },
      credo = {enable = false},
      elixirls = {
        enable = false,
        settings = elixirls.settings {
          dialyzerEnabled = false,
          enableTestLenses = false,
        },
        on_attach = function(client, bufnr)
          vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", { buffer = true, noremap = true })
          vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", { buffer = true, noremap = true })
          vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", { buffer = true, noremap = true })
          vim.keymap.set("v", "<space>ar", ":Elixir nextls alias-refactor<cr>", { buffer = true, noremap = true })
        end,
      }
    }
  end,
  dependencies = {
    "nvim-lua/plenary.nvim",
  },
}