From 50fcf96ec5a6e7bfdcbbea4f905c33e85408f170 Mon Sep 17 00:00:00 2001 From: Yura Taras Date: Mon, 11 Sep 2023 08:20:20 +0000 Subject: [PATCH] fix(rust_analyzer): check if file is library on Windows Make #2645 to work on Windows --- lua/lspconfig/server_configurations/rust_analyzer.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/lspconfig/server_configurations/rust_analyzer.lua b/lua/lspconfig/server_configurations/rust_analyzer.lua index 6ed471d2d5..656c459de7 100644 --- a/lua/lspconfig/server_configurations/rust_analyzer.lua +++ b/lua/lspconfig/server_configurations/rust_analyzer.lua @@ -16,10 +16,11 @@ local function reload_workspace(bufnr) end local function is_library(fname) - local cargo_home = os.getenv 'CARGO_HOME' or util.path.join(vim.env.HOME, '.cargo') + local user_home = util.path.sanitize(vim.env.HOME) + local cargo_home = os.getenv 'CARGO_HOME' or util.path.join(user_home, '.cargo') local registry = util.path.join(cargo_home, 'registry', 'src') - local rustup_home = os.getenv 'RUSTUP_HOME' or util.path.join(vim.env.HOME, '.rustup') + local rustup_home = os.getenv 'RUSTUP_HOME' or util.path.join(user_home, '.rustup') local toolchains = util.path.join(rustup_home, 'toolchains') for _, item in ipairs { toolchains, registry } do