Checked other resources
Feature descriptionThis was partially talked in #525 When working with standalone files, rust-analyzer repeatedly reports a health status error when opening or saving files, or after any other major event happens:
Minimal reproduction config-- init.lua
local lazypath = '/tmp/_lazy/lazy.nvim'
vim.g.rustaceanvim = {
server = {
standalone = true,
settings = { ['rust-analyzer'] = {} },
},
}
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable',
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup({
{ 'mrcjkb/rustaceanvim', lazy = false },
})
This comes from The error is not critical though, lsp remains usable, but this repeated notification considerably interrupts workflow. I do not expect full diagnostics support, it's clear that rustaceanvim has partial standalone file support, but since it has some support, this notification shouldn't be surfaced and be allowed to disrupt the experience. WorkaroundsAs mentioned in the original discussion, setting Creating a complete cargo project would avoid this, but is impossible in some projects, and I wouldn't consider this to support standalone files. Solutionsrust-analyzer supports detached files, but still attempts workspace discovery and reports these errors while everything still works. I manually tested with the RPC and I cannot seem to get rid of this warning, there could be an obscure setting to improve things but I didn't find anything. I suggest filtering notifications so that, when editing a standalone file, if the status error message contains a relevant part of this error (for example, "Failed to load workspaces"), it won't get notified. Personally, I'm not sure if I had this issue several months ago, I was unable to fix this by changing rust-analyzer versions of about a year ago, and I can't easily bisect rustaceanvim in my configuration, so I am unaware if this could have been introduced by a recent rustaceanvim change over the last months. While this could technically be implemented in rust-analyzer, I think it's appropriate for rustaceanvim to decide if these errors should be shown to the user if it knows it is working in standalone mode. Related Issues
|
Replies: 2 comments 2 replies
|
This should definitely be fixed in rust-analyzer, not in rustaceanvim. PRs welcome 😃 |
Just to close this, #1115 greatly improved this situation.