Move 'normalize' function to utils

This commit is contained in:
fendor 2020-04-25 15:45:03 +02:00 committed by fendor
parent 460b4554f5
commit bab2de6ca9
3 changed files with 10 additions and 10 deletions

View File

@ -12,6 +12,7 @@ import Language.Haskell.Brittany
import Language.Haskell.LSP.Types as J
import qualified Language.Haskell.LSP.Types.Lens as J
import Ide.Plugin.Formatter
import Ide.PluginUtils
import Ide.Types
import System.FilePath
@ -61,11 +62,6 @@ formatText confFile opts text =
liftIO $ runBrittany tabSize confFile text
where tabSize = opts ^. J.tabSize
-- | Extend to the line below and above to replace newline character.
normalize :: Range -> Range
normalize (Range (Position sl _) (Position el _)) =
Range (Position sl 0) (Position (el + 1) 0)
-- | Recursively search in every directory of the given filepath for brittany.yaml.
-- If no such file has been found, return Nothing.
getConfFile :: NormalizedFilePath -> IO (Maybe FilePath)

View File

@ -90,8 +90,3 @@ provider _lf ideState typ contents fp _ = do
#else
provider _ _ _ _ = return $ Right [] -- NOP formatter
#endif
-- | Extend to the line below and above to replace newline character.
normalize :: Range -> Range
normalize (Range (Position sl _) (Position el _)) =
Range (Position sl 0) (Position (el + 1) 0)

View File

@ -10,6 +10,15 @@ import Language.Haskell.LSP.Types.Capabilities
import qualified Language.Haskell.LSP.Types as J
import Language.Haskell.LSP.Types
-- ---------------------------------------------------------------------
-- | Extend to the line below and above to replace newline character.
normalize :: Range -> Range
normalize (Range (Position sl _) (Position el _)) =
Range (Position sl 0) (Position (el + 1) 0)
-- ---------------------------------------------------------------------
data WithDeletions = IncludeDeletions | SkipDeletions
deriving Eq