---
title: "SurrealQL editor support"
description: "SurrealQL syntax highlighting, completion and diagnostics in VS Code and JetBrains IDEs, plus the SurrealQL language server for other editors and CI."
canonical_url: "https://surrealdb.com/docs/integrate/integrations/editors"
section: "Editors"
surrealdb_version: "4.x"
last_modified: "2026-11-24T04:11:20Z"
---

> Full SurrealDB documentation index: https://surrealdb.com/docs/llms.txt

# SurrealQL editor support

SurrealQL syntax highlighting, completion and diagnostics in VS Code and JetBrains IDEs, plus the SurrealQL language server for other editors and CI.

SurrealDB publishes extensions that add SurrealQL to VS Code and to the JetBrains IDEs, and a language server that provides diagnostics, completion and hover to any editor that speaks the Language Server Protocol (LSP). To embed a SurrealQL editor in a web page, see [SurrealQL in CodeMirror](/docs/integrate/integrations/editors/codemirror.md).

Files with the `.surql` and `.surrealql` extensions are treated as SurrealQL.

## Choose a tool

| Tool | Gives you | Install from |
| --- | --- | --- |
| [VS Code extension](#vs-code) | Highlighting, snippets, comment toggling, language server features, a **Run** code lens and a results panel | VS Code Marketplace, Open VSX |
| [JetBrains plugin](#jetbrains-ides) | Highlighting, language server features, a **Run** code lens and a grammar version picker | JetBrains Marketplace |
| [Language server](#language-server) | Diagnostics, completion, hover, go-to-definition, references, rename, code actions and a headless `check` command | `surreal install lsp`, GitHub releases, npm, crates.io |
| [CodeMirror addon](/docs/integrate/integrations/editors/codemirror.md) | Highlighting, folding, indentation and a version linter for editors in a web page | npm |

## Language server

The language server reads SurrealQL files and reports what it finds in them. The editor extensions start it for you. It provides:

- Diagnostics for syntax errors, and for queries that disagree with the schema in your files, such as an unknown field or a field of the wrong type.
- Completion for field names, `record<table>` types, built-in functions and statement keywords.
- Hover with type information, function signatures and the permissions on a table.
- Go-to-definition and references for tables, fields, functions and parameters.
- Rename for functions defined in your files, and code actions for missing `PERMISSIONS` clauses.
- Signature help, call hierarchy and a document outline of tables, fields, events, indexes and functions.

The server builds its picture of the schema from `DEFINE` statements in your workspace, from the connected database, or from both. A workspace scan skips files over 2 MB and indexes at most 5,000 `.surql` files.

### Install the language server

With the [`surreal` launcher](/docs/reference/cli/launcher.md), install it as the `lsp` component:

```bash
surreal install lsp
```

The server is also attached to each [GitHub release](https://github.com/surrealdb/surrealql-language-server/releases) as a binary for macOS (arm64), Linux (amd64 and arm64) and Windows (amd64). Rust projects can depend on the `surrealql-language-server` crate, and the WebAssembly build for browsers is the `@surrealdb/surrealql-language-server` npm package.

### Use it in another editor

An editor starts the server over standard input and output, and the server writes nothing else to that channel:

```bash
surreal lsp stdio
```

Point any LSP client at that command for files with the `.surql` extension. The binary from a GitHub release does the same with `surrealql-language-server stdio`.

### Check files from the command line

The same analysis runs without an editor, which suits CI jobs, pre-commit hooks and coding agents:

```bash
surreal lsp check queries/
```

Pass a directory or files. To check a file against the schema in another folder, add `--workspace schema/`. For a file that exists only in memory, use `--stdin --stdin-filename <path>`. A file that creates a record in a table that has no `PERMISSIONS` clause gives output like this:

```text title="Example output"
queries/create.surql:1:8 warning[permission-unknown]: No explicit permission rule found for CREATE on `person`.
0 errors, 1 warning in 1 file
```

`--json` prints the diagnostics as one JSON document, each with a stable `code` such as `permission-unknown`, and `--fail-on warning` makes warnings fail the run too. The exit code says what happened:

| Exit code | Meaning |
| --- | --- |
| 0 | The check completed and nothing reached the `--fail-on` level, which is `error` by default. |
| 1 | The check completed and found diagnostics at or above that level. |
| 2 | The command was misused, or an input file could not be read. |

### Settings

Editors pass settings under a `surrealql` key, either as initialisation options or as workspace configuration. A table declared `SCHEMALESS` accepts fields that are not defined, so by default the server stays quiet about unknown fields and field types on it. The `analysis.schemalessDiagnostics` setting changes that:

| Value | Behaviour |
| --- | --- |
| `quiet` | Reports none of the schema-based diagnostics on a `SCHEMALESS` table. This is the default. |
| `errors` | Reports only the two faults SurrealDB itself raises: a value of the wrong type and an unknown type name. |
| `strict` | Checks a `SCHEMALESS` table in the same way as a `SCHEMAFULL` one. |

```json title="Settings"
{ "surrealql": { "analysis": { "schemalessDiagnostics": "errors" } } }
```

Use `analysis.externalParams` to list parameters that your application binds at run time, so that the server does not report them as undefined.

> [!NOTE]
> The server reads function signatures from a catalogue built for a fixed SurrealDB release, and it does not recognise every type added in SurrealDB 4.0. In version 0.6.4, the `i8` and `f16` field types are reported as `unknown-type` errors although SurrealDB 4.0 accepts them. Treat that diagnostic as advice when you target a newer type, and check the statement against your server.

## VS Code

The [SurrealQL extension](https://marketplace.visualstudio.com/items?itemName=surrealdb.surrealql) adds SurrealQL to VS Code. Open the Extensions view, search for **SurrealQL** by SurrealDB, and select **Install**. From a terminal:

```bash
code --install-extension surrealdb.surrealql
```

Editors based on VS Code that use [Open VSX](https://open-vsx.org/extension/surrealdb/surrealql), such as VSCodium, install it from there under the same name.

The extension provides:

- **Highlighting** with a TextMate grammar, including SurrealQL inside Markdown code fences and JavaScript or TypeScript template literals.
- **Snippets** for common statements.
- **Comment toggling** that understands all three line comment markers, `--`, `//` and `#`.
- **Language server features**. The extension downloads the server from GitHub on first use and caches it.
- **Run** above each top-level statement in a `.surql` or `.surrealql` file, which runs that statement against the configured endpoint.
- A **SurrealQL Results** panel with the last 50 executed queries, as a table or as JSON.
- A status bar item showing the connection in use, which opens the settings when selected.

Settings live under the `surrealql` key:

| Setting | Default | Description |
| --- | --- | --- |
| `surrealql.lsp.enable` | `true` | Turns the language server on or off. |
| `surrealql.lsp.version` | `"latest"` | Pins a language server release tag. |
| `surrealql.lsp.binaryPath` | `""` | Uses a local binary instead of the downloaded one. |
| `surrealql.connection.endpoint` | `"http://localhost:8000"` | HTTP endpoint that **Run** sends queries to. |
| `surrealql.connection.namespace` | `""` | Default namespace. |
| `surrealql.connection.database` | `""` | Default database. |
| `surrealql.connection.username` | `"root"` | User name for HTTP basic authentication. |
| `surrealql.connection.password` | | Password for that user. |
| `surrealql.connection.authContext` | `"root"` | The level the user belongs to: `root`, `namespace`, `database` or `record`. |
| `surrealql.inference.mode` | `"both"` | Where the schema comes from: `workspace`, `db` or `both`. |

A `USE NS` or `USE DB` statement in a file overrides the namespace and database settings for the statements that follow it.

To connect a coding agent in VS Code to SurrealDB, see [Visual Studio Code](/docs/agents/vscode.md) in the agent setup pages.

## JetBrains IDEs

The SurrealQL plugin works in IntelliJ IDEA, PyCharm, WebStorm, GoLand, RustRover, DataGrip and other IntelliJ-based IDEs from build 243 (2024.3) onwards. Open **Settings**, select **Plugins**, search the **Marketplace** tab for **SurrealQL**, and install the plugin by SurrealDB.

The plugin provides:

- Highlighting from the same TextMate grammar as the VS Code extension.
- Language server features through the LSP4IJ plugin, on which it depends.
- A file icon for `.surql` and `.surrealql` files.
- A **Run** code lens and a tool window for results, and a status bar widget that shows the connection.

The plugin downloads the newest published grammar when the IDE starts, and falls back to a copy bundled with the plugin when it is offline. To use an older grammar, for example after a highlighting regression, open **Settings**, **Tools**, **SurrealQL**, choose a version from the **Version** list and select **Apply**. The change takes effect without restarting the IDE.

## Other editors

Syntax grammars and editor integrations for Zed, Neovim, Helix and Emacs are in development in the [SurrealDB GitHub organisation](https://github.com/surrealdb). They are not yet published as releases, so they are not covered here. Any of these editors can use the language server described above. For connecting a coding agent in Zed, see [Zed](/docs/agents/zed.md).

SurrealDB Studio has its own SurrealQL editors, described in [SurrealQL editors](/docs/reference/studio/surrealql-editors.md).
