From aef96ddf83c14c12793dafcd6a15425010bbfaf2 Mon Sep 17 00:00:00 2001 From: Michael Lingelbach Date: Fri, 8 Jan 2021 18:43:37 -0800 Subject: rust-analyzer: fix root pattern for multi-crate projects --- lua/lspconfig/rust_analyzer.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/lspconfig/rust_analyzer.lua b/lua/lspconfig/rust_analyzer.lua index 4ea77cac..1ff1370a 100644 --- a/lua/lspconfig/rust_analyzer.lua +++ b/lua/lspconfig/rust_analyzer.lua @@ -5,7 +5,11 @@ configs.rust_analyzer = { default_config = { cmd = {"rust-analyzer"}; filetypes = {"rust"}; - root_dir = util.root_pattern("Cargo.toml", "rust-project.json"); + root_dir = function(fname) + return util.find_git_ancestor(fname) or + util.root_pattern("rust-project.json")(fname) or + util.root_pattern("Cargo.toml")(fname) + end; settings = { ["rust-analyzer"] = {} }; -- cgit v1.2.3-70-g09d2