Skip to content

Commit

Permalink
remove duplicates in series
Browse files Browse the repository at this point in the history
  • Loading branch information
PizieDust committed Oct 23, 2024
1 parent 741de32 commit 81ba4b7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/extension_commands.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.(
Expand Down

0 comments on commit 81ba4b7

Please sign in to comment.