vscode-ocaml icon indicating copy to clipboard operation
vscode-ocaml copied to clipboard

Merlin fails only on VS Code

Open AntouanK opened this issue 9 years ago • 7 comments

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.

AntouanK avatar Jan 25 '17 12:01 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?

AntouanK avatar Jan 25 '17 12:01 AntouanK

You can open the developer tool of vscode, and then check process.env on the console to see what env vscode recognised

hackwaly avatar Jan 25 '17 14:01 hackwaly

You can use opam setup the shell init script. I remember it works

hackwaly avatar Jan 25 '17 14:01 hackwaly

Interesting... Seems like the shell is correct, but the environment variables are entirely different.

Opening VS Code normally screen shot 2017-01-25 at 15 03 15

Opening VS Code from a zsh session ( with open -a "Visual Studio Code" ) screen shot 2017-01-25 at 15 03 47

AntouanK avatar Jan 25 '17 15:01 AntouanK

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

eimpec avatar Jan 25 '17 15:01 eimpec

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.

hackwaly avatar Jan 26 '17 04:01 hackwaly

@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.

hackwaly avatar Feb 03 '17 03:02 hackwaly