From 1e8b0e7865d0a82af1d91ee7577bf6d7271b73de 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 a932a721e..07cbd8ae3 100644 --- a/src/extension_commands.ml +++ b/src/extension_commands.ml @@ -547,6 +547,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 @@ -562,7 +568,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.(