stevearc / conform.nvim

Lightweight yet powerful formatter plugin for Neovim
MIT License
3.01k stars 156 forks source link

feature request: log file clear command #455

Closed SetsuikiHyoryu closed 3 months ago

SetsuikiHyoryu commented 3 months ago

Did you check existing requests?

Describe the feature

A command to clear the log file.

Provide background

I want a command to clear the log file so that I can easily read the formatter's information.

Sorry, I'm a beginner, so I don't know if you have implemented an auto-clean log feature based on some timing function because I can't understand your source code.

If you don't plan to implement the clean command, please tell me the reason. Thank you.

What is the significance of this feature?

nice to have

Additional details

Currently, I manually clear the log file, and I find this slightly inconvenient.

stevearc commented 3 months ago

Log files are not meant to be cleaned, they are meant to stick around for as long as (reasonably) possible to preserve history in case you need it later. The logfile is rotated once it hits 10MB

https://github.com/stevearc/conform.nvim/blob/8a4df1f6682d1f38cb73884200025dec97e6a531/lua/conform/log.lua#L66-L71

If you want a command to clear the log file, it would be very easy to create that yourself. Just write a function that calls uv.fs_unlink or uv.fs_ftruncate on the log file. You can find the path of the log file with require("conform.log").get_logfile()