diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-02-05 06:54:16 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-02-16 04:39:20 +0100 |
commit | 9ba726831b973ae0f57e640f3a0966da0ca1941d (patch) | |
tree | f2839720ff0bfe318be7d48a84dfb96fa624d484 | |
parent | 8ab1b7f70242d3efd74278d15bd5c0c8f2d6d1e2 (diff) |
chore: sort match results by source position
-rw-r--r-- | app/Main.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/Main.hs b/app/Main.hs index 41a546f..479f3b0 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -528,15 +528,16 @@ suggestTags settings probabilityCache doc = do case suggestedTag of S.SuggestTagByRE tagName searchReplaces -> let tagValues = - nub . concat $ + nub . map snd . sortBy (comparing fst) . concat $ map ( \searchReplace -> mapMaybe ( -- XXX Whys is this so complicated? \match -> do - captures <- snd <$> R.matchCaptures match + (topCapture, captures) <- R.matchCaptures match pure - ( foldl + ( topCapture.captureOffset, + foldl ( \template (captureName, captureOrdinal) -> T.replace ("${" <> R.getCaptureName captureName <> "}") |