Closed flash-gordon closed 6 years ago
Which editor are you using? If you are using LSP (or other plugins for Reason), I believe most of them all use the old protocol, which is a totally different code path. I'm curious which editor/IDE you're using that is using this new protocol (single/server).
@jordwalke I'm using spacemacs but it doesn't look related since the error I was able to track down is a segfault. I checked the same version of tools on ubuntu and it worked fine, that is returned the output. Another proof is if I install ocaml 4.06.1, the latest available from homebrew, and get merlin 3.0.5 with opam it works
$ which ocamlmerlin
/Users/gordon/.opam/system/bin/ocamlmerlin
$ echo "" | ocamlmerlin single errors
{"class":"return","value":[],"notifications":[],"timing":{"total":0.7850000000000001,"query":0.0379999999999967,"reader":0.051999999999997826,"ppx":0.03300000000000303,"typer":0.6570000000000018,"error":0.005000000000000782}}
So my guess something's wrong with the binary, maybe ocaml version or something, not an expert here. What comes to spacemacs, it detects where the merlin binary sits and based on that loads the merlin extension for emacs, here's the setup
(let* ((refmt-bin (or (shell-cmd "refmt ----where")
(shell-cmd "which refmt")))
(merlin-bin (or (shell-cmd "ocamlmerlin ----where")
(shell-cmd "which ocamlmerlin")))
(merlin-base-dir (when merlin-bin
(replace-regexp-in-string "bin/ocamlmerlin$" "" merlin-bin))))
;; Add npm merlin.el to the emacs load path and tell emacs where to find ocamlmerlin
(when merlin-bin
(add-to-list 'load-path (concat merlin-base-dir "share/emacs/site-lisp/"))
(setq merlin-command merlin-bin))
(when refmt-bin
(setq refmt-command refmt-bin)))
(setq merlin-ac-setup t)
Yes this is an issue with the reason-cli release of merlin (which is ahead of 3.0.5) when used on Mac when used with the new merlin protocol. All of those together are the conditions for segfault. Fred is pushing a fix and I can then update Reason-cli, but there’s one more staleness issue I’d like to see resolved in merlin before making another release. @let-def
@jordwalke just wondering, what issue are you waiting for? https://github.com/ocaml/merlin/issues/786 this one?
@flash-gordon Yes, but Fred has fixed it and I'm just testing it to make sure it's solid before cutting a new release of reason-cli.
If you're using an esy
native project, you can just include this in you package.json
:
"devDependencies": {
"@esy-ocaml/merlin": "3.0.5004",
"ocaml": "~4.6.0"
}
That's the npm published esy native release of merlin's master branch.
@jordwalke I don't use reason for native development so I installed ocaml 4.02.3 and merlin 3.0.5 via opam. Works fine so far :)
Okay, but be warned there are issues with mixing npm and opam for global installs. If you experience problems please include that bit of information when describing any other issues.
This is affecting me too - emacs using reason-mode on High Sierra 10.13.4 with reason-cli 3.1.0 Would love this working in the editor with a new release. Thanks for all the work you all have done on this!
Upgraded to the recently released reason-cli 3.2.0
and this is fixed for me there. Thanks!
I can confirm the issue is solved in 3.2.0, thanks everyone involved. Closing.
Glad to hear it!
I'm running into this error as well, unclear on how to proceed:
OSX High Sierra:
reason-cli@3.2.0
$ yarn global list
yarn global v1.7.0
info "reason-cli@3.2.0-darwin" has binaries:
- reason-cli-sandbox
- ocamlmerlin
- ocamlmerlin-reason
- rtop
- utop
- refmt
- refmttype
- reactjs_jsx_ppx_v2
- reactjs_jsx_ppx_v3
Correct merlin:
$ which ocamlmerlin
/Users/s/.nvm/versions/node/v8.5.0/bin/ocamlmerlin
$ ocamlmerlin -version
The Merlin toolkit version next, for Ocaml 4.02.3
And the same error:
$ echo "" | ocamlmerlin server errors
{"class": "failure", "value": "abnormal termination", "notifications": [] }
abnormal termination
merlin path: /Users/s/.nvm/versions/node/v8.5.0/lib/node_modules/reason-cli/3______________________/i/esy_ocaml__slash__merlin-3.0.5003-4cb5d7b5/bin/ocamlmerlin-server
socket path: /var/folders/39/47_0ln1n3q31k_p7zf4cq8l80000gq/T//ocamlmerlin_503_16777220_8601373895.socket
I have a relatively fresh macOS installation (High SIerra, 10.13.3) with
reason-cli 3.1.0
, for meocamlmerlin
fails with a segfault:Using
server
modeBasically, I can't get it working so I had to roll back to
reason-cli
3.0.5 which usesmerlin
2.5.4 compared to 3.1.0 relying on 3.0.5 (https://github.com/reasonml/reason-cli/commit/0ed26dd9409760036b741f4bdb430e659b027daf, https://www.npmjs.com/package/@esy-ocaml/merlin).