Skip to main content

VS Code Extension

The Wvlet extension provides syntax highlighting, language support, and query execution for .wv files in Visual Studio Code.

Installation​

Install from the VS Code Marketplace or search for "Wvlet" in VS Code's Extensions view.

Features​

  • Syntax Highlighting: Full support for Wvlet keywords, operators, and syntax
  • Bracket Matching: Automatic matching for {}, [], (), and ${}
  • Comment Support: Single-line (--) and multi-line (---) comments
  • String Interpolation: Highlighting for ${...} expressions
  • Auto-closing: Brackets and quotes automatically close when typed
  • Diagnostics: Compilation errors are reported inline as you edit
  • Document Outline: Models, types, vals, and flows appear in the outline view
  • Code Completion: Context-aware suggestions as you type
  • Hover Information: Type and schema details when you hover over models and columns
  • Run Queries: Run a query and see its rows below the editor, with nothing else to install
  • Go to Definition: Jump from a model or type reference to its definition, also across workspace files

Running Queries​

The extension includes the Wvlet engine, so it runs queries over local Parquet, CSV, JSON, and Iceberg data without the wvlet command, a database, or a server. Run a query in any of these ways:

  • Click Run above the query.
  • Press Cmd+Enter (macOS) or Ctrl+Enter with the cursor in the query, or click ▶ in the editor title.
  • Choose Run All from the menu next to ▶ to run every statement of the file.
from 'sales.csv'
group by item
agg qty.sum as total_qty
order by total_qty desc

The Wvlet Results view below the editor shows the rows with their column types, the results of test statements, and errors with a link to their line or statement.

  • The text in the editor runs, including unsaved edits. Models of other .wv files in the workspace can be used as they are saved on disk.
  • Relative paths start at the workspace folder (the first one in a multi-root workspace), or at the file's own folder when no folder is open.
  • A syntax error anywhere in the file stops all of its queries. A type error stops only the query that has it, and Run All.
  • Tables written with save to <table> stay in memory for later queries until the window is closed or the query runner stops. Wvlet: Restart Query Session in the Command Palette drops them.
  • Cancel stops a running query and keeps the session. If the query doesn't stop, Force Stop ends it and drops the tables in memory.
  • The view shows the first 1,000 rows of a result. Change this with the wvlet.maxRows setting.

A query has the same access as wvlet run: it can read and write your files, read URLs, and read S3 with the AWS credentials of your environment. Queries run only when you run them, and not in an untrusted workspace (Restricted Mode).

Queries run on the Wvlet engine. To run them on DuckDB, Trino, or Snowflake, use the wvlet command.

Code Completion​

The extension suggests candidates while you write a query. Completion is triggered automatically as you type or on demand with Ctrl+Space, and offers:

  • Keywords: Wvlet language keywords such as from, select, and where
  • Model & definition names: Models, types, vals, and flows defined in the current file and in other workspace files, including table types from an imported catalog
  • Column names: Columns available at the cursor, resolved from the query's input relation (for example, after from and inside select or where)
  • Function names: Well-known SQL functions such as count and regexp_replace

Typing . after a table alias or table name suggests only that relation's columns, and typing . after a schema name suggests the tables of that schema (from an imported catalog) — for example orders. lists the order columns, and sales. lists the tables of the sales schema.

Typing . after any other value suggests the functions of its type: 1. lists numeric functions such as round, name.upper. lists string functions, and a column in agg also lists the aggregates that apply to it. The rest of the query may still be incomplete.

Suggestions are ordered by where you type: tables and models come first after from, columns first inside select or where, and query operators such as where first on a new line. After a dot, the functions of the value's own type come before the aggregates.

Column suggestions rely on type resolution, so they appear once the surrounding query is complete enough to be analyzed. Outside member-access contexts, keyword and definition suggestions are always available, including while a query is still being written.

Hover Information​

Hover over a symbol to see its type information in a tooltip:

  • Models: The model signature — its name, parameters, and output schema (each column with its type)
  • Columns: The column name and its resolved data type, for example name: string
  • Type definitions: The declared fields of a type

Hover relies on type resolution, so it appears once the surrounding query is complete enough to be analyzed. When the cursor is not on a symbol with a resolved type, no tooltip is shown.

Go to Definition​

Place the cursor on a model or type reference and use Go to Definition (F12, or Cmd/Ctrl + click) to jump to the model or type statement that defines it. For example, from from my_model you can jump to the model my_model = ... definition, and from a type reference to its type declaration.

Go to Definition works across the files of your workspace: a reference to a model or type defined in another .wv file — including table types imported into the catalog/ folder by wvlet catalog import — opens the defining file at the definition. When the same name is defined both in the current file and elsewhere, the definition in the current file wins.

Working with Database Tables​

The language server loads the .wv sources of your workspace folder (the first folder in a multi-root workspace), including the catalog/ folder generated by wvlet catalog import. After importing your database catalog once, table references such as from sales.orders resolve offline in the editor: diagnostics validate them, hover shows their columns, and column names complete — no live database connection needed.

Note: source discovery follows the compiler's folder scan, which descends into folders that contain .wv files (plus the catalog/ folder, which is always loaded). Keep at least one .wv file at the workspace root — or open the folder that holds your queries — so nested sources are found.

Known Limitations​

  • Schema for database tables: Tables get completion and hover only when their schema is known — from a model/type definition in the workspace or from an imported catalog (see above). File sources such as from 'data.json' do not yet carry a schema in the editor.
  • Requires an analyzable query: Column completion and hover rely on type resolution, so they appear once the surrounding query is complete enough to be analyzed. While a query is still being written, keyword and definition-name suggestions remain available.

Example​

Wvlet syntax highlighting in VS Code

Pre-release Versions​

To try new features early, switch to the pre-release version from the extension's settings in VS Code.