diff --git a/src/Language/PureScript/Lsp/Handlers/Format.hs b/src/Language/PureScript/Lsp/Handlers/Format.hs index 006b8afa44..0a5b86c9ba 100644 --- a/src/Language/PureScript/Lsp/Handlers/Format.hs +++ b/src/Language/PureScript/Lsp/Handlers/Format.hs @@ -36,6 +36,6 @@ formatHandler = Server.requestHandler Message.SMethod_TextDocumentFormatting $ \ lspReadFileText $ Types.toNormalizedUri uri Right imports -> pure $ printImports imports formatted <- liftIO $ readProcess "purs-tidy" ["format"] (toS contents) - let lines' = toEnum $ length $ S.lines formatted + let lines' = toEnum $ max (length $ S.lines formatted) (length $ lines contents) res $ Right $ Types.InL [Types.TextEdit (Types.Range (Types.Position 0 0) (Types.Position (lines' + 1) 0)) (toS formatted)] _ -> res $ Left $ Message.TResponseError (Types.InR Types.ErrorCodes_InvalidParams) "No formatter set" Nothing diff --git a/src/Language/PureScript/Make/Actions.hs b/src/Language/PureScript/Make/Actions.hs index c2914d21fa..5e53f84228 100644 --- a/src/Language/PureScript/Make/Actions.hs +++ b/src/Language/PureScript/Make/Actions.hs @@ -114,6 +114,8 @@ data MakeActions m = MakeActions -- | Read the externs file for a module as a string and also return the actual -- path for the file. readExterns :: ModuleName -> m (FilePath, Maybe ExternsFile), + -- | Run actions using the final CheckState + -- checkState :: CheckState -> m (), -- | Run the code generator for the module and write any required output files. codegen :: Environment -> CheckState -> Module -> CF.Module CF.Ann -> Docs.Module -> ExternsFile -> SupplyT m (), -- | Check ffi and print it in the output directory. @@ -247,6 +249,9 @@ buildMakeActions outputDir filePathMap foreigns usePrefix = codegenTargets <- asks optionsCodegenTargets when (S.member Docs codegenTargets) $ for_ Docs.Prim.primModules $ \docsMod@Docs.Module {..} -> writeJSONFile (outputFilename modName "docs.json") docsMod + + -- checkState :: CheckState -> Make () + -- checkState _ = return () codegen :: Environment -> CheckState -> Module -> CF.Module CF.Ann -> Docs.Module -> ExternsFile -> SupplyT Make () codegen _prevEnv _endEnv _m m docs exts = do