this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improve completion order

+17 -15
-1
src/example/dune
··· 7 7 code-mirror 8 8 merlin-js.code-mirror)) 9 9 10 - 11 10 (copy_files 12 11 (mode promote) 13 12 (files worker/merlin_worker.bc.js))
+17 -14
src/extension/merlin_codemirror.ml
··· 23 23 |> Array.of_list 24 24 25 25 let keywords = List.map 26 - (fun label -> Autocomplete.Completion.create ~label ~type_:"keyword" ()) 27 - [ 28 - "as"; "do"; "else"; "end"; "exception"; "fun"; "functor"; "if"; "in"; 29 - "include"; "let"; "of"; "open"; "rec"; "struct"; "then"; "type"; "val"; 30 - "while"; "with"; "and"; "assert"; "begin"; "class"; "constraint"; 31 - "done"; "downto"; "external"; "function"; "initializer"; "lazy"; 32 - "match"; "method"; "module"; "mutable"; "new"; "nonrec"; "object"; 33 - "private"; "sig"; "to"; "try"; "value"; "virtual"; "when"; 34 - ] 26 + (fun label -> 27 + Autocomplete.Completion.create ~label ~type_:"keyword" ()) 28 + [ 29 + "as"; "do"; "else"; "end"; "exception"; "fun"; "functor"; "if"; "in"; 30 + "include"; "let"; "of"; "open"; "rec"; "struct"; "then"; "type"; "val"; 31 + "while"; "with"; "and"; "assert"; "begin"; "class"; "constraint"; 32 + "done"; "downto"; "external"; "function"; "initializer"; "lazy"; 33 + "match"; "method"; "module"; "mutable"; "new"; "nonrec"; "object"; 34 + "private"; "sig"; "to"; "try"; "value"; "virtual"; "when"; 35 + ] 35 36 36 37 let merlin_completion worker = fun ctx -> 37 38 let open Fut.Syntax in ··· 41 42 Merlin_client.query_completions worker source (`Offset pos) 42 43 in 43 44 let options = 44 - List.map (fun Query_protocol.Compl.{ name; desc; _ } -> 45 - Autocomplete.Completion.create ~label:name ~detail:desc ()) entries 45 + let num_completions = List.length entries in 46 + List.mapi (fun i Query_protocol.Compl.{ name; desc; _ } -> 47 + let boost = num_completions - i in 48 + Autocomplete.Completion.create ~label:name ~detail:desc ~boost ()) entries 46 49 in 47 - Some (Autocomplete.Result.create ~from ~to_ ~options ()) 50 + Some (Autocomplete.Result.create ~filter:true ~from ~to_ ~options ()) 48 51 49 52 let autocomplete worker = 50 53 let override = [ 51 - Autocomplete.Source.create @@ merlin_completion worker; 52 - Autocomplete.Source.from_list keywords] 54 + Autocomplete.Source.from_list keywords; 55 + Autocomplete.Source.create @@ merlin_completion worker] 53 56 in 54 57 let config = Autocomplete.config () ~override in 55 58 Autocomplete.create ~config ()