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