folke/lazydev.nvim

[Windows] bug: insufficient path normalization

TheLeoP opened this issue · 0 comments

Did you check docs and existing issues?

  • I have read all the lazydev.nvim docs
  • I have searched the existing issues of lazydev.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.10.0

Operating system/version

Windows 11 Pro 23H2

Describe the bug

The plugins seems to not work because here

local root = item.scopeUri and vim.uri_to_fname(item.scopeUri) or "single"

the path isn't normalized before being passed to Workspace.get. This leads to paths like c:/some/path, C:/some/path and c:\\some\\path not being considered as the same path. Using vim.fs.normalize is not enough because it still fails to make paths with upper and lower case disk name match.

Steps To Reproduce

  1. nvim --clean -u minimal.lua
  2. Open any file on a neovim config repo (plugin, personal config, etc)
  3. The plugin will send an empty config to lua_ls (so, there will be no custom settings for library, lua version, etc)

Expected Behavior

The plugin should work on Windows

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  "folke/lazydev.nvim",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here