stevearc / conform.nvim

Lightweight yet powerful formatter plugin for Neovim
MIT License
2.89k stars 150 forks source link

Question: How to print error message with conform.nvim #319

Open M-Xue opened 6 months ago

M-Xue commented 6 months ago

When I save a file with conform.nvim attaching a formatter on it and there is a syntax error, I get this error message.

image

This error message disappears when I remove the format_on_save.

From my understanding, conform.nvim does capture the particular error but puts it in an error log file that can be seen with :ConformInfo.

image

How do I get this error to print instead of needing to go to the log file through :ConformInfo instead?

M-Xue commented 6 months ago

Is there a way to maybe write an autocommand to trigger formatting with the format function and capture the error to print instead?

stevearc commented 5 months ago

This is not normal behavior; conform should be catching errors and re-displaying them when needed. There shouldn't be any errors that bubble up to the autocmd itself. Can you provide a minimal init.lua file that will reproduce this behavior?