Merlin_analysis.DestructSourceDestruct at the moment works in two contexts:
e under the cursor with match e with
| p1 -> _
| ...This matching will be exhaustive.
If e has a "package" type, it will be replaced by let module M = (val e) in _
* * *
Final remarks:
Pprintast which will print things like: { Module.label1 = label1 ; Module.label2 = label2} where one would rather have { Module.label1 ; label2 }. Since qualifying one label is less annoying than rewriting the whole pattern, we decided to note qualify labels (understanding that the code inserted by merlin in the buffer will sometimes be wrong).val node :
Merlin_kernel.Mconfig.t ->
Merlin_kernel.Msource.t ->
Merlin_specific.Browse_raw.node ->
Merlin_specific.Browse_raw.node list ->
Ocaml_parsing.Location.t * stringnode ~env parents current_node returns a location indicating which portion of the buffer must be replaced and the string to replace it with.