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
Hi, I wrote an extension supporting SML for the Zed text editor (https://github.com/omarjatoi/zed-sml) and want to use smlfmt to format the buffer on save. The editor expects the formatter to output the formatted buffer to stdout. I'm able to configure it to use --preview-only, but this has delimiters at the top and bottom.
For example, if I open a buffer with the contents:
signature MAIN_STRUCTS =
sigendsignature MAIN =
siginclude MAIN_STRUCTS
val main: string * string list -> OS.Process.status
val mainWrapped: unit -> 'a
end
and save the file, my buffer now has:
---- mlton/mlton/main/main.sig ----
signature MAIN_STRUCTS = sig endsignature MAIN =
siginclude MAIN_STRUCTS
val main: string * string list -> OS.Process.status
val mainWrapped: unit -> 'a
end
--------
I also tried passing --force to format the file in-place, but since the editor is replacing the buffer with the contents of stdout the contents of the buffer get formatted and then immediately emptied out by smlfmts stdout (which is nothing).
If the existing behavior is desirable, we could add a new option --stdout or --preview-only-no-delimiters that sends the formatted contents to stdout without the bottom and filename at top delimiters. Alternatively, we could add a supplementary option for --preview-only like --no-delimiters.
If either of these options sound good I'd be happy to open a PR with the suggested changes. Thanks!
The text was updated successfully, but these errors were encountered:
Closing this issue, I just realized I was passing the path to the file, and after seeing #84 I realized I could send the contents of the buffer instead of the path to the file instead, yielding the results I expected.
Hi, I wrote an extension supporting SML for the Zed text editor (https://github.com/omarjatoi/zed-sml) and want to use
smlfmt
to format the buffer on save. The editor expects the formatter to output the formatted buffer tostdout
. I'm able to configure it to use--preview-only
, but this has delimiters at the top and bottom.For example, if I open a buffer with the contents:
and save the file, my buffer now has:
I also tried passing
--force
to format the file in-place, but since the editor is replacing the buffer with the contents ofstdout
the contents of the buffer get formatted and then immediately emptied out bysmlfmt
sstdout
(which is nothing).If the existing behavior is desirable, we could add a new option
--stdout
or--preview-only-no-delimiters
that sends the formatted contents tostdout
without the bottom and filename at top delimiters. Alternatively, we could add a supplementary option for--preview-only
like--no-delimiters
.If either of these options sound good I'd be happy to open a PR with the suggested changes. Thanks!
The text was updated successfully, but these errors were encountered: