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.(