package merlin-lib

  1. Overview
  2. Docs
Merlin's libraries

Install

dune-project
 Dependency

Authors

Maintainers

Sources

merlin-5.6.1-504.tbz
sha256=cc3c7c01f19a454c96f6bc8a39538023e01042519f001a895fd61488e2b49fb5
sha512=4268a932a8494023699abd98e0d52deb6f201f656863849db230dc8692050e0fe00cc25a50d70e902410f17a27268fd8335c32636f616ef012cf86fc9a43e019

doc/src/merlin-lib.analysis/typed_hole.ml.html

Source file typed_hole.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
let syntax_repr = "_"
let can_be_hole s = String.equal syntax_repr s

(* the pattern matching below is taken and modified (minimally, to adapt the
   return type) from [Query_commands.dispatch]'s [Construct] branch;

   If we directly dispatched [Construct] command to merlin, we'd be doing
   useless computations: we need info whether the expression at the cursor is a
   hole, we don't need constructed expressions yet.

   Ideally, merlin should return a callback [option], which is [Some] when the
   context is applicable. *)
let is_a_hole = function
  | (_, Browse_raw.Module_expr { mod_desc = Tmod_typed_hole; _ }) :: (_, _) :: _
  | (_, Browse_raw.Expression { exp_desc = Texp_typed_hole; _ }) :: _ -> true
  | [] | (_, _) :: _ -> false
;;