Skip to content

Commit 22a9339

Browse files
committed
Replace last with unsnoc to fix hlint error
1 parent e5fcadb commit 22a9339

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Handlers.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ import Data.Foldable (toList)
3434
import Data.List (dropWhileEnd,
3535
find,
3636
intercalate,
37-
intersperse)
37+
intersperse,
38+
unsnoc)
3839
import qualified Data.Map as Map
3940
import Data.Maybe (catMaybes)
4041
import Data.String (IsString)
@@ -317,7 +318,7 @@ finalReturn :: Text -> TextEdit
317318
finalReturn txt =
318319
let ls = T.lines txt
319320
l = fromIntegral $ length ls -1
320-
c = fromIntegral $ T.length . last $ ls
321+
c = fromIntegral $ T.length $ maybe T.empty snd (unsnoc ls)
321322
p = Position l c
322323
in TextEdit (Range p p) "\n"
323324

0 commit comments

Comments
 (0)