Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing the Cargo.toml file when rust-analyzer is loaded produces error #234

Closed
nfejzic opened this issue Feb 15, 2024 · 1 comment · Fixed by #235
Closed

Writing the Cargo.toml file when rust-analyzer is loaded produces error #234

nfejzic opened this issue Feb 15, 2024 · 1 comment · Fixed by #235
Labels
bug Something isn't working

Comments

@nfejzic
Copy link

nfejzic commented Feb 15, 2024

Neovim version (nvim -v)

v0.9.5

Operating system/version

macOS Sonoma 14.2

Output of :checkhealth rustaceanvim

==============================================================================
rustaceanvim: require("rustaceanvim.health").check()

Checking for Lua dependencies ~
- OK [mfussenegger/nvim-dap](https://github.com/mfussenegger/nvim-dap) installed.

Checking external dependencies ~
- OK rust-analyzer: found rust-analyzer 0.3.1722-standalone (c1c9e10f7 2023-11-05)
- OK Cargo: found cargo 1.75.0 (1d8b05cdd 2023-11-20)
- OK rustc: found rustc 1.75.0 (82e1608df 2023-12-21)
- OK debug adapter: found codelldb 

Checking config ~
- OK No errors found in config.

Checking for conflicting plugins ~
- OK No conflicting plugins detected.

Checking for tree-sitter parser ~
- OK tree-sitter parser for Rust detected.

How to reproduce the issue

  1. Install rustaceanvim version 4.6.0 or later
  2. Open a Rust file in any Rust project (e.g. src/main.rs)
  3. Let rust-analyzer start-up, then change to Cargo.toml file (without closing neovim, so that rust-analyzer remains loaded)
  4. Write to Cargo.toml: :w<CR> (does not matter whether the changes were made)

Expected behaviour

rust-analyzer reloads the workspace, notification is displayed about it.

Actual behaviour

This error message appears:

Error detected while processing BufWritePost Autocommands for "*/Cargo.toml":
Error executing lua callback: ...al/share/nvim/lazy/rustaceanvim/lua/rustaceanvim/lsp.lua:170: Vim:table: 0x0102721790
stack traceback:
        [C]: in function 'RustLsp'
        ...al/share/nvim/lazy/rustaceanvim/lua/rustaceanvim/lsp.lua:170: in function <...al/share/nvim/lazy/rustaceanvim/lua/rustaceanvim/lsp.lua:169>

The minimal config used to reproduce this issue.

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
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", -- latest stable release
		lazypath,
	})
end
vim.opt.rtp:prepend(lazypath)

-- Example using a list of specs with the default options
vim.g.mapleader = " " -- Make sure to set `mapleader` before lazy so your mappings are correct

require("lazy").setup({
	{
		"mrcjkb/rustaceanvim",
		version = "^4", -- Recommended
		ft = { "rust" },
		lazy = false,
	},
})
@mrcjkb
Copy link
Owner

mrcjkb commented Feb 15, 2024

Hey 👋

Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants