-
Notifications
You must be signed in to change notification settings - Fork 79
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
Per-project opam switch autodetection #199
Comments
It is not that simple: |
Thanks very much for the info - it looks like Am I correct in saying that manually calling One other possible enhancement would be to allow setting of the Ideally perhaps Thanks for taking the time to respond this has been very enlightening! |
Reopening as a reminder to develop per repo build environment — with caching. |
I'm not convinced that tuareg is the right place to do this stuff anymore. The LSP mode for OCaml should be aware of all of this stuff and work far smoother than whatever hacks we pile up in Elisp. IMO tuareg should stick to the functionality that can't be provided via LSP. |
@rgrinberg May you point some doc about LSP? |
@rgrinberg Were you referring to https://github.com/freebroccolo/ocaml-language-server or to some other work? |
(Incidentally there is already a package for Emacs.) |
(Incidentally there is already a [package for Emacs](https://github.com/emacs-lsp/lsp-mode).)
Actually two: http://elpa.gnu.org/packages/eglot.html
|
Well, I think it's merlin itself that has the most functional lsp server for OCaml at the moment. But actually, I think I should retract my comment. The LSP server should probably be launched in the correct environment (sandbox), it probably shouldn't be aware of switches, esy sandboxes, etc. So I think I'm in favor of this PR after all |
I came across this issue when I am looking for a way to detect local opam switch automatically. After setting
A related question is that, though |
Now that
opam
allows you to create 'directory' switches (e.g.opam switch create .
) for a particular project, it would be great if we could detect the presence of an_opam
directory for a particular project, and automatically calltuareg-update-opam-env
to use that switch (or a similar function that sets a buffer-local exec-path), so that tooling works correctly across files that may use e.g. different OCaml versions.Currently I put a
.dir-locals.el
file in each project with this line:((tuareg-mode . ((eval . (tuareg-opam-update-env (projectile-project-root))))))
which works pretty well, but it'd be awesome if tuareg could detect this automatically, recursively searching up the file tree for an
_opam
folder.Does this sound like a sensible approach, or am I just out of the ordinary in terms of the way I use switches? To me this would be more in line with the way things work in other language ecosystems, where tools are looked for on a project-local basis.
Would appreciate any feedback - if this sounds reasonable I'll try and take a look at implementing the functionality.
The text was updated successfully, but these errors were encountered: