williamboman / nvim-lsp-installer

Further development has moved to https://github.com/williamboman/mason.nvim!
https://github.com/williamboman/mason.nvim
Apache License 2.0
2k stars 123 forks source link

Unable to Cargo Workspace #375

Closed ca-mantis-shrimp closed 2 years ago

ca-mantis-shrimp commented 2 years ago

Describe the bug So I've been using LSP-Installer for awhile now, and what is really weird is that my config was working a few days ago!

I'm trying to make this work with the rust-tools extension, but this bug shows up whether I configure it with the rust-tools plugin, or simply using the basic rust-analyzer setup laid out in the README. I have a pretty minimal configuration, and besides a basic configuration for sumneko lua, rust is the only language I am trying to get working at the moment (so no complex LSP switching logic).

The reason I think this is an lis-installer issue is because I can get the configuration working fine if I create the LSP server using only the rust-tools plugin.

So this is why I think it is an lsp-install issue that may have arisen from a recent change in the rust analyzer code.

Expected behavior When I open a rust file, I expect to simply begin editing, and see diagnostics as I begin typing.

Screenshots If applicable, add screenshots to help explain your problem. image

System info (please complete the following information): Windows 10


  1 nvim-lsp-installer: require("nvim-lsp-installer.health").check()
  2 ========================================================================
  3 ## nvim-lsp-installer report
  4 │ - WARNING: **Go**: not available
  5 │ - WARNING: **Ruby**: not available
  6 │ - WARNING: **RubyGem**: not available
  7 │ - WARNING: **Composer**: not available
  8 │ - WARNING: **PHP**: not available
  9 │ - WARNING: **javac**: not available
 10 │ - WARNING: **java**: not available
 11 │ - OK: **sh**: `Ok`
 12 │ - OK: **bash**: `GNU bash, version 5.1.4(1)-release (x86_64-pc-linux-gnu)`
 13 │ - OK: **tar**: `tar (GNU tar) 1.34`
 14 │ - OK: **gzip**: `gzip 1.10`
 15 │ - OK: **wget**: `GNU Wget 1.21 built on linux-gnu.`
 16 │ - OK: **python3**: `Python 3.9.2`
 17 │ - OK: **curl**: `curl 7.74.0 (x86_64-pc-linux-gnu) libcurl/7.74.0 OpenSSL/1.1.1k zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.43.0         librtmp/2.3`
 18 │ - WARNING: **pip3**: not available
 19 │ - WARNING: **node**: unsupported version `v12.22.5`. Node version must be >= 14
 20 │ - OK: **npm**: `7.5.2`

Please also include any other system information you think is relevant!

Install log Not applicable, rust analyzer seems to be installed fine, but the plugin is having trouble seeing the actual workspace

Thank you for taking the time to read my Issue, happy to answer any questions. Appreciate the work, love using your plugin!

williamboman commented 2 years ago

Hello! When you're able to set it up via both rust-tools and lspconfig, are all other things equal (i.e., exact same project, same system, same version of rust-analyzer)? After some quick research, os error 5 seems to be some WSL-related file permission error.

What does the LSP log say? :exe 'tabnew ' .. luaeval("vim.lsp.get_log_path()")

ca-mantis-shrimp commented 2 years ago

Hey @williamboman,

TY for your time! I will answer in order.

  1. Yes, in order to minimize variables, I reduced both functions down to their base state. Specifically, I just ran an empty setup for the rust tools, and as close to an empty setup for LspConfig as well. Both are using an instance of rust-analyzer that I installed by building from source with the --server flag.
  2. Here is the output I receive: [ERROR][2022-01-02 17:18:35] .../vim/lsp/rpc.lua:417 "rpc" "rust-analyzer" "stderr" '[ERROR rust_analyzer::reload] failed to switch workspaces: rust-analyzer failed to load workspace: "cargo" "--version" failed: Input/output error (os error 5)\n\n'
ca-mantis-shrimp commented 2 years ago

Posting a follow-up.

So today I updated to 0.6.1 AppImage.

I now get the error that runs when you try to open a rust file while rust-tools is installed, but didn't actually run the setup function

Error Code: Error detected while processing VimEnter Autocommands for "*.rs":
E5108: Error executing lua ...ite/pack/packer/start/rust-tools.nvim/lua/rust-tools.lua:176: attempt to index local 'lsp_opts' (a nil value)
stack traceback:
        ...ite/pack/packer/start/rust-tools.nvim/lua/rust-tools.lua:176: in function 'start_standalone_if_required'
        [string ":lua"]:1: in main chunk

This implies that the new startup changes that recently came to rust-tools for the standalone issue might be at fault?

williamboman commented 2 years ago

I now get the error that runs when you try to open a rust file while rust-tools is installed, but didn't actually run the setup function

Ah so you can now reproduce the issue without using nvim-lsp-installer? I'm at a loss as to what might be happening - if I had to guess this is a WSL-specific file permissions issue. If there was a reproducible minimal config or environment, this would be easier to debug from my end.

ca-mantis-shrimp commented 2 years ago

I now get the error that runs when you try to open a rust file while rust-tools is installed, but didn't actually run the setup function

Ah so you can now reproduce the issue without using nvim-lsp-installer? I'm at a loss as to what might be happening - if I had to guess this is a WSL-specific file permissions issue. If there was a reproducible minimal config or environment, this would be easier to debug from my end.

Ill rework my config in a new branch to get a minimal config. Thank you for your patience and help!

williamboman commented 2 years ago

Hey so I've created a new issue template for these kinds of issues, it contains a minimal_debug_init.lua which should be used when describing how to reproduce the issue. I'll close this issue as I'm unable to reproduce it, but please file a new one using the issue template if you think it's still relevant!

Screenshot 2022-02-16 at 21 33 46
ca-mantis-shrimp commented 2 years ago

Just a final comment before I leave this. I should note that this workspace error went away with one of the recent updates to rust-tools, I think there was just a temporary workspace bug that should be fixed now with the newest version of rust tools. Thanks as always for your triage and patience!