Skip to content

Commit

Permalink
[Chore] Fix nixfmt arguments
Browse files Browse the repository at this point in the history
Problem: The `format` function parameters have changed, we need to
change the arguments accordingly.

Solution: Pass `layout` with format width and boolean value to control
whether the format should be strict (independent of user input) as the
first argument.
  • Loading branch information
Sereja313 committed Aug 14, 2024
1 parent 5b289e6 commit a41ebcf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/JSInterface.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import GHC.JS.Prim
import Data.Text as T

import Nixfmt
import Nixfmt.Predoc (layout)

foreign import javascript "((f) => { nixfmt_ = f })"
setNixfmt :: Callback (JSVal -> JSVal -> IO JSVal) -> IO ()
Expand All @@ -19,6 +20,6 @@ main = setNixfmt =<< syncCallback2' \text_ obj -> do
width <- fromJSInt <$> getProp obj "width"
filename <- fromJSString <$> getProp obj "filename"
let text = T.pack $ fromJSString text_
pure $ toJSString case format width filename text of
pure $ toJSString case format (layout width False) filename text of
Left err -> err
Right out -> T.unpack out

0 comments on commit a41ebcf

Please sign in to comment.