elixir-tools / elixir-tools.nvim

Neovim plugin for Elixir
MIT License
413 stars 31 forks source link

Nextls not working #177

Closed Rem0ld closed 7 months ago

Rem0ld commented 11 months ago

Installed elixir-tools on Mac M1 Ventura 13.0 When I launched neovim (first time it installed elixirLs without problem) but NextLs doesn't work. I have a notification Initializing NextLs runtime for folder xxx/xxx/xxx that never disappear. I checked the lsp logs without success. I also installed NextLs from Mason and use

{
  cmd = "path/to/nexsls"
}

without success as well

mhanberg commented 11 months ago

Can you install https://github.com/mhanberg/output-panel.nvim and let me know what shows up for Next LS?

It makes viewing the logs much easier

Rem0ld commented 11 months ago

Yep no problem, I get

[Log] [NextLS] NextLS v0.14.2 has initialized!
[Log] [NextLS] Booting runtimes...
[Log] [NextLS] Beginning DB migration...
[Info] [NextLS] Database is on the latest version: 5
[Log] [NextLS] Finished DB migration...
[Log] [NextLS] Using `elixir` found at: /opt/homebrew/bin/elixir
mhanberg commented 11 months ago

And that's all you get? No messages about compiling?

Rem0ld commented 11 months ago

That's all I get from NextLs and from ElixirOutputPanel I get


[Info] Started ElixirLS v0.15.1
[Info] Running in /Users/pielov/workspace/personal/elixir/elixirapp/messengyr
[Info] ElixirLS built with elixir "1.15.7" on OTP "26"
[Info] Running on elixir "1.15.7 (compiled with Erlang/OTP 26)" on OTP "26"
[Info] Protocols are not consolidated
[Info] Elixir sources not found (checking in /private/tmp/elixir-20231014-5379-11sm2cy/elixir-1.15.7). Code navigation to Elixir modules disabled.
[Info] Loaded DETS databases in 9ms
[Info] Starting build with MIX_ENV: test MIX_TARGET: host
[Info] Compile took 118 milliseconds
[Info] [ElixirLS WorkspaceSymbols] Indexing...
[Info] [ElixirLS WorkspaceSymbols] Module discovery complete
[Info] [ElixirLS WorkspaceSymbols] 28 callbacks added to index
[Info] [ElixirLS WorkspaceSymbols] 193 modules added to index
[Info] [ElixirLS WorkspaceSymbols] 428 types added to index
[Info] [ElixirLS WorkspaceSymbols] 4441 functions added to index
[Info] Experimental server is disabled.
mhanberg commented 11 months ago

do you mind sharing your config?

Rem0ld commented 11 months ago
return {
  "elixir-tools/elixir-tools.nvim",
  version = "*",
  event = { "BufReadPre", "BufNewFile" },
  config = function()
    local elixir = require("elixir")
    local elixirls = require("elixir.elixirls")

    elixir.setup({
      nextls = {
        enable = true,
      },
      credo = {},
      elixirls = {
        enable = true,
        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 }
          )
        end,
      },
    })
  end,
  dependencies = {
    "nvim-lua/plenary.nvim",
  },
}

copy, pasted from here I tried to reinstall neovim from scratch with no luck

edit: I realised the first time I opened a .ex file it asked me to install ElixirLs then build time but it didn't ask for NextLs and I think it's supposed to?

mhanberg commented 11 months ago

Your Next LS binary was probably still cached in ~/.cache/elixir-tools/next-ls/bin`

can you disable elixirls and change your nextls setting to

nextls = {
  enable = true,
  port = 9000
}

then, in another shell, start nextls in tcp mode with ~/.cache/elixir-tools/nextls/bin/nextls --port 9000 and then start neovim and open an Elixir file.

and let me know if there are any errors that show up in the shell that is running the nextls server

Rem0ld commented 11 months ago

I did so and I just get Starting on port 9000