on master help sign in
Merge pull request #4459 from jfdm/fix-repetition-idris-highlight

Fix repetition in Idris Highlights.

commitb64094761c591166b2b0e355bc46247a7608fa13 authorJan de Muijnck-Hughes <jfdm@users.noreply.github.com> dateWed 30 May 2018, 23:01 (8 years ago) parent02f0ec390683e3
1 file changed+6−5
src/Idris/Output.hs+6−5
src/Idris/Output.hs+6−5
@@ -38,7 +38,7 @@ import Prelude hiding ((<$>))
3838
3939import Control.Arrow (first)
4040import Control.Monad.Trans.Except (ExceptT(ExceptT), runExceptT)
41−import Data.List (intersperse, nub)
41+import Data.List (intersperse, nub, nubBy)
4242import Data.Maybe (fromJust, fromMaybe, isJust, listToMaybe)
4343import System.Console.Haskeline.MonadException (MonadException(controlIO),
4444 RunIO(RunIO))
@@ -372,12 +372,12 @@ sendHighlighting highlights =
372372 case idris_outputmode ist of
373373 RawOutput _ -> updateIState $
374374 \ist -> ist { idris_highlightedRegions =
375− highlights ++ idris_highlightedRegions ist }
375+ nubBy canNub $ highlights ++ idris_highlightedRegions ist }
376376 IdeMode n h ->
377377 let fancier = [ toSExp (fc, fancifyAnnots ist False annot)
378− | (fc, annot) <- highlights, fullFC fc
379− ]
380− in case fancier of
378+ | (fc, annot) <- nubBy canNub highlights, fullFC fc
379+ ] in
380+ case fancier of
381381 [] -> return ()
382382 _ -> runIO . hPutStrLn h $
383383 convSExp "output"
@@ -386,6 +386,7 @@ sendHighlighting highlights =
386386
387387 where fullFC (FC _ _ _) = True
388388 fullFC _ = False
389+ canNub (fA,x) (fB,y) = show fA == show fB && x == y
389390
390391-- | Write the highlighting information to a file, for use in external tools
391392-- or in editors that don't support the IDE protocol