Closed ChosunOne closed 2 months ago
I'm having the same problem on Windows 10.
The issue seems to me to be that when calculating relative path, if the two paths are not on the same drive, the loop will never exit. In the end, the failing assertion will run into vim.fn.dirname('C:/') ~= 'C:/'
, for example.
@billuo I think that sounds right, the file I'm editing is on my F
drive while neovim is on my C
drive.
Fixed. Thanks for the report!
Neovim version (nvim -v)
NVIM v0.10.0-dev-3085+gb024643ca Build type: RelWithDebInfo LuaJIT 2.1.1713484068
Operating system/version
Windows 11
Add the debug logs
log_level = vim.log.levels.DEBUG
and pasted the log contents below.Log file
21:37:34[DEBUG] Running formatters on C:\Users\chosun\AppData\Local\nvim\lua\custom\plugins\conform.lua: { "stylua" } 21:37:34[INFO] Run stylua on C:\Users\chosun\AppData\Local\nvim\lua\custom\plugins\conform.lua 21:37:34[TRACE] Input lines: { "return {", " { -- Autoformat", " 'stevearc/conform.nvim',", " opts = {", " notify_on_error = true,", " log_level = vim.log.levels.TRACE,", " format_on_save = function(bufnr)", " -- Disable \"format_on_save lsp_fallback\" for languages that don't", " -- have a well standardized coding style. You can add additional", " -- languages here or re-enable it for the disabled ones.", " local disable_filetypes = { c = true, cpp = true }", " return {", " async = true,", " lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],", " }", " end,", " -- NOTE: see :help conform-formatters for adding options here", " formatters_by_ft = {", " lua = { 'stylua' },", " -- Conform can also run multiple formatters sequentially", " python = { 'black' },", " -- go = { 'gofmt' },", " rust = { 'rustfmt' },", " -- markdown = { 'mdformat' },", " -- yaml = { 'yamlfmt' },", " javascript = { 'prettierd' },", " --", " -- You can use a sub-list to tell conform to run until a formatter", " -- is found.", " -- javascript = { { 'prettierd', 'prettier' } },", " },", " },", " },", "}" }
Describe the bug
On Windows, I get this error every time I save the file, and none of my formatting is applied:
What is the severity of this bug?
breaking (some functionality is broken)
Steps To Reproduce
No matter what file I open, when I save i get the reported error, and no formatting is done.
Expected Behavior
I expect there to be no error, and for formatting to be applied if applicable.
Minimal example file
No response
Minimal init.lua
Additional context
This problem started around 4 days ago, probably with the introduction of new relative path logic.
UPDATE: My machine has multiple storage drives.