Skip to content

Add verbosity levels for warnings and errors#3371

Open
tesujimath wants to merge 1 commit into
fsprojects:mainfrom
tesujimath:verbosity
Open

Add verbosity levels for warnings and errors#3371
tesujimath wants to merge 1 commit into
fsprojects:mainfrom
tesujimath:verbosity

Conversation

@tesujimath

Copy link
Copy Markdown

These behave the same as normal in terms of output formatting, but have a minimum log level of warning and error respectively.

This is useful when formatting to stdout with e.g. --out /dev/fd/1 to avoid the "<file> was formatted."
message appearing in the formatted output.

(Being able to format to stdout seems to be essential for e.g. hooking Fantomas into Emacs Aphelia.)

Relates to #2665

These behave the same as normal in terms of output formatting,
but have a minimum log level of warning and error respectively.

This is useful when formatting to stdout with e.g. --out /dev/fd/1
to avoid the "<file> was formatted." message appearing
in the output.
@nojaf

nojaf commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Hey Simon, thanks for the PR!

Before we go the --out/stdout route though, I'd like to back up a bit. What are you using to format on save? An LSP like fsautocomplete? Normally that's the path that calls Fantomas and sorts out .editorconfig and .fsi handling for you, so I'd really like to understand why that isn't doing the job for you here.

Formatting only needs the untyped tree, so it should never get stuck waiting on type-checking. If it does, that smells like something on the editor/LSP side rather than something --out ought to fix. Can you tell me a bit more about your setup and what's actually going wrong? I'd rather get that working than add a stdout workaround.

@tesujimath

Copy link
Copy Markdown
Author

Hi Florian,

Thanks for looking at this.

Sorry, I meant to add a comment here to say I'd solved my particular problem using apheleia, which is happy with this.

(with-eval-after-load 'apheleia
  (setf (alist-get 'fsharp-ts-mode apheleia-mode-alist) 'fantomas)
  ;; F# autoformat using fantomas
  (setf (alist-get 'fantomas apheleia-formatters) '("fantomas" input "--out" output)))

I previously overlooked using output.

So I have no need for this personally. Merge it if you think it's useful, otherwise no problem!

Cheers,
Simon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants