aboutsummaryrefslogtreecommitdiff
path: root/ide
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2020-03-30 16:03:37 +0200
committerPierre-Marie Pédrot2020-03-30 16:05:50 +0200
commite6d0c2d24acaa5d8470d36a9173f141000126952 (patch)
treed54d728964c34f1e5608c7e60941c0fd45c1554f /ide
parentd2f21a119fea99d8621fb227b82fa8a1bf17d9fb (diff)
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.
Diffstat (limited to 'ide')
-rw-r--r--ide/wg_Completion.ml12
1 files changed, 11 insertions, 1 deletions
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 =