Skip to content

VS Code extension

The official Nola extension, nola.nola-vscode, provides editing and debugging support for .tsi files. It includes the Nola language server and a tsserver plugin. No global installation is needed.

  • Syntax highlighting for infer, ask, extractor templates, and ask with <name> routing.
  • Diagnostics — Nola parse errors and TypeScript errors, reported at the original .tsi positions.
  • Hover, completion, and go-to-definition inside .tsi files, including inside the ${…} holes of an instruction. TypeScript errors point to their source range inside the template.
  • TypeScript interop. The bundled tsserver plugin gives .ts consumers types for their .tsi imports. Go-to-definition opens the original infer function.
  • Debugging. The “Nola: Launch File” configuration runs your entry point with the Nola loader. You can set breakpoints in .tsi, step into infer functions, and inspect contextual parameters with debug hover.

Install from the Marketplace, or run code --install-extension nola.nola-vscode. Both npm create nola and nola init --add write a .vscode/extensions.json recommendation unless you pass --ide none.

  • A Nola project. Create one with npm create nola my-app, or run nola init --add in an existing project.
  • A directory-style include in tsconfig.json. Use ["src"] so the language server and tsserver plugin can include .tsi files. A glob such as ["src/**/*.ts"] excludes them.
  • TypeScript. The language server uses node_modules/typescript from your workspace, falling back to VS Code’s built-in copy. If neither is available, install typescript in the project. Scaffolded projects already declare it as a dependency.

You can open .tsi files before running npm install. The extension uses bundled runtime declarations until it can resolve @nola-lang/runtime from the project. After installing dependencies, run Developer: Reload Window so go-to-definition on runtime types opens the installed package.

Add Nola: Launch File from Add Configuration… in launch.json, or use the configuration created by the scaffold. It runs node --import nola-lang/register --enable-source-maps with resolveSourceMapLocations and skipFiles set for .tsi debugging. Editor setup explains the full configuration.

Type infer or ask in a .tsi file to see the available snippets.

Snippet Inserts
infer An infer function
inferc An infer function with a contextual parameter
inferi An infer function with an instruction
ask A typed extractor resolved with ask
askfree An untyped extractor resolved with ask
askwith An extractor routed through a named model
calli A call intent
extract A bare extractor

For another editor, configure @nola-lang/language-server and @nola-lang/typescript-plugin as described in Editor setup.

Next: Error codes