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.
VS Code
Section titled “VS Code”The Tessel extension is in the VS Code Marketplace. It gives you:
- Syntax highlighting for
.tslfiles. - Errors as you type. The same errors
tessel checkreports 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: Stringortodos: [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 aftergeometry., 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).
Installing
Section titled “Installing”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:
code --install-extension alexiusacademia.tesselIt’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.
Building it from source
Section titled “Building it from source”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:
cd editors/vscodenpm installnpm run packagecode --install-extension tessel-0.2.0.vsixYou can also install the .vsix from inside VS Code: open the Extensions
view, click the ... menu, and choose Install from VSIX….
Settings
Section titled “Settings”The extension has one setting:
| Setting | Default | Meaning |
|---|---|---|
tessel.path | tessel | The 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.
How checking works
Section titled “How checking works”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.
Other editors
Section titled “Other editors”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.