* [Caml-list] What is the idiomatic way to invoke Merlin (from Ocaml)?
@ 2018-03-22 8:54 Matej Košík
0 siblings, 0 replies; only message in thread
From: Matej Košík @ 2018-03-22 8:54 UTC (permalink / raw)
To: OCaml Mailing List
Hi,
If I have an Ocaml program that would like to take advantage of the services that Merlin provides.
What is the idiomatic/recommended way to interact with it from inside of an Ocaml program?
At the moment, I have a code that works
(I execute "ocamlmerlin" binary;
I gather its stdandard output;
I use "yojson" to parse this output;
I traverse the JSON soup and find the pieces I want)
but after finishing it, I is "unpretty".
What should I do to make it more "pretty"?
Is it absolutely necessary for me to deal with JSON instead of native Ocaml?
Should I investigate a more seamless Ocaml/JSON mapping?
(JSON may make sense in many scenarios, but in my cases, these are just two Ocaml programs talking).
Or is there a way to cut JSON completely out of the interation and let my program talk to Merlin in Ocaml (and get back Ocaml values)?
Concretely, if I have a question:
Here is the file; here is the position of an identifier; where is it defined?
I would get (e.g.) value of type (e.g.) "Lexing.position" instead of:
{
"class": "return",
"notifications": [],
"timing": {
"error": 0.0,
"ppx": 0.0,
"query": 0.0,
"reader": 0.0,
"total": 0.0,
"typer": 0.0
},
"value": {
"file": "/some/absolute/path/to/test.ml",
"pos": {
"col": 0,
"line": 2
}
}
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-03-22 8:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-22 8:54 [Caml-list] What is the idiomatic way to invoke Merlin (from Ocaml)? Matej Košík
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox