From a41ebcfbdb78578bd7c11af94003c5a62cf667ae Mon Sep 17 00:00:00 2001 From: Sergey Gulin Date: Wed, 14 Aug 2024 12:43:02 +0300 Subject: [PATCH] [Chore] Fix nixfmt arguments 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. --- js/JSInterface.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/JSInterface.hs b/js/JSInterface.hs index d937252..9fd3366 100644 --- a/js/JSInterface.hs +++ b/js/JSInterface.hs @@ -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 () @@ -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