# VS Code

Write Rootform source with diagnostics, completion, hover, go to definition and formatting in VS Code.

Write `.rf.hcl` files with feedback as you edit. Rootform supplies diagnostics
for invalid source, completion in context, hover information, go to definition
and document formatting. Syntax highlighting, bracket matching and folding
help you navigate a Dialect or Policy Pack.

## Start editing

1. [Install Rootform](https://docs.rootform.dev/installation/) and confirm `rootform version` works.
2. Open **Extensions**, search for **Rootform**, and install the extension
   published by **rootform-dev**. Use VS Code 1.133 or later.
3. Open a trusted workspace containing `.rf.hcl` files. Select the **Rootform**
   language mode if VS Code has not selected it automatically.

Rootform must be on VS Code's `PATH`. If it is installed elsewhere, set
**Rootform: Server Path** in Settings, or use:

```json title="settings.json"
{
  "rootform.server.path": "/absolute/path/to/rootform"
}
```

The extension uses your local executable; it does not bundle or download one.
It starts it only in a trusted workspace.

## Work on a Dialect or Policy Pack

Open a source root and use completion while writing declarations and
expressions. Hover a symbol for its information; use **Go to Definition** to
follow a reference and **Format Document** to format the file. Diagnostics
update as you edit, including unsaved changes.

The editor uses the same Rootform parser, compiler and formatter as the CLI
through `rootform lsp`. It validates source without planning infrastructure,
running providers or downloading project content. Valid Policy source still
needs to be linked and evaluated against a Form; the editor does not perform
a Policy check.

[Edit Rootform source](https://docs.rootform.dev/language/editors/) explains source roots and the
next authoring steps. [Test and validate](https://docs.rootform.dev/language/test-validate/) covers
behavior and Policy semantics beyond editor diagnostics.

## If language features do not start

Check that the workspace is trusted, `.rf.hcl` uses the Rootform language mode,
and the configured executable supports `rootform lsp`. An absolute server
path avoids differences between terminal and desktop application `PATH`.
After changing or replacing the executable, run
**Rootform: Restart Language Server** from the Command Palette.

Use the [extension README](https://github.com/rootform-dev/editors/tree/dev/vscode#readme)
for launch diagnostics and the [LSP reference](https://docs.rootform.dev/reference/cli/lsp/) for
the server contract.
