Merlin fails only on VS Code
Started using bucklescript yesterday, and the ocaml plugin in VSCode has a weird behaviour.
Initially, when I got merlin, autocomplete worked fine. Once I started working on examples on bucklescript, I noticed merlin didn't work anymore.
I checked it with vim, and I had problems there as well, but they were fixed.
https://github.com/ocaml/merlin/issues/617
So right now, merlin in vim works perfectly.
Also, I checked that ocamlmerlin and ocp-indent are available in the PATH and they work as expected.
Still, in VSCode merlin doesn't work at all.
Any help on how to debug this?
Thank you.
Seems like the problem is that I use zsh as my main shell, and my PATH is defined in .zshrc.
If I launch VSCode manually from a zsh shell, merlin works.
So where can I put PATH so that VSCode can read it?
You can open the developer tool of vscode, and then check process.env on the console to see what env vscode recognised
You can use opam setup the shell init script. I remember it works
Interesting... Seems like the shell is correct, but the environment variables are entirely different.
Opening VS Code normally

Opening VS Code from a zsh session ( with open -a "Visual Studio Code" )

I have somewhat similar issue with merlin failing on VSCode. It fails only with the file which uses js_of_ocaml ## syntax. When I start hovering the mouse over expressions, after few successful attempts the hover modal just starts showing "Loading..." and the CPU usage of merlin jumps to 100% until the process is killed. Other files seems to be working just fine. See the merlin log attached merlin.txt The link to the actual file: https://github.com/bobatkey/ocamlmvc/blob/master/OCamlMVC.ml
Sorry for the late response. Now it is the Spring Festival in China, I have not enough time to address this issue. I'll work for the bucklescript and js_of_ocaml support later.
@AntouanK
Seems like the problem is that I use zsh as my main shell, and my PATH is defined in .zshrc. If I launch VSCode manually from a zsh shell, merlin works.
So where can I put PATH so that VSCode can read it?
I've tested on my mac that zsh works well. All env defined in ~/.zshrc works fine. Maybe you've config vscode incorrectly. I found some clues: https://github.com/Microsoft/vscode/issues/10500.
If your vscode can't get right env, It's an issue of vscode and I can help less.