Move-analyzer LSP setup for Neovim?

Hi all,

Has anyone managed to set up Move environment on Neovim (IDE)? I managed to get move-analyzer running as the LSP on my .move files with nvim-lspconfig, but no luck getting any actual features working like definitions, autocomplete etc. …

Not a fan of VS Code so hoping to find another way rather than downloading VS Code and the move-analyzer plugin.

1 Like

Could you share how you made move-analyzer work with LSP?

1 Like

Turns out I needed to install Sui’s version of move-analyzer. I was previously using https://github.com/move-language/move move-analyzer. And it wasn’t working anywhere, on VS Code as well.

For Neovim, I am using LazyVim. Just these lines of code:

return {
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        move_analyzer = {
          cmd = { os.getenv("HOME") .. "/.cargo/bin/move-analyzer" },
          filetypes = { "move" },
          root_dir = require("lspconfig.util").root_pattern("Move.toml", ".git"),
        },
      },
    },
  },
  {
    "yanganto/move.vim",
    branch = "sui-move",
  },
}

“yanganto/move.vim” is for syntax highlighting

Just a few lines of code and works like a charm. Haven’t fully tested, but seem like I’ve a fully functioning move-analyzer, hover, auto-completion etc working on Neovim.

1 Like

How did you switch to the sui version of move-analyzer? I tried switching the cmd param to sui-move-analyzer but it did not work. also do you have the original move-analyzer installed as well?

1 Like

No i removed the original move-analyzer and installed only the sui version. So the binary in “/.cargo/bin/move-analyzer” is the Sui move analyzer basically. If you rename that to sui-move-analyzer then it would also work with what you did, i suppose. Might make sense if you want to keep both. I haven’t tried

1 Like

btw if anyone can get me some testnet tokens that would also be super helpful. The testnet faucet isn’t working for me…keeps saying rate limit reached even though I have never received anything, and requested a grand total of maybe 5 times (all failed)
0x588aa11700db877a0a9d907bb299e40c2a08bfd1f5228da0c8d2ccab2c76c827

1 Like