Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>SpektraNew to Visual Studio Code? Get it now.
Spektra

Spektra

Preview

Rystad Energy

|
1 install
| (0) | Free
Highlighting, completion, hover and diagnostics for SPQL queries, with optional Spektra API-aware completion of data sources, fields and units, running queries, and SPQL tools for agent mode.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Spektra

Editing support for SPQL queries in Visual Studio Code: semantic highlighting, context-aware completion, hover documentation and diagnostics, powered by the SPQL language server.

Connect a Spektra API key and the extension also knows your data: it completes data source, field and unit names, explains fields on hover, flags names that do not exist, warns about measures and dimensions that cannot be combined, and runs your query, with the result in a table under the editor.

Preview. This is an early release. Feedback and bug reports are welcome (see Feedback).

Features

Semantic highlighting

Every token is classified by the SPQL parser, so data sources, fields, units, aliases and metadata keys are coloured by their role in the query, not by a regular expression.

Context-aware completion

Completion is driven by the parser: it offers exactly the keywords, operators and aggregation syntax that may follow the text before the cursor. With a Spektra API key it also offers:

  • the data sources your key can access, after FROM;
  • the fields of the query's data source, with dimension/measure, folder and description;
  • each measure's units, default unit first.

When compatibility checks are on, fields that cannot be combined with the measures and dimensions already in the query are still offered, but struck through and sorted after the compatible ones, with the conflicting fields in their details.

Hover

Hover a field to see its name, whether it is a dimension or a measure, its folder and its description from the data source schema (needs an API key).

Diagnostics

  • Syntax errors, unknown characters, unterminated strings and brackets.
  • With an API key: unknown data sources and fields (names match ignoring case; aliases defined with AS are not flagged).
  • With an API key: fields used with a value of another data type, by the schema's data type (string or number). WHERE Country = 123, WHERE Year IN ('2020') and WHERE Country > 5 are errors, and so is a string field in a calculation (SELECT Country + 123); SELECT Production + 123 is fine.
  • With compatibility checks: a warning on a measure or dimension that cannot be combined with one before it in the query.

Each .spql document is treated as one query.

Running queries

SPQL: Run Query (Cmd+Enter on macOS, Ctrl+Enter elsewhere, or the ▷ button in the editor title) sends the editor's query to the Spektra API and shows the result in the SPQL Results tab of the bottom panel, next to Problems and Terminal. The editor keeps the focus, and the editor's current text is sent, saved or not.

The table shows the columns, the row count, when the query ran, how long it took and the data's timestamp. At most spql.query.maxRows rows are shown (5,000 by default); Copy as CSV copies them. Run Again and Cancel are in the panel. When the API rejects a query, the panel shows its explanation, and its trace ID when it sends one, so it can be quoted to the API team. Needs an API key.

Agent mode: SPQL tools

In Copilot's agent mode (and any chat that uses VS Code's language model tools), the extension gives the agent six tools. Agent mode picks them on its own; type # and a tool's reference name to make it use one.

Tool Reference What the agent gets
SPQL: Language Reference #spqlReference The SPQL reference bundled with the extension: clauses, units, aggregations, WHERE conditions, error codes and the grammar. Works offline.
SPQL: List Data Sources #spqlDataSources The data sources your API key can query.
SPQL: Get Data Source Fields #spqlSchema A data source's dimensions and measures, with descriptions, folders, data types and units, written as SPQL expects them. Searchable, for large data sources.
SPQL: Validate Query #spqlValidate Every problem in a query (or an .spql file) with its line, column, code and message: the same diagnostics as the editor, including the Spektra checks.
SPQL: Get Completions #spqlComplete What can be written at a point in a query (marked <\|>): keywords, fields, units.
SPQL: Run Query #spqlRun The query's result as CSV (50 rows by default, at most 1,000), or the API's error. VS Code asks you to confirm each run.

Data sources, fields, validation and completions go through the running language server, with your API key, so the agent sees what the editor sees. Without a key, only Validate Query (syntax checks) and Get Completions (keywords) work; the others tell the agent to ask you for a key.

Requirements

  • VS Code 1.101 or later, on any operating system and processor: Windows, macOS and Linux, Intel or Arm. Nothing else to install. The language server is bundled as WebAssembly and runs inside VS Code.
  • Optional: a Spektra API key for data source, field and unit completion, hover, name checks and running queries. Without a key, highlighting, keyword completion and syntax diagnostics still work.

Getting started

  1. Install the extension and open (or create) a file with the .spql extension.
  2. Optional: run SPQL: Set Spektra API Key from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and paste your key.
  3. Type FROM and press Ctrl+Space to see the data sources, then continue with SELECT.
  4. Press Cmd+Enter (macOS) or Ctrl+Enter to run the query.
