Skip to content

Commit bab2de6

Browse files
committed
Move 'normalize' function to utils
1 parent 460b455 commit bab2de6

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/Ide/Plugin/Brittany.hs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Language.Haskell.Brittany
1212
import Language.Haskell.LSP.Types as J
1313
import qualified Language.Haskell.LSP.Types.Lens as J
1414
import Ide.Plugin.Formatter
15+
import Ide.PluginUtils
1516
import Ide.Types
1617

1718
import System.FilePath
@@ -61,11 +62,6 @@ formatText confFile opts text =
6162
liftIO $ runBrittany tabSize confFile text
6263
where tabSize = opts ^. J.tabSize
6364

64-
-- | Extend to the line below and above to replace newline character.
65-
normalize :: Range -> Range
66-
normalize (Range (Position sl _) (Position el _)) =
67-
Range (Position sl 0) (Position (el + 1) 0)
68-
6965
-- | Recursively search in every directory of the given filepath for brittany.yaml.
7066
-- If no such file has been found, return Nothing.
7167
getConfFile :: NormalizedFilePath -> IO (Maybe FilePath)

src/Ide/Plugin/Ormolu.hs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,3 @@ provider _lf ideState typ contents fp _ = do
9090
#else
9191
provider _ _ _ _ = return $ Right [] -- NOP formatter
9292
#endif
93-
94-
-- | Extend to the line below and above to replace newline character.
95-
normalize :: Range -> Range
96-
normalize (Range (Position sl _) (Position el _)) =
97-
Range (Position sl 0) (Position (el + 1) 0)

src/Ide/PluginUtils.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ import Language.Haskell.LSP.Types.Capabilities
1010
import qualified Language.Haskell.LSP.Types as J
1111
import Language.Haskell.LSP.Types
1212

13+
-- ---------------------------------------------------------------------
14+
15+
-- | Extend to the line below and above to replace newline character.
16+
normalize :: Range -> Range
17+
normalize (Range (Position sl _) (Position el _)) =
18+
Range (Position sl 0) (Position (el + 1) 0)
19+
20+
-- ---------------------------------------------------------------------
21+
1322
data WithDeletions = IncludeDeletions | SkipDeletions
1423
deriving Eq
1524

0 commit comments

Comments
 (0)