neovim-rust icon indicating copy to clipboard operation
neovim-rust copied to clipboard

Getting some errors/not working as described

Open unphased opened this issue 2 years ago • 10 comments

I tried this on Docker Desktop on my M1 machine and nvim runs but there does not seem to be any rust format stuff working. I see in the nvim output history:

method rust-analyzer/inlayHints is not supported by any of the servers registered for the current buffer
Client 1 quit with exit code 255 and signal 0

I'm a total rust noob though.

unphased avatar Jun 27 '22 23:06 unphased

[lspconfig] cmd ("cargo metadata --no-deps --format-version 1") failed:
error: could not find `Cargo.toml` in `/` or any parent directory

from :LspInfo

unphased avatar Jun 27 '22 23:06 unphased

I don't know what prompted it, but some sort of overlay showed up displaying:

~            Language client log: /root/.local/state/nvim/lsp.log
~            Detected filetype:   rust
~
~            0 client(s) attached to this buffer:
~
~            Other clients that match the filetype: rust
~
~            Config: rust_analyzer
~             Refer to :h lspconfig-root-detection for help.
~             filetypes:         rust
~             root directory:    Not found. Searched for: root_pattern("Cargo.toml", "rust-project.js
~           on").
~             cmd:               rust-analyzer
~             cmd is executable: true
~             autostart:         true
~             custom handlers:
~
~            Configured servers list: rust_analyzer
~
~

unphased avatar Jun 27 '22 23:06 unphased

And here's what it shows on initial startup

Error detected while processing :source (no file) called at command line:0:
E185: Cannot find color scheme 'nord'
E5108: Error executing lua [string ":lua"]:3: module 'lspconfig' not found:
        no field package.preload['lspconfig']
        no file './lspconfig.lua'
        no file '/usr/local/share/lua/5.1/lspconfig.lua'
        no file '/usr/local/share/lua/5.1/lspconfig/init.lua'
        no file '/usr/local/lib/lua/5.1/lspconfig.lua'
        no file '/usr/local/lib/lua/5.1/lspconfig/init.lua'
        no file '/usr/share/lua/5.1/lspconfig.lua'
        no file '/usr/share/lua/5.1/lspconfig/init.lua'
        no file './lspconfig.so'
        no file '/usr/local/lib/lua/5.1/lspconfig.so'
        no file '/usr/lib/aarch64-linux-gnu/lua/5.1/lspconfig.so'
        no file '/usr/lib/lua/5.1/lspconfig.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        [string ":lua"]:3: in main chunk
E5108: Error executing lua [string ":lua"]:1: module 'cmp' not found:
        no field package.preload['cmp']
        no file './cmp.lua'
        no file '/usr/local/share/lua/5.1/cmp.lua'








-- More --

unphased avatar Jun 27 '22 23:06 unphased

This might be getting somewhere

~                          Language client log: /root/.local/state/nvim/lsp.log
~                          Detected filetype:   rust
~
~                          0 client(s) attached to this buffer:
~
~                          Other clients that match the filetype: rust
~
~                          Config: rust_analyzer
~                           filetypes:         rust
~                           root directory:    /root/test_app
~                           cmd:               rust-analyzer
~                           cmd is executable: true
~                           autostart:         true
~                           custom handlers:
~
~                          Configured servers list: rust_analyzer
~

LspLog:

  [START][2022-06-27 23:32:39] LSP logging initiated
  [WARN][2022-06-27 23:32:39] .../lua/vim/lsp.lua:96      "method rust-analyzer/inlayHints is not supported by any of the servers registered for the current buffer"
  [ERROR][2022-06-27 23:32:39] .../vim/lsp/rpc.lua:430    "rpc"   "rust-analyzer" "stderr"        "qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory\n"

I shall give it a whirl on x86_64 on a linux machine

unphased avatar Jun 27 '22 23:06 unphased

OK it is actually working on x64. But there are still errors like this; maybe I can ignore them and figure out inlayHints later.

Error detected while processing BufEnter Autocommands for "*.rs":
method rust-analyzer/inlayHints is not supported by any of the servers registered for the current buffer
Error detected while processing BufWinEnter Autocommands for "*.rs":
method rust-analyzer/inlayHints is not supported by any of the servers registered for the current buffer
Error detected while processing CursorMoved Autocommands for "*.rs":
method rust-analyzer/inlayHints is not supported by any of the servers registered for the current buffer
Error detected while processing CursorMoved Autocommands for "*.rs":
method rust-analyzer/inlayHints is not supported by any of the servers registered for the current buffer
LSP[rust_analyzer] received `end` message with no corresponding `begin`

unphased avatar Jun 27 '22 23:06 unphased

Still get this during the initial PlugInstall tho:

Error detected while processing :source (no file) called at command line:0:
E185: Cannot find color scheme 'nord'
E5108: Error executing lua [string ":lua"]:3: module 'lspconfig' not found:
        no field package.preload['lspconfig']
        no file './lspconfig.lua'
        no file '/usr/share/luajit-2.1.0-beta3/lspconfig.lua'
        no file '/usr/local/share/lua/5.1/lspconfig.lua'
        no file '/usr/local/share/lua/5.1/lspconfig/init.lua'
        no file '/usr/share/lua/5.1/lspconfig.lua'
        no file '/usr/share/lua/5.1/lspconfig/init.lua'
        no file './lspconfig.so'
        no file '/usr/local/lib/lua/5.1/lspconfig.so'
        no file '/usr/lib/x86_64-linux-gnu/lua/5.1/lspconfig.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        [string ":lua"]:3: in main chunk
E5108: Error executing lua [string ":lua"]:1: module 'cmp' not found:
        no field package.preload['cmp']
        no file './cmp.lua'
        no file '/usr/share/luajit-2.1.0-beta3/cmp.lua'
        no file '/usr/local/share/lua/5.1/cmp.lua'
        no file '/usr/local/share/lua/5.1/cmp/init.lua'



unphased avatar Jun 27 '22 23:06 unphased

OK with the ./run.sh neovim-init-lsp-cmp-rust-tools.vim and also I edited show_parameter_hints = false, to show_parameter_hints = true, in the nvim config file! it has no errors during runtime anymore and displays the inlay hints.

unphased avatar Jun 27 '22 23:06 unphased

I was able to make a screen recording and pull up the remaining truncated PlugInstall error output!

image

unphased avatar Jun 28 '22 00:06 unphased

Ah ok this output is supposed to be ignored. because at the time that runs (the first PlugInstall) none of that stuff is installed or available yet. So we just need to find a way to make it auto clear itself out, which is a known limitation with vim/neovim and long error messages. I tended to do this in the past by injecting input containing newlines...

unphased avatar Jun 28 '22 00:06 unphased

Hey @unphased try the latest master now, I believe I fix this in https://github.com/sharksforarms/neovim-rust/commit/b312cea8640ffdb24edb58894c3a611654bf731b.

./run.sh should now PlugInstall without fail and cd you to ~/test_app, you can now just hit up-arrow to get nvim ./src/main.rs for fast testing

sharksforarms avatar Jun 28 '22 18:06 sharksforarms

Closing for now, let me know if you have any issues

sharksforarms avatar Aug 22 '22 17:08 sharksforarms