onivim / oni2

Native, lightweight modal code editor
https://v2.onivim.io
MIT License
7.84k stars 282 forks source link

No Reason/OCaml autocompletes or hovers #1946

Closed jplew closed 4 years ago

jplew commented 4 years ago

Hello, it seems my Reason language support is not working. I am getting useful autocomplete suggestions and mouse hovers when editing js and ts files, but have no such support for ml or re files. For example, when I type Console.l, nothing happens.

The reason-vscode plugin appears to be loading fine: image

In contrast, autocompletion works fine in VS Code (with the reason-vscode plugin installed), when I open the same Reason project there.

I tried using my own reason-language-server and linking it manually in the configuration.json (following these instructions: https://github.com/jaredly/reason-language-server#onivim), but no dice:

"language.reason.languageServer.command": "/usr/local/bin/reason-language-server",

I'm using the the latest build (#86aa3de7) on Mac OS 10.15.5.

bryphe commented 4 years ago

Hi @jplew ,

Thanks for logging the issue!

What kind of project is this - is it a bucklescript project (ie, using bsb) or a reason native project (ie, using esy)? Is it an open source project that I can try and reproduce on?

One common issue is not having the sources built - but the fact that it is working in VSCode but not in Onivim rules this out.

jplew commented 4 years ago

I experience this problem in both types of projects.

It fails for git clone https://github.com/esy-ocaml/hello-reason.git and bsb -init my-new-project -theme basic-reason.

Now that I think about it, the problem is probably not in Onivim. I suspect the problem lies in the reason-vscode extension, related to this issue: https://github.com/jaredly/reason-language-server/issues/248

The reason being, the extension actually fails in VS Code (occasionally, with certain kinds of projects) with this error: Could not run compiler (ran /Users/jplew/.opam/4.09.0/bin/ocamlopt.opt -version).

That ocamlopt.opt does not exist at that location. Since I used Homebrew to install opam, the compiler lives here: /usr/local/Cellar/ocaml/4.09.0/bin/ocamlopt.opt.

If you agree I'll close this and file the bug there.

bryphe commented 4 years ago

Thanks for the update @jplew !

Now that I think about it, the problem is probably not in Onivim. I suspect the problem lies in the reason-vscode extension, related to this issue: jaredly/reason-language-server#248

Interesting... I've had good luck with ocaml-lsp in both types of projects. It's a bit pain to set up for bucklescript (but doable with these steps)

If you agree I'll close this and file the bug there.

Sure! I started drafting up some documentation on setting up ReasonML/OCaml/BuckleScript integration here: https://github.com/onivim/oni2/blob/master/docs/docs/languages/reason-ocaml.md

Will close this, but let me know if you have any feedback on the docs 👍