@@ -92,33 +92,34 @@ spec = do
92
92
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany" ))
93
93
let opts = DocumentFormattingParams doc (FormattingOptions 4 True ) Nothing
94
94
ResponseMessage _ _ (Just edits) _ <- request TextDocumentFormatting opts
95
- liftIO $ edits `shouldBe` [TextEdit (Range (Position 0 0 ) (Position 3 0 ))
96
- " foo :: Int -> String -> IO ()\n foo x y = do\n print x\n return 42 \n " ]
95
+ liftIO $ edits `shouldBe` [TextEdit (Range (Position 0 0 ) (Position 5 0 ))
96
+ " module BrittanyLF where \n\n foo :: Int -> String -> IO ()\n foo x y = do\n print x\n return () \n " ]
97
97
98
98
it " formats a document with CRLF endings" $ runSession hieCommand fullCaps " test/testdata" $ do
99
99
doc <- openDoc " BrittanyCRLF.hs" " haskell"
100
100
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany" ))
101
101
let opts = DocumentFormattingParams doc (FormattingOptions 4 True ) Nothing
102
102
ResponseMessage _ _ (Just edits) _ <- request TextDocumentFormatting opts
103
- liftIO $ edits `shouldBe` [TextEdit (Range (Position 0 0 ) (Position 3 0 ))
104
- " foo :: Int -> String -> IO ()\n foo x y = do\n print x\n return 42 \n " ]
103
+ liftIO $ edits `shouldBe` [TextEdit (Range (Position 0 0 ) (Position 5 0 ))
104
+ " module BrittanyCRLF where \n\n foo :: Int -> String -> IO ()\n foo x y = do\n print x\n return () \n " ]
105
105
106
106
it " formats a range with LF endings" $ runSession hieCommand fullCaps " test/testdata" $ do
107
107
doc <- openDoc " BrittanyLF.hs" " haskell"
108
108
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany" ))
109
- let range = Range (Position 1 0 ) (Position 2 22 )
109
+ let range = Range (Position 3 0 ) (Position 5 22 )
110
110
opts = DocumentRangeFormattingParams doc range (FormattingOptions 4 True ) Nothing
111
111
ResponseMessage _ _ (Just edits) _ <- request TextDocumentRangeFormatting opts
112
- liftIO $ edits `shouldBe` [TextEdit (Range (Position 1 0 ) (Position 3 0 ))
113
- " foo x y = do\n print x\n return 42 \n " ]
112
+ liftIO $ edits `shouldBe` [TextEdit (Range (Position 3 0 ) (Position 6 0 ))
113
+ " foo x y = do\n print x\n return () \n " ]
114
114
115
115
it " formats a range with CRLF endings" $ runSession hieCommand fullCaps " test/testdata" $ do
116
116
doc <- openDoc " BrittanyCRLF.hs" " haskell"
117
- let range = Range (Position 1 0 ) (Position 2 22 )
117
+ sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany" ))
118
+ let range = Range (Position 3 0 ) (Position 5 22 )
118
119
opts = DocumentRangeFormattingParams doc range (FormattingOptions 4 True ) Nothing
119
120
ResponseMessage _ _ (Just edits) _ <- request TextDocumentRangeFormatting opts
120
- liftIO $ edits `shouldBe` [TextEdit (Range (Position 1 0 ) (Position 3 0 ))
121
- " foo x y = do\n print x\n return 42 \n " ]
121
+ liftIO $ edits `shouldBe` [TextEdit (Range (Position 3 0 ) (Position 6 0 ))
122
+ " foo x y = do\n print x\n return () \n " ]
122
123
123
124
-- ---------------------------------
124
125
0 commit comments