-- One query per file
FROM UCube
SELECT Country, Year, Production:[Base unit bbl].[Production Rate].[kbbl/d]
WHERE Country IN ('Norway', 'Brazil')
    AND Year BETWEEN 2020 AND 2030
ORDER BY Year ASC

Spektra API key

The key is optional and is only sent to the Spektra API URL configured in spql.api.url. The key, spql.api.url, spql.server.path and spql.developerMode are only read from your user settings: a workspace's .vscode/settings.json can't change them, so a project you open can't redirect your key elsewhere.

  • Recommended: secret storage. Run SPQL: Set Spektra API Key. The key is kept in VS Code's encrypted secret storage (the operating system's keychain), not in any settings file, and is not synced by Settings Sync. Run SPQL: Clear Spektra API Key to remove it.
  • Alternative: the spql.api.key setting. This stores the key in plain text in your user settings.json (and Settings Sync will sync it). A key in secret storage takes precedence over the setting.

Changing the key, spql.api.url, spql.api.checkCompatibility, spql.server.path or spql.developerMode restarts the language server automatically.

If the API rejects the key (HTTP 401/403), an error is written to the SPQL Language Server output channel and API features are turned off until the server restarts (SPQL: Restart Language Server).

Settings

Setting Default Description
spql.api.key "" Spektra API key, in plain text. Prefer SPQL: Set Spektra API Key (secret storage), which takes precedence.
spql.api.checkCompatibility true Warn about measures and dimensions that cannot be combined, and strike incompatible fields through in completion. Needs an API key.
spql.query.maxRows 5000 Most rows shown by SPQL: Run Query (up to 100,000). Larger results are cut, with a notice giving the total.
spql.developerMode false Developer mode, for working on SPQL itself: turns on the settings below and the SPQL Syntax Tree view in the Explorer.

Under SPQL › Developer, used only in developer mode (VS Code can't hide them otherwise; they're ignored instead):

Setting Default Description
spql.api.url https://spektra-api.rystadenergy.com/ Base URL of the Spektra API. Without developer mode, the default is always used.
spql.server.path "" Another build of the language server (a WebAssembly build's folder, or a native executable). Empty uses the bundled one.
spql.trace.server off Log the LSP traffic (messages or verbose) to the SPQL Language Server Trace output channel.

The extension also sets these defaults for SPQL files: semantic highlighting on, word-based suggestions off, and quick suggestions in code but not in comments or strings.

Commands

Command Description
SPQL: Run Query Run the active editor's query and show the result in SPQL Results (Cmd+Enter / Ctrl+Enter).
SPQL: Restart Language Server Restart the server, e.g. after a rejected key or a network problem.
SPQL: Set Spektra API Key Store a Spektra API key in VS Code's secret storage.
SPQL: Clear Spektra API Key Remove the key from secret storage.

Privacy and security

  • Without an API key the extension makes no network requests. Everything runs locally, inside VS Code.

  • With an API key the language server sends HTTPS GET requests to spql.api.url (by default https://spektra-api.rystadenergy.com/), with the key in the X-Api-Key header, and to no other address:

    • the list of data sources (/DataSources);
    • the schema and version of the data source named in the query (/DataSources/{name}/schema, /DataSources/{name}/version);
    • with compatibility checks on, the compatible items of each field used in the query (/DataSources/{name}/compatible-split-items/{field}, /DataSources/{name}/compatible-value-items/{field}).

    The names of the data source and fields in your query therefore appear in request URLs. While you edit, the query text itself is not sent. Responses are cached in memory only (data sources for 30 minutes, schemas until their version changes).

  • SPQL: Run Query sends the query text to {spql.api.url}/spql (HTTPS POST), only when you run it. So does the agent's Run Query tool, after you confirm it.

  • The other agent tools make the same requests as the editor (above). A query an agent passes to them is checked in memory, as a document that is never shown or saved.

  • All requests go through VS Code's own network stack, so they follow VS Code's proxy and certificate settings (http.proxy, the system proxy, http.systemCertificates).

  • The language server runs inside VS Code's extension host (as WebAssembly, in a worker thread), not as a separate process, so the key is not visible in process lists.

  • The extension collects no telemetry.

Known limitations

  • One query per document: the SPQL parser handles a single query at a time.
  • API features need network access to the Spektra API; a completion waits at most 750 ms for data that is still loading, and shows what is available after that.
  • A rejected API key disables API features until the server is restarted.
  • Only file and untitled documents are supported (no virtual file systems, no VS Code for the Web).
  • Results are read whole (no paging): very large results are cut to spql.query.maxRows for display.

Feedback

Ask questions, report bugs and request features in the Q & A tab of the extension's Marketplace page.

License

See the license that comes with the extension (the License link on the Marketplace page). Third-party software it includes, and the licenses it's used under, are listed in THIRD-PARTY-NOTICES.txt in the extension.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft