You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As stated in issue #1227, short-paths usually gives weird behaviors for code using type aliases.
In the OCaml compiler, this issue can sometimes be mitigated by not using the -short-paths option to force displaying full paths in error messages. Such types are usually longer but at least they are similar to the declared function signature.
With OCaml LSP, such a mitigation seems inaccessible with the current implementation. The -short-path option is always enabled by default. If I understand correctly, passing the real_path option to the underlying Merlin should disable this path shortening and give a behavior that is similar to the compiler without the -short-paths option.
Ideally, I would like to be able to use OCaml LSP with Merlin in real_paths mode for some projects, and in the current short_paths mode for others.
The text was updated successfully, but these errors were encountered:
If you use Dune then it passes the build flags to Merlin / LSP. This means that removing short paths from the standard ocaml flags set might allow you to disable the feature. It can be done in dune and dune-workspace files:
(env
(_
(flags ((:standard \ -short-paths)))))
It remains to be checked that short-paths is the issue here.
typenat = intletincr : int -> int = (+) 1let()=
ignore (incr true)
dune build gives the intended Error: This expression has type bool but an expression was expected of type int.
However, OCaml LSP writes This expression has type bool but an expression was expected of type nat in the error list.
As stated in issue #1227, short-paths usually gives weird behaviors for code using type aliases.
In the OCaml compiler, this issue can sometimes be mitigated by not using the
-short-paths
option to force displaying full paths in error messages. Such types are usually longer but at least they are similar to the declared function signature.With OCaml LSP, such a mitigation seems inaccessible with the current implementation. The
-short-path
option is always enabled by default. If I understand correctly, passing thereal_path
option to the underlying Merlin should disable this path shortening and give a behavior that is similar to the compiler without the-short-paths
option.Ideally, I would like to be able to use OCaml LSP with Merlin in
real_paths
mode for some projects, and in the currentshort_paths
mode for others.The text was updated successfully, but these errors were encountered: