You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have set log_level = vim.log.levels.DEBUG and pasted the log contents below.
Log file
15:05:41[DEBUG] Running formatters on : { "injected" }
15:05:41[INFO] Run injected on
15:05:41[ERROR] error formatting log line: 'nil' args {
n = 0
}
Describe the bug
When running the "injected" formatter on a filetype that does not have have a treesitter installed, the following error is thrown:
Error executing vim.schedule lua callback: vim/_editor.lua:0: Invalid 'str': Expected Lua string
stack traceback:
[C]: in function 'nvim_err_writeln'
vim/_editor.lua: in function 'notify'
...e/tobyv/.repro/plugins/conform.nvim/lua/conform/init.lua:18: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
From what I can tell, the issue is the callback on formatters/injected.lua#L151 is passing a string, but it's expecting a Conform.Error object. Also, due to where the error is, notify_on_error = false has no effect.
I did notice the type definition for the format function specifies a string|nil, although from what I can tell, the injected formatter is the only lua based formatter that is passing an error value directly to the callback. So I suspect the type definition should be changed.
I'd be happy to submit a PR if you want. If so, I would need to know how you want to handle actually throwing the error there, as I could see some value in handling a missing language parser differently than an actual formatter error.
Thanks for providing a super useful tool!
What is the severity of this bug?
breaking (some functionality is broken)
Steps To Reproduce
nvim -u repro.lua
enter cmd mode and run lua require("conform").format()
Expected Behavior
Either no-op or show the error via vim.notify.
Minimal example file
No response
Minimal init.lua
-- DO NOT change the paths and don't remove the colorschemelocalroot=vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .reprofor_, nameinipairs({ "config", "data", "state", "cache" }) dovim.env[("XDG_%s_HOME"):format(name:upper())] =root.."/" ..nameend-- bootstrap lazylocallazypath=root.."/plugins/lazy.nvim"ifnotvim.loop.fs_stat(lazypath) thenvim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
endvim.opt.runtimepath:prepend(lazypath)
-- install pluginslocalplugins= {
"folke/tokyonight.nvim",
{
"stevearc/conform.nvim",
config=function()
require("conform").setup({
log_level=vim.log.levels.DEBUG,
formatters_by_ft= {
["*"] = { "injected" },
},
})
end,
},
-- add any other plugins here
}
require("lazy").setup(plugins, {
root=root.."/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
Additional context
No response
The text was updated successfully, but these errors were encountered:
- Removed neotree due to not handling large directories/mono-repos
- Set conform to v6.x until
stevearc/conform.nvim#503 is resolved
- Add telescope file broswer
- Add quickfix preview
- Re-introduce oil.nvim for the ~vibes~
Neovim version (nvim -v)
0.10.0
Operating system/version
Linux 6.10.0-arch1-2 (Arch Linux)
Add the debug logs
log_level = vim.log.levels.DEBUG
and pasted the log contents below.Log file
Describe the bug
When running the "injected" formatter on a filetype that does not have have a treesitter installed, the following error is thrown:
From what I can tell, the issue is the callback on formatters/injected.lua#L151 is passing a string, but it's expecting a
Conform.Error
object. Also, due to where the error is,notify_on_error = false
has no effect.I did notice the type definition for the format function specifies a
string|nil
, although from what I can tell, theinjected
formatter is the only lua based formatter that is passing an error value directly to the callback. So I suspect the type definition should be changed.I'd be happy to submit a PR if you want. If so, I would need to know how you want to handle actually throwing the error there, as I could see some value in handling a missing language parser differently than an actual formatter error.
Thanks for providing a super useful tool!
What is the severity of this bug?
breaking (some functionality is broken)
Steps To Reproduce
lua require("conform").format()
Expected Behavior
Either no-op or show the error via
vim.notify
.Minimal example file
No response
Minimal init.lua
Additional context
No response
The text was updated successfully, but these errors were encountered: