Closed thecode-master-sy closed 5 months ago
Also getting an error with prettier and prettierd, except the message is blank:
Formatter 'prettierd' error:
However stylua seems to be working fine on my machine
I had a same error on lua and ts project.
I guess it is bcs of AST parsing is not possible by syntax errors.
I solved with quiet=true
option.
format_on_save = { timeout_ms = 500, lsp_fallback = true, async = true, **quiet = true** },
I had a same error on lua and ts project. I guess it is bcs of AST parsing is not possible by syntax errors. I solved with
quiet=true
option.format_on_save = { timeout_ms = 500, lsp_fallback = true, async = true, **quiet = true** },
Thanks for the help! With quiet=true
conform started producing other errors in its log file, which helped me trace back to the root problem. My issue was that I upgraded to Pretter 3, which conflicted with some of my other packages.
@thecode-master-sy please ensure that you have set the log level to DEBUG
as mentioned in the bug report template. There are a lot of debug logs missing in ConformInfo
that would aid in debugging.
@stevearc I have done that now, and have updated the log files
So the first step would be to try to run prettier on the command line to see if that works. If you just run prettier.cmd <file>
does that format it?
The next step would be to run it with the same args as conform, using stdin. I don't know Windows command shell syntax, but in bash it would be something like prettier.cmd --stdin-filepath C:\Users\thecodemaster\Desktop\ecommerce-website\components\Button.tsx <C:\Users\thecodemaster\Desktop\ecommerce-website\components\Button.tsx
.
Hmmm...looking at it again, I wonder if the issue could be caused by the CWD? C:/Users/thecodemaster/Desktop/ecommerce-website
has the wrong slashes, but it should be coming from vim.fs.find
. Also, if this didn't work I don't think most formatters would work on Windows. Still, to test that out you can remove the CWD and see if that changes the behavior.
require("conform").setup({
formatters = {
prettier = {
cwd = function() end,
},
},
})
when I run prettier.cmd
on the file path, it doesn't actually format the file, it just logs out the content of the file.
Same with the prettier.cmd --stdin-filepath C:\Users\thecodemaster\Desktop\ecommerce-website\components\Button.tsx
but this time it doesn't log anything at all
However if I run prettier --write
on the file it formats it
uninstalling and reinstalling conform fixed this error, it seems like was previously configured with the wrong path. I am not sure how that happened. @stevearc thanks so much for your efforts.
Neovim version (nvim -v)
0.9.5
Operating system/version
Windows 10 pro/10.0.19045 build 19045
Add the debug logs
log_level = vim.log.levels.DEBUG
and pasted the log contents below.Log file
Describe the bug
Prettier and stylua fails to format on save instead it gives the above error
What is the severity of this bug?
blocking (cannot use plugin)
Steps To Reproduce
Expected Behavior
Prettier and stylua should be able to format on save with no errors
Minimal example file
No response
Minimal init.lua
Additional context
No response