Support verbosity=smart
What the PR does
Implements support for verbosity=smart.
Note: I tried to keep changes for adding verbosity=smart minimal.
Includes a couple of clean ups, I can remove them from this PR if necessary.
Also includes a fix for: The format for MERLIN_LOG env var is different in two places in merlin new_merlin.ml and ocamlmerlin_server.ml -- MERLIN_LOG= filename{,section}* or filename
Note: I noticed that a part of functions in Type_utils use the global mutable verbosity as a way to avoid passing verbosity as an argument along the call hierarchy, another half - passed verbosity around. I could perhaps fix this if there is clear preference. It also seems slightly more involved change than this one.
Reviewing
It is best to go commit-by-commit.
In the end, it looks quite good on the ocaml-lsp's side:

Can I jump on the current reviews train? :D
Can I jump on the current reviews train? :D
Sorry, it will have to be after the imminent release.
I am curious: is that already in-use in OCaml-lsp ?
I am curious: is that already in-use in OCaml-lsp ?
Unfortunately not, but it should be
cc @rgrinberg
We can experiment with this patch in lsp first if you'd like, but it needs to be a lot smaller. For starters, get rid of all nonessential changes to ease the maintenance.
Our priority right now is the release but I can have a look shortly after if the goal is to have it upstreamed to not rely on another ocaml-lsp side's patch.
Indeed that’s the goal.
On Mon, 22 Nov 2021 at 16:01, Ulysse @.***> wrote:
Our priority right now is the release but I can have a look shortly after if the goal is to have it upstreamed to not rely on another ocaml-lsp side.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ocaml/merlin/pull/1374#issuecomment-975615630, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4YR67EBXTVWZFEV2AQ6BTUNJLM7ANCNFSM5BCN65QA .
@ulugbekna could you move the clean-ups/refactoring parts of the PR to another one as you suggested ?
I hope to do so this week :-)
On Tue, 30 Nov 2021 at 18:38, Ulysse @.***> wrote:
@ulugbekna https://github.com/ulugbekna could you move the clean-ups/refactoring parts of the PR to another one as you suggested ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ocaml/merlin/pull/1374#issuecomment-982865623, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4YR65C5JWZECTOXMPLRULUOUD2NANCNFSM5BCN65QA .
Thanks for a prompt review! Addressed all comments
We also need to update the protocol documentation: https://github.com/ocaml/merlin/blob/master/doc/dev/PROTOCOL.md#type-enclosing--position-position---expression-string----cursor-int----index-int-
but that document doesn't mention -verbosity at all?
but that document doesn't mention
-verbosityat all?
🧐 looks like a great opportunity to do it 😅
In another PR perhaps?