From 81ba4b72386a0ce37ec0870587869edf154514a1 Mon Sep 17 00:00:00 2001 From: PizieDust Date: Wed, 23 Oct 2024 12:23:34 +0200 Subject: [PATCH] remove duplicates in series --- src/extension_commands.ml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/extension_commands.ml b/src/extension_commands.ml index 3481f1ee9..1b454f010 100644 --- a/src/extension_commands.ml +++ b/src/extension_commands.ml @@ -550,6 +550,12 @@ module Search_by_type = struct "The installed version of `ocamllsp` does not support type search. %s" msg + let rec remove_duplicates = function + | (a : Custom_requests.Type_search.type_search_result) :: (b :: _ as t) -> + if String.equal a.name b.name && a.cost = b.cost then remove_duplicates t + else a :: remove_duplicates t + | unique -> unique + let get_search_results ~query ~limit ~with_doc ~position text_editor client = let open Promise.Syntax in let doc = TextEditor.document text_editor in @@ -565,7 +571,7 @@ module Search_by_type = struct | [] -> show_message `Info "Empty results"; [] |> Promise.return - | res -> res |> Promise.return + | res -> remove_duplicates res |> Promise.return let display_search_results results = Vscode.(