From e6d0c2d24acaa5d8470d36a9173f141000126952 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Mon, 30 Mar 2020 16:03:37 +0200 Subject: Partial revert of #11817. The completion proposals need to be ordered by length first for usability. I aknowledge that it's too easy to mess up when refactoring, but here there was a clear comment that this change should not have been performed. --- ide/wg_Completion.ml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ide') diff --git a/ide/wg_Completion.ml b/ide/wg_Completion.ml index a7f8c70499..dcb71d96a1 100644 --- a/ide/wg_Completion.ml +++ b/ide/wg_Completion.ml @@ -8,7 +8,17 @@ (* * (see LICENSE file for the text of the license) *) (************************************************************************) -module Proposals = CString.Set +module StringOrd = +struct + type t = string + let compare s1 s2 = + (* we use first size, then usual comparison *) + let d = String.length s1 - String.length s2 in + if d <> 0 then d + else compare s1 s2 +end + +module Proposals = Set.Make(StringOrd) (** Retrieve completion proposals in the buffer *) let get_syntactic_completion (buffer : GText.buffer) pattern accu = -- cgit v1.2.3