Skip to content

Commit

Permalink
fix: the [issue](haskell#3847)
Browse files Browse the repository at this point in the history
  • Loading branch information
BurningLutz committed Oct 26, 2023
1 parent c0f7d4c commit 5415382
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion hls-plugin-api/src/Ide/PluginUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,13 @@ usePropertyLsp kn pId p = do
extractTextInRange :: Range -> T.Text -> T.Text
extractTextInRange (Range (Position sl sc) (Position el ec)) s = newS
where
focusLines = take (fromIntegral $ el - sl + 1) $ drop (fromIntegral sl) $ T.lines s
-- NOTE: Always append an empty line to the end to ensure there are
-- sufficient lines to take from.
focusLines =
T.lines s
& (++ [""])
& drop (fromIntegral sl)
& take (fromIntegral $ el - sl + 1)
-- NOTE: We have to trim the last line first to handle the single-line case
newS =
focusLines
Expand Down

0 comments on commit 5415382

Please sign in to comment.