Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install .merlin files #3276

Closed
copy opened this issue Mar 18, 2020 · 5 comments
Closed

Install .merlin files #3276

copy opened this issue Mar 18, 2020 · 5 comments

Comments

@copy
Copy link

@copy copy commented Mar 18, 2020

Desired Behavior

dune should install .merlin files so that jump to definition works from files installed in ~/.opam/…/lib.

Example

  • Open ~/.opam/4.10.0/lib/core_kernel/list.ml in vim/emacs with merlin
  • Try MerlinLocate on any module
@DouglasGray

This comment has been minimized.

Copy link

@DouglasGray DouglasGray commented Mar 18, 2020

Just to illustrate where this might be useful with an example, if I have the below in a file in my Dune project:

(* my_project_file.ml *)
let _ = Async.with_timeout

Then I can jump to Async.with_timeout ok. However it turns out this definition is re-exported and defined as:

(* async_unix.ml *)
let with_timeout = Clock.with_timeout

And jumping directly to Clock.with_timeout is not currently possible, though it would be very handy.

@diml

This comment has been minimized.

Copy link
Member

@diml diml commented Mar 19, 2020

That's a valid request, however it seems to me that the information contained in these .merlin files would simply duplicate the one available in META and dune-package files.

Since there is a work in progress (ocaml/RFCs#7) to standardise the way libraries are installed and the way library dependencies are stored, it seems to me that we should just wait for that.

@ygrek

This comment has been minimized.

Copy link

@ygrek ygrek commented Mar 25, 2020

installing .merlin files sounds like a quick fix without any downsides that works immediately without any large-scale changes to the infrastructure?

@rgrinberg

This comment has been minimized.

Copy link
Member

@rgrinberg rgrinberg commented Mar 25, 2020

installing .merlin files sounds like a quick fix without any downsides that works immediately without any large-scale changes to the infrastructure?

Not quite. We'll need to generate a separate set of merlin files that don't refer to directories in _build. If you'd like to work on that as a temporary stop gap, you're welcome to do it. I'd prefer to work on a longer term solution with our limited resources.

@diml

This comment has been minimized.

Copy link
Member

@diml diml commented Mar 30, 2020

I thought a bit more about this. To make this a general feature, we'd need to handle ppx rewriters and other preprocessors. More generally, we'd need to setup install directories so that they can be built from source. Not only this is not currently their purpose, but it also opens the door to a stream of complications I'm not particularly excited about.

For this reason, dune will not install .merlin files.

However, it is very easy with dune to "drop" the sources of your dependencies in your workspace. And in this case, merlin will work well on your dependencies. I believe esy also support installing the _build directory for the exact same purpose. That might be another direction to look at.

@diml diml closed this Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.