> For the complete documentation index, see [llms.txt](https://docs.varphi-lang.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.varphi-lang.com/vs-code-extension.md).

# VS Code Extension

To make developing Turing Machines easier, we have developed a Varphi language extension for Visual Studio Code. This extension integrates the Varphi interpreter directly into your editor, providing features like syntax highlighting, error checking, and a fully interactive debugger.

### Installation

You can install the language extension via the [Visual Studio Code marketplace](https://marketplace.visualstudio.com/items?itemName=varphi-lang.varphi).

### Features

#### Syntax Highlighting

The extension provides full syntax highlighting for `.vp` files (the recommended file extension for Varphi). Keywords, states, and tuples are color-coded to improve readability and help you visually structure your transition rules.

#### Live Error Reporting

The extension works in the background to validate your code as you type. It reports errors instantly via the **Problems** panel. Errors are underlined with red squiggles, and hovering over them reveals the specific error message from the compiler.

#### One-Click Execution

You don't need to leave the editor to run your code. The extension adds dedicated **Run** and **Debug** buttons to the editor title bar (top right).

* **Run (Play Icon):** Compiles and executes the current file in a dedicated terminal.
* **Debug (Bug Icon):** Starts an interactive debugging session.

When you click **Run**, the extension opens a dedicated "Varphi" terminal and executes your program, keeping your output separate from other terminal processes.

#### Interactive Debugging (DAP)

The extension communicates with the Varphi Interpreter using the **Debug Adapter Protocol (DAP)**, allowing you to debug Varphi programs just like you would debug other languages.

**Providing Tape Inputs**

When you start a debug session, the extension will prompt you to provide initial values for your tapes via an input box at the top of the screen. You can press `Enter` to leave a tape blank, or `Esc` to finish providing inputs.

**Stepping Through Code**

Once the session starts, you can step through your Turing Machine line-by-line. The editor highlights the active transition rule in yellow, letting you trace exactly which logic is currently being executed.

**Breakpoints**

As with other language extensions, the Varphi extension fully supports breakpoints.

### Configuration

By default, the extension assumes the Varphi Interpreter (`vpi`) is available in your system's `PATH`. If you have installed the interpreter in a custom location, you can configure the path in your VS Code settings:

1. Open Settings (`Ctrl+,`).
2. Search for `Varphi`.
3. Set **Varphi: Interpreter Path** to the location of your executable.

If you prefer editing the setting in JSON, the setting is:

```json
"varphi.interpreterPath": "/path/to/your/vpi"
```

{% hint style="danger" %}
The path to the Varphi Interpreter must not include spaces or quotations.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.varphi-lang.com/vs-code-extension.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
