Description
I am using a minimal config mentioned below and do not have rust installed.
In particular the commands rustc and cargo are not in the PATH.
Under these conditions, the following error is displayed when opening a rust file:
Error in BufReadPost Autokommandos für "*":
Lua callback: ...-neovim-unwrapped-0.12.3/share/nvim/runtime/filetype.lua:28: BufReadPost Autokommandos für "*"..FileType Autokommandos für "*": Vim(append)
:Lua callback: vim/_core/system:324: ENOENT: no such file or directory (cmd): 'rustc'
stack traceback:
[C]: in function 'error'
vim/_core/system:324: in function 'spawn'
vim/_core/system:432: in function 'system'
.../site/pack/core/opt/nvim-lspconfig/lsp/rust_analyzer.lua:46: in function 'default_sysroot_src'
.../site/pack/core/opt/nvim-lspconfig/lsp/rust_analyzer.lua:74: in function 'is_library'
.../site/pack/core/opt/nvim-lspconfig/lsp/rust_analyzer.lua:90: in function 'root_dir'
...ovim-unwrapped-0.12.3/share/nvim/runtime/lua/vim/lsp.lua:561: in function 'lsp_enable_callback'
...ovim-unwrapped-0.12.3/share/nvim/runtime/lua/vim/lsp.lua:649: in function <...ovim-unwrapped-0.12.3/share/nvim/runtime/lua/vim/lsp.lua:648>
[C]: in function 'nvim_cmd'
...-neovim-unwrapped-0.12.3/share/nvim/runtime/filetype.lua:28: in function <...-neovim-unwrapped-0.12.3/share/nvim/runtime/filetype.lua:27>
[C]: in function 'pcall'
vim/_core/shared:1648: in function <vim/_core/shared:1628>
[C]: in function '_with'
...-neovim-unwrapped-0.12.3/share/nvim/runtime/filetype.lua:27: in function <...-neovim-unwrapped-0.12.3/share/nvim/runtime/filetype.lua:10>
stack traceback:
[C]: in function '_with'
...-neovim-unwrapped-0.12.3/share/nvim/runtime/filetype.lua:27: in function <...-neovim-unwrapped-0.12.3/share/nvim/runtime/filetype.lua:10>
Furthermore, there is no syntax highlighting.
Syntax highlighting works however, when commenting out the vim.lsp.enable({ "rust_analyzer" }) line.
I think this bug affects primarily devenv or nix flake users who keep per project rust installs or users that use the same vim config across devices and wish to read and edit rust source files even without the language server present.
I previously made a PR (#4464) that "works for me", but it would need more work to be up to standard.
Config
-- init.lua
vim.pack.add({ "https://github.com/neovim/nvim-lspconfig" })
vim.lsp.enable({ "rust_analyzer" })
Version
NVIM v0.12.3
Build type: Release
LuaJIT 2.1.1774638290
OS
Description
I am using a minimal config mentioned below and do not have rust installed.
In particular the commands
rustcandcargoare not in the PATH.Under these conditions, the following error is displayed when opening a rust file:
Furthermore, there is no syntax highlighting.
Syntax highlighting works however, when commenting out the
vim.lsp.enable({ "rust_analyzer" })line.I think this bug affects primarily devenv or nix flake users who keep per project rust installs or users that use the same vim config across devices and wish to read and edit rust source files even without the language server present.
I previously made a PR (#4464) that "works for me", but it would need more work to be up to standard.
Config
Version
OS