VSCode : send snippet to REPL

The XY problem is:

  1. I am editing in VSCode / OCaml
  2. I want to be able to highlight a region of code and send it to the REPL.

What I have so far:

  1. VSCode + OCaml plugin installed.
  2. Inside VSCode, I can hit ctrl-shift-P, and there is an option for “OCaml open REPL”

When I select that option, VSCode opens up a utop.

Questions:

  1. How do I get this utop to load the current OCaml project ?
  2. How do I send OCaml expressions / buffers to this repl ?

Thanks!

The OCaml: Evaluate Selection command will send the selected text to the REPL.
You can also do it by using the Shift+Enter keyboard shortcut.

1 Like