Skip to content

Commit

Permalink
fix format in place
Browse files Browse the repository at this point in the history
  • Loading branch information
roryc89 committed Nov 25, 2024
1 parent 29b54d2 commit db07957
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Language/PureScript/Lsp/Handlers/Format.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ formatHandler = Server.requestHandler Message.SMethod_TextDocumentFormatting $ \
config <- getConfig
case (formatter config, filePath) of
(PursTidyFormatInPlace, Just fp) -> do
void $ liftIO $ readProcess "purs-tidy" ["format-in-place"] fp
void $ liftIO $ readProcess "purs-tidy" ["format-in-place", fp] []
res $ Right $ Types.InR Types.Null
(PursTidyFormatInPlace, Nothing) -> do
res $ Left $ Message.TResponseError (Types.InR Types.ErrorCodes_InternalError) "File path not found" Nothing
Expand All @@ -33,7 +33,7 @@ formatHandler = Server.requestHandler Message.SMethod_TextDocumentFormatting $ \
contents <- case parsedImportsRes of
Left err -> do
warnLsp $ "Failed to parse imports from file: " <> err
lspReadFileText $ Types.toNormalizedUri uri
lspReadFileText normalizedUri
Right imports -> pure $ printImports imports
formatted <- liftIO $ readProcess "purs-tidy" ["format"] (toS contents)
let lines' = toEnum $ max (length $ S.lines formatted) (length $ lines contents)
Expand Down

0 comments on commit db07957

Please sign in to comment.