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

Generate .merlin files with eliom-distillery #532

Open
shonfeder opened this issue Nov 5, 2017 · 6 comments
Open

Generate .merlin files with eliom-distillery #532

shonfeder opened this issue Nov 5, 2017 · 6 comments
Assignees

Comments

@shonfeder
Copy link
Contributor

I've been creating a series of small test projects as a way of working out my understanding of different concepts. Each time, I end up creating the same .merlin file:

PKG ocsigenserver
PKG ocsigen-toolkit

PKG eliom
PKG eliom.client

PKG ppx_deriving
PKG eliom.ppx
PKG eliom.ppx.server
PKG eliom.ppx.client

S _client
S _server

B _client
B _server

(I've worked out this combination mostly by trial and error, so it's possible there are some redundancies...).

It strikes me that the generation of this kind of boilerplate is what templates and project initialization are built for, so it should/could arguably be included in the basic template, or in an alternate basic template.

I thought this was worth an issue, so I could feel-out whether a contribution along these lines would be welcome, or if it perhaps comes in conflict with some development principles (maybe it would be better for me to just make my own template?). Additionally, if there are short-term plans to switch eliom projects over to jbuilder, this kind of trivial feature would be obviated.

If, on the other hand, any maintainer thinks this would be a welcome contribution, I'd be pleased to make a PR for it.

@loxs
Copy link

loxs commented Aug 8, 2018

Does this mean that indeed merlin should work for eliom projects with this setup?

@vasilisp
Copy link
Contributor

vasilisp commented Aug 8, 2018

Not exactly. Merlin does not understand the client/server structure of Eliom programs. I guess that a .merlin like the above can enable some of the functionality of Merlin, but with an over-approximation of what is available in each context.

@loxs
Copy link

loxs commented Aug 8, 2018

What does it mean in practical terms? That it "randomly" will not work for parts of the code?

@aryx
Copy link

aryx commented Sep 15, 2020

This is still not fixed? How can I use merlin with eliom projects? Not being able to quickly
go to the definition of a library function is seriously hurting my productivity.

@Zzull
Copy link
Contributor

Zzull commented Sep 22, 2020

It is not possible to have Merlin understand the structure of an eliom file made of both client and server parts. Nevertheless, it is still possible to have Merlin only consider the server parts of your files. Here is an example of configuration that is more or less satisfying:

PKG lwt_ppx
PKG eliom.server
PKG eliom.ppx.server
PKG ppx_deriving.show
PKG ppx_deriving.ord
PKG ppx_deriving.sexp
PKG ocsigen-toolkit.server
PKG ocsigen-start.server
PKG pgocaml_ppx

SUFFIX .eliom .eliomi

S .

B _server

Note again that this configuration will entirely skip the client part of your eliom files. Moreover, it is not possible to switch to the client version of this configuration. Once the server parts have been compiled, eliomc hands over to js_of_eliom the type annotations of variables defined on the server side and used on the client side. Currently, Merlin cannot be made aware of the existence of those type annotations

@aryx
Copy link

aryx commented Sep 23, 2020

My main issue is that even though I can get type definition when I hover some code, I can't go to the definition of library functions
because the OPAM eliom package does not come with the .cmt files or .mli files.
Here is an example of error returned by merlin: Eliom_registration.App' seems to originate from 'Eliom_registration' whose MLI file could not be found

This is easy to fix. Just bundle the .mli and .cmt in the installed package. I've created a separate issue for that but nobody answered ... Honestly this project looks a bit dead. See #649

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants