Skip to content

Commit

Permalink
fix(rust_analyzer): check if file is library on Windows
Browse files Browse the repository at this point in the history
Make #2645 to work on Windows
  • Loading branch information
ytaras authored and dundargoc committed Sep 30, 2023
1 parent cfe48e7 commit 50fcf96
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lua/lspconfig/server_configurations/rust_analyzer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 50fcf96

Please sign in to comment.