Coder Social home page Coder Social logo

Comments (15)

aeruhxi avatar aeruhxi commented on July 20, 2024 1

The problem turned out to be the environment (I opened vscode with dmenu) vscode was running on did not have them on PATH. Everything works fine when I opened vscode from the terminal. Thanks for taking your time.

from vscode-reasonml.

 avatar commented on July 20, 2024

I'm not sure what is causing that without more information about how your project is set up. Do you have merlin installed local to the project?

from vscode-reasonml.

aeruhxi avatar aeruhxi commented on July 20, 2024

I have following settings set up in user settings

"reason.path.ocamlmerlin": "/home/absolutezero/.opam/4.03.0/bin/ocamlmerlin",
"reason.path.refmt": "/home/absolutezero/.opam/4.03.0/bin/refmt",
"reason.path.rtop": "/home/absolutezero/.opam/4.03.0/bin/rtop",
"reason.formatOnSave": true

from vscode-reasonml.

aeruhxi avatar aeruhxi commented on July 20, 2024

How do I install merlin locally to the project?

from vscode-reasonml.

aeruhxi avatar aeruhxi commented on July 20, 2024

I cloned this project: https://github.com/reasonml/ReasonNativeProject
It already has .merlin.

from vscode-reasonml.

 avatar commented on July 20, 2024

I cloned this project: https://github.com/reasonml/ReasonNativeProject
It already has .merlin.

Can you try unsetting the user settings you mentioned above? As long as your PATH is set up correctly you shouldn't need to use them unless you have some custom versions or something. If you don't override them, the reason mode should use the ocamlmerlin binary that is installed when you set up the dependencies with npm or whatever.

from vscode-reasonml.

aeruhxi avatar aeruhxi commented on July 20, 2024

I get the following error when I unset those settings
2017-04-16-065619_883x75_scrot

/home/absolutezero/.vscode/extensions/freebroccolo.reasonml-0.0.99/node_modules/ocaml-language-server/out/src/server/processes/merlin.js:25
                throw error;
                ^

Error: spawn ocamlmerlin ENOENT
    at exports._errnoException (util.js:1026:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:359:16)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
[Error - 6:58:42 AM] Connection to server got closed. Server will not be restarted.

But ocamlmerlin should be in PATH as

$ which ocamlmerlin
/home/absolutezero/.opam/4.03.0/bin/ocamlmerlin

from vscode-reasonml.

 avatar commented on July 20, 2024

How do you have your shell environment setup? How did you install opam? For whatever reason, when node tries to spawn ocamlmerlin, the binary is not in the path.

from vscode-reasonml.

aeruhxi avatar aeruhxi commented on July 20, 2024

I installed opam with what opam's website instructs to do:

wget https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh -O - | sh -s /usr/local/bin

And for reason, I installed it with opam install reason.

from vscode-reasonml.

 avatar commented on July 20, 2024

Maybe opam is not being initialized properly (and thus not setting the path) for new shells in some cases. Do you get the same output from the following commands?

sh -c ocamlmerlin
sh -cl ocamlmerlin

from vscode-reasonml.

aeruhxi avatar aeruhxi commented on July 20, 2024

Yes

from vscode-reasonml.

 avatar commented on July 20, 2024

Oops, those commands should have run ocamlmerlin instead of opam. Can you try that? It probably won't make a difference but still…

I think the opam installer script should have either modified one of your shell init scripts or asked you to modify it manually. Do you see that somewhere in like ~/.profile or ~/.bash_profile or maybe one of the zsh files if you use that?

The only thing I can really think of is that there's some sort of misconfiguration with how the shell is initializing the opam stuff but it's hard to pinpoint from a distance.

from vscode-reasonml.

aeruhxi avatar aeruhxi commented on July 20, 2024

sh -c ocamlmerlin runs off. But the other one:

$ sh -cl ocamlmerlin
sh: ocamlmerlin: command not found

Also in my .zshrc, the following line has been added.

. /home/absolutezero/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true

from vscode-reasonml.

 avatar commented on July 20, 2024

. /home/absolutezero/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true

It's a long shot but you could try moving this to ~/.zshenv instead and seeing if that helps. I think with ~/.zshrc opam may only be initializing the path for login shells which could explain why it's failing for node but not when you try it manually.

from vscode-reasonml.

aeruhxi avatar aeruhxi commented on July 20, 2024

Not working πŸ™

from vscode-reasonml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.