fix(rust): drop incompatible root_dir under native_lsp_config - #1754
Conversation
Review ChecklistDoes this PR follow the [Contribution Guidelines](development guidelines)? Following is a partial checklist: Proper conventional commit scoping:
|
With astrolsp native_lsp_config enabled, lsp_opts("rust_analyzer")
returns the full vim.lsp.config table including nvim-lspconfig's
root_dir(bufnr, on_dir) function. rustaceanvim calls its root_dir
with (file_name, default_fn) instead, causing:
lsp/rust_analyzer.lua:89: Invalid 'buffer': Expected Lua number
Drop root_dir from the forwarded opts so rustaceanvim falls back to
its own cargo-aware root detection.
This becomes relevant once native_lsp_config is the default
(astrolsp v4).
Co-authored-by: rami3l <rami3l@outlook.com>
18a9a51 to
e2ca130
Compare
📑 Description
With astrolsp
native_lsp_configenabled,lsp_opts("rust_analyzer")returns the fullvim.lsp.configtable including nvim-lspconfig'sroot_dir(bufnr, on_dir)function. rustaceanvim calls itsroot_dirwith(file_name, default_fn)instead, causing on every rust file open:This drops
root_dirfrom the forwarded opts so rustaceanvim falls back to its own cargo-aware root detection.📖 Additional Information
Replaces #1747 since some details have been changed after upgrading to AstroNvim v6.
Original commit from @Mic92.
cc @Uzaaft