# Running OCaml files straight from VS Code

**URL:** https://discuss.ocaml.org/t/running-ocaml-files-straight-from-vs-code/18549
**Category:** Ecosystem
**Tags:** announce
**Created:** [September 21, 2026, 10:39am UTC](https://discuss.ocaml.org/t/running-ocaml-files-straight-from-vs-code/18549 "2026-09-21T10:39:33Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![Tim-ats-d](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/tim-ats-d/32/3268_2.png) [@Tim-ats-d](https://discuss.ocaml.org/u/Tim-ats-d)
#### Post date: [September 21, 2026, 10:39am UTC](https://discuss.ocaml.org/t/running-ocaml-files-straight-from-vs-code/18549/1 "2026-09-21T10:39:33Z")

</div>

Hi everyone, I’m very glad to introduce a new feature in VSCode OCaml Platform in the release [2.4.0](https://github.com/ocamllabs/vscode-ocaml-platform/releases/tag/2.4.0). This work was implemented by [Tarides](https://tarides.com/) and funded by the [OCaml Software Foundation](https://ocaml-sf.org/).

A “Run” button has been added to the editor bench. Clicking it opens a dropdown listing executables discovered in your current workspace. This feature was originally targeted at university professors and students, but it can be useful for everyone to quickly debug.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/ocaml/original/2X/8/84b8051fe4a1db5d9f2c5a263ea8d18294b48d01.jpeg)

The way executables are discovered depends on the workspace setup. If the user uses Dune and has a `dune-project` file at the root of the workspace, we take advantage of Dune API to retrieve the list of defined executables and to launch the chosen executable via a basic `dune exec ./file`. Otherwise, if Dune is not detected as the project builder, the displayed list contains all `.ml` files discovered in the current workspace, and they are executed with the OCaml bytecode interpreter.

Each time an executable is run, its output is displayed in a dedicated VS Code terminal.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/ocaml/original/2X/3/38b71e76fa06b49d5f4c52e2938f08134d4f493d.png)

Feedback and bug reports are very welcome!

---

_[View the full topic](https://discuss.ocaml.org/t/running-ocaml-files-straight-from-vs-code/18549)._
