# VSCode : send snippet to REPL

**URL:** <https://discuss.ocaml.org/t/vscode-send-snippet-to-repl/11298>\
**Category:** Learning\
**Created:** [February 3, 2023, 2:21am UTC](https://discuss.ocaml.org/t/vscode-send-snippet-to-repl/11298 "2023-02-03T02:21:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeroexcuses](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/zeroexcuses/32/1692_2.png) [@zeroexcuses](https://discuss.ocaml.org/u/zeroexcuses)\
**Post date:** [February 3, 2023, 2:21am UTC](https://discuss.ocaml.org/t/vscode-send-snippet-to-repl/11298/1 "2023-02-03T02:21:40Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![mnxn](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/mnxn/32/2445_2.png) [@mnxn](https://discuss.ocaml.org/u/mnxn)\
**Post date:** [February 3, 2023, 8:56pm UTC](https://discuss.ocaml.org/t/vscode-send-snippet-to-repl/11298/2 "2023-02-03T20:56:20Z")

</div>

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.

> **[GitHub - ocamllabs/vscode-ocaml-platform: Visual Studio Code extension for OCaml](https://github.com/ocamllabs/vscode-ocaml-platform#commands)**
>
> Visual Studio Code extension for OCaml. Contribute to ocamllabs/vscode-ocaml-platform development by creating an account on GitHub.
