Skip to content

Editor support

Besides the Tessel IDE, you can write Tessel in Visual Studio Code with the Tessel extension, or in any other editor that can talk to a language server.

The Tessel extension is in the VS Code Marketplace. It gives you:

  • Syntax highlighting for .tsl files.
  • Errors as you type. The same errors tessel check reports appear as red underlines in the editor and in VS Code’s Problems panel, updated on every change, before you save.
  • Types on hover. Hover over an expression to see its type, for example draft: String or todos: [Todo].
  • Code completion. Suggestions as you type, the same as in the Tessel IDE: the fields and methods after todo., the cases after . where an enum is expected, a module’s public names after geometry., and the variables, functions, types, views and keywords visible elsewhere. Press Ctrl+Space to ask for them.
  • Comment toggling (//), bracket matching, auto-closing of brackets and quotes, and automatic indentation after {.

Errors, hover types and completions come from tessel lsp, so the extension needs the tessel command (see Installation).

Open the Extensions view in VS Code (Cmd+Shift+X, or Ctrl+Shift+X on Windows), search for Tessel, and click Install on the one published by alexiusacademia. Or install it from a terminal:

Terminal window
code --install-extension alexiusacademia.tessel

It’s also on the Marketplace’s website: Tessel for VS Code. VS Code keeps it up to date from there.

Code completion needs Tessel 0.1.8 or later; run tessel update if yours is older.

The extension’s source is in the Tessel repository, in editors/vscode. To build a .vsix package and install it from the file, you need Node.js:

Terminal window
cd editors/vscode
npm install
npm run package
code --install-extension tessel-0.2.0.vsix

You can also install the .vsix from inside VS Code: open the Extensions view, click the ... menu, and choose Install from VSIX….

The extension has one setting:

SettingDefaultMeaning
tessel.pathtesselThe tessel command used for errors, hover and completion.

If tessel isn’t on your PATH, set tessel.path to the full path of the executable, for example /Users/you/tessel/target/release/tessel. The value may contain ${workspaceFolder}, which is replaced with the first folder open in VS Code.

If the extension can’t start tessel lsp, VS Code shows a message saying so; highlighting keeps working without it.

In a folder that VS Code doesn’t trust yet (Restricted Mode), highlighting works, but a tessel.path set in that folder’s own settings is ignored until you trust the folder.

A Tessel program is a folder, so the language server checks the whole folder whenever a file in it changes, using the text of your open files even if they’re not saved. Errors in other files of the same folder are shown too.

Unlike tessel check, the language server doesn’t complain when there’s no app or fn main() yet, because the file you’re editing may be one part of a larger program.

tessel lsp is a standard Language Server Protocol server that talks over standard input and output. Any editor with LSP support, such as Neovim, Helix, Zed, Sublime Text (with the LSP package) or Emacs (with eglot or lsp-mode), can use it. Configure it to:

  • start the command tessel lsp,
  • for files ending in .tsl.

The server sends diagnostics (errors) when a file is opened, changed, saved or closed, answers hover requests with the type of the expression under the cursor, and answers completion requests (typing . asks for them too). It doesn’t offer go-to-definition, rename or formatting yet.

For syntax highlighting, the extension’s TextMate grammar, editors/vscode/syntaxes/tessel.tmLanguage.json, works in any editor that reads TextMate grammars.