Skip to content

The Tessel IDE

Tessel comes with its own small IDE: a file explorer, a tabbed code editor, buttons to check, run and build your program, and panels for problems and program output. You don’t need a terminal or another editor to write Tessel apps.

The Tessel IDE: a toolbar with Save, Check, Run, Build and Package; an explorer on the left; a code editor showing todos.tsl; and a Problems panel below

The IDE is itself a Tessel app. Its source is in the ide/ folder of the Tessel repository, and it’s a good example of a larger Tessel program.

Run tessel with no arguments to open the IDE on the current folder, or name a folder:

Terminal window
tessel # the current folder
tessel ide todos # the folder `todos`

The folder is your project: the program the IDE checks, runs and builds. The first time you open the IDE, tessel compiles it, which takes a moment (preparing the IDE (first run only)…). After that it starts straight away, until you update tessel.

When it opens, the IDE shows the first .tsl file of the project and checks the program. A folder with no Tessel files yet offers to start a project in it: a To-do app, a Blank app or a Command line program, as tessel new makes them.

The left side lists the project’s files and folders, folders first. Click a folder to open or close it, and click a file to open it in the editor. Files and folders whose names start with . are hidden.

The four buttons at the top of the explorer are:

ButtonWhat it does
New fileAsks for a name and creates an empty file. If the name has no extension, .tsl is added.
New folderAsks for a name and creates a folder.
RenameRenames the selected file or folder. Open tabs follow the renamed file.
DeleteAsks you to confirm, then deletes the selected file. Folders can’t be deleted from the IDE.

New files and folders go into the selected folder, or into the folder of the selected file. Type the name and press Enter.

Each open file gets a tab. The editor has:

  • Syntax colors for Tessel code, and line numbers.
  • Error markers as you type: a red wavy line under each error, and a red mark beside its line. See Understanding code.
  • Code completion. As you type, a list suggests what fits there: the fields and methods after doc., the modifiers after a view, the cases after . where an enum is expected, and the names in scope (variables, functions, views, types and keywords) elsewhere. Up and Down choose, Enter or Tab insert, Escape closes the list. Accepting a function or method also types its (.
  • Undo and redo with Cmd+Z and Cmd+Shift+Z.
  • The usual text editing keys: select with the mouse or Shift and the arrow keys, copy, cut, paste, and select all. Tab inserts four spaces.
  • Editing keys like VS Code’s: Cmd+/ comments lines out and back in, Alt+Up and Alt+Down move lines, Shift+Alt+Up and Down copy them, Shift+Cmd+K deletes them, Cmd+Enter starts a new line below, Cmd+] and Cmd+[ indent and outdent, and Cmd+L selects the line. Brackets and quotes close themselves, and the bracket that matches the one at the cursor gets a box.
  • Several cursors: Alt+click adds one, Cmd+D selects the word and then its next occurrence, and Cmd+Alt+Up or Down adds one above or below. What you type goes in at every cursor. Escape goes back to one.
  • Folding: the arrow left of a line that opens a block folds it to { … }; Cmd+Alt+[ and Cmd+Alt+] fold and unfold where the cursor is.

The code editor page lists every key.

A tab whose file has unsaved changes shows a dot (•) before its name. Closing a tab with its × button saves your changes first.

On Windows, use Ctrl wherever this page says Cmd.

The keys are the ones VS Code uses, so they may already be in your fingers.

Quick Open (Cmd+P) opens a box at the top of the window. Type a few letters of a file’s name, in order: mtsl finds main.tsl. The files whose names have the letters side by side, or at the start of words, come first, and the letters that match are in bold. Up and Down choose, Enter opens the file, and Escape closes the box. With nothing typed, the files you opened lately come first.

The command palette (Shift+Cmd+P) is the same box with > in front: it lists everything the IDE can do, with its keys. Type to find a command, and press Enter to run it. Delete the > to look for files again.

Go to line (Ctrl+G, on a Mac too) is the box with : in front. Type a line number, or line:column like 12:5, and press Enter.

Find (Cmd+F) opens a find bar over the editor. Type what to look for: every place it’s in the file is marked in yellow, and the first one from the cursor on is selected. The bar says which one it is (“3 of 12”). Enter goes to the next one and Shift+Enter to the one before; Cmd+G and Shift+Cmd+G do the same from the editor. Aa matches large and small letters exactly, and ab only whole words. Escape, or the ×, closes the bar and puts you back in the editor, with the match selected.

Replace (Option+Cmd+F, Ctrl+H on Windows) opens the find bar with a second field, for what to put in place. Replace changes the selected match and goes on to the next; Replace all changes all of them at once, and one Cmd+Z takes them all back.

Search in files (Shift+Cmd+F) opens the Search tab at the bottom. It looks through every file of the project as you type, and lists each line that has what you typed, under its file, with the match in bold. Click a line to go there. Files you have open are searched as they are in the editor, saved or not. Hidden files and folders (starting with .), and build, target and node_modules, are left out.

To change what was found in every file, type the new text in Replace in files and press Replace all. The IDE asks first. Open files change in the editor, ready to save (or undo); the others are written straight away.

Go back (Ctrl+- on a Mac, Alt+Left on Windows) takes you to where you were before a jump: before Quick Open, Go to line, a click on a problem or a search result, or a move of the cursor to another file or ten lines or more away, or Go to definition and the Uses tab. Go forward (Shift+Ctrl+- on a Mac, Alt+Right on Windows) goes the other way.

The toolbar shows the line and column the cursor is on, like Ln 12, Col 5.

KeyWhat it does
Cmd+PQuick Open: go to a file
Shift+Cmd+PThe command palette
Ctrl+GGo to line
Cmd+FFind in the file
Option+Cmd+F (Ctrl+H on Windows)Replace in the file
Enter, Shift+EnterNext and previous match, in the find bar
Cmd+G, Shift+Cmd+GNext and previous match (on a Mac)
Shift+Cmd+FSearch in files
F12, Shift+F12, F2Go to definition, find all uses, rename (see Understanding code)
Ctrl+- (Alt+Left on Windows)Go back
Shift+Ctrl+- (Alt+Right on Windows)Go forward
Cmd+SSave
Cmd+KCheck
Cmd+RRun, or stop
Shift+Cmd+RDebug, or stop debugging
Cmd+BBuild
Cmd+WClose the tab

The editor knows what your code means, as you type it, saved or not:

  • Errors as you type. A moment after you stop typing, the program is checked again. Errors get a red wavy line under them, their lines a red mark, and the Problems tab lists them. With the cursor on a line with an error, its message shows in the toolbar.
  • Hover. Rest the mouse on a name for a moment to see what it is: a function’s or a type’s declaration, or a variable’s type, with the comment written just above its declaration. On an error, its message shows too.
  • Uses, highlighted. With the cursor on a name, its other uses in the file get a light gray background.
  • Go to definition. Cmd-click a name, or put the cursor on it and press F12, to go to where it’s declared. Its file opens if it isn’t open yet.
  • Find all uses. Shift+F12 lists every place the name is used, in all the project’s files, in the Uses tab at the bottom. Click one to go there.
  • Rename. F2 asks for the name’s new name in the toolbar. Type it and press Enter: the name changes everywhere it’s used, in open files (which then have unsaved changes) and in the others. Names that can’t be renamed, like print or main, say why in the status.

Right-click a name for Go to Definition, Find All Uses and Rename… in a menu.

KeyWhat it does
Cmd-clickGo to where the name is declared.
F12The same, for the name at the cursor.
Shift+F12List the name’s uses in the Uses tab.
F2Rename the name at the cursor everywhere.

The IDE gets all this from tessel query, the same checker as tessel check and the language server.

ButtonShortcutWhat it does
SaveCmd+SSaves every changed file, then checks the program again.
CheckCmd+KChecks the program for errors (like tessel check) and lists them under Problems.
Run / StopCmd+RSaves and runs the program, showing its output in the Console. While it runs, the button becomes Stop.
DebugShift+Cmd+RSaves and runs the program in the debugger. While it’s debugged, the toolbar shows the debugger’s buttons instead.
BuildCmd+BBuilds an executable into the project folder, named after the folder.
PackageLike Build, but makes an app bundle (Name.app on macOS).
PreviewOnly while a Markdown file is open: shows or hides the Preview panel.
DesignShows or hides the Design panel.
DocsShows or hides the Docs panel.

When a newer Tessel is available, an Update to v… button appears next to the status. It runs tessel update and shows its progress in the Console; restart Tessel afterwards to use the new version.

Next to the buttons, a status text says what the IDE is doing (“Building…”, “Running”, “2 problem(s)”, and so on).

With Reload on save switched on (it is on by default), saving while your app is running gives the running app its new code: the window stays open, and what you had typed, switched on or scrolled to is still there. So you can change a color or a layout and see it at once, in the middle of whatever you were doing in the app. This is tessel run --hot, which has the details: for instance, a view whose state declarations change starts with fresh state.

If the saved code has errors, they’re shown in the Console and the app carries on with the code it had. A program without a window (fn main()) is run again from the start instead.

With the switch off, Run builds the program and runs it as it was then; saving doesn’t change the running program. The executable is written to a hidden file, .tessel-run, in the project folder.

Design in the toolbar opens a picture of your app next to its code. You can build the window by pointing at it: select a view, change how it looks, drag new views in, and drag views to other places. Everything you do there is written into the code, so you can go back and forth between the picture and the editor as you like.

The IDE with the Design panel open on the right: a row of kinds of views, a picture of a counter app with its title selected, and the inspector below with the title's text, font, colors and padding

The panel runs down the right side of the window and has three parts:

  • The kinds of views you can add, at the top: Text, Button, TextField (Field), Toggle, Picker, VStack, HStack, Spacer, Divider and Icon.
  • The picture: the app’s window as it first appears, made smaller if it doesn’t fit. It’s in the same appearance as the IDE, light or dark.
  • The inspector, below it: everything the selected view is given, or, with Outline, the views as a tree. Drag the edge above it to give the picture or the inspector more room.

The picture is made again whenever the code changes: a moment after you stop typing, and after every change you make in the panel. It’s made from what’s in the editor, saved or not.

If the code has an error, the panel says so in red and keeps the last picture, dimmed, until the error is gone. Views can’t be changed in the picture while it doesn’t match the code.

Click a view in the picture to select it. It gets a blue outline, and the editor scrolls to the line where it’s written. It works the other way too: put the cursor on a line in the editor, and the view written there is selected in the picture. Escape selects none.

Outline, above the inspector, lists the views in the picture as a tree, with the text of each one that has some (Text "Count: {count}"). Click a row to select its view: the way to get to one that’s too small to click, or hidden behind another. Properties goes back to the inspector.

A view made by a for loop is written once and shown several times: all of them are outlined (and it’s listed once). Views inside one of your own views are selected where the view declares them, in its file.

The inspector shows the selected view’s name and where it’s written, and below that its properties in sections, each a row with a label: click a section’s title to close or open it. Type in Filter properties to see only the rows whose label has that text.

SectionRowsWhat they write
ContentText, Title, Placeholder, Label, Path; Text, Is on, Selection; IconThe view’s own arguments: Text("Hello"), TextField("Name", text: name), Icon(.star).
ArgumentsOne per argumentFor one of your own views: what it’s given, as code.
StackSpacing, AlignmentFor a VStack or HStack: VStack(spacing: 12, alignment: .leading).
FontSize, Weight, Text alignment.font(size: 20, weight: .bold), .textAlignment(.center)
ColorForeground, Background, Corner radius, Border, Border width.color(.blue), .background(.lightGray, radius: 6), .border(.gray, width: 2)
PaddingAll edges, Horizontal, Vertical, Top, Leading, Bottom, Trailing.padding(12), .padding(horizontal: 8, vertical: 4)
Size and placeWidth, Height, Min and Max width and height, Offset X and Y.frame(width: 200, maxWidth: .infinity), .offset(x: 4)
AppearanceOpacity, Hidden, Disabled, Clipped, Tooltip.opacity(0.5), .hidden(), .tooltip("Saves the file")
ModifiersEvery modifier, as writtenEach one’s − takes it away, including ones the other sections don’t show, like .onTap.

How to change a value:

  • Text and numbers: type and press Enter. Numbers have − and + to step them. A value can be any expression, not only a number: Float(count) * 2, say, or .infinity for a maximum width.
  • Choices (weight, alignment): click one to pick it, and click it again to take it away.
  • Colors: click a color to pick it, and again to take it away, or type one like .rgb(255, 136, 0) in the field below them.
  • On or off (Hidden, Disabled, Clipped): click the box.

An empty field takes that part of the code away; a modifier left with nothing to say goes too. A text whose code isn’t plain text (a call, say) shows the code itself, marked “(code)”.

The trash button next to the view’s name, or the Delete key, deletes the view from the code; the copy button next to it duplicates it.

After a click in the panel (anywhere but in a text field), these keys work on the selected view:

Key
Delete, BackspaceDelete it.
Cmd+CCopy its code, to paste in the panel or in the editor.
Cmd+XCut it: copy its code and delete it.
Cmd+VPaste the code that was copied: into the selected stack, at its end, or after the selected view. Code copied from the editor can be pasted too.
Cmd+DDuplicate it: a copy goes right after it.
EscapeSelect none.
Cmd+Z, Cmd+Shift+ZUndo and redo (see below).

Drag a kind of view from the top of the panel into the picture. A green line shows where it would go: between two views of a stack, or at its end. Let go, and the view is written there, with the indentation of the code around it. It’s selected, ready to be changed.

A click on a kind of view (without dragging) adds one after the selected view, or inside it if a stack is selected.

A new VStack or HStack comes with a Text in it, so there’s something to see and to click. A TextField, Toggle or Picker needs state to hold what it shows: one is added for it, after the other state of the view or app it goes in, with a name that’s free (text, text2, …):

state text = ""
…
TextField("Placeholder", text: text)

Drag a view in the picture to another place: elsewhere in its stack, or into another stack. The green line shows where it would go. Its code is moved there, with everything in it.

Every change the panel makes can be undone with Cmd+Z and redone with Cmd+Shift+Z, or with the arrows at the top of the panel. A change in the panel is one step of the editor’s own undo history: Cmd+Z in the editor undoes it just as it undoes typing, in the order things happened.

  • The picture shows the app as it starts. It isn’t a running app: buttons in it select, they don’t click. Use Run for that, with Reload on save to see changes at once.
  • To make the picture, the app’s code runs up to its first frame, including what it does in .onAppear.
  • Views can go into stacks: the block of a VStack, HStack, ZStack or Scroll, or of one of your own views that takes content. Views in a for loop or an if can be selected, changed and moved out, but nothing can be dropped among them.
  • A TextField, Toggle or Picker can only be added inside a view or app, where its state can go (not in a function that returns a view).
  • A program needs an app to have a picture.

Drag the edge between the editor and the panel to make the panel wider. Click Design again, or the × in the panel, to close it. The Preview, Design and Docs panels take turns: opening one closes the others.

When the file in the editor is a Markdown file (.md or .markdown), a Preview button appears in the toolbar. It opens the file as it reads, next to its text:

The IDE with README.md open in the editor and the Preview panel on the right, showing its headings, a numbered list, a block of code and a table

  • The preview follows what you type, saved or not.
  • It shows what the Markdown view shows: headings, lists, tables, quotes, code (Tessel code in color) and pictures. Pictures are found from the file’s folder.
  • A link to another file of the project opens that file in the editor; a link to the web opens in your browser.
  • The panel shows while a Markdown file is in front: switch to another tab and it steps aside, come back and it’s there again.

Drag the edge between the editor and the panel to make the panel wider. Click Preview again, or the × in the panel, to close it.

Docs in the toolbar opens Tessel’s documentation in a panel next to the editor, so you can read while you write:

The IDE with the Docs panel open on the right, showing the page "Text and styling" next to the code editor

  • The panel opens on the contents: every page of this documentation, in the same order. Click a page to read it.
  • Links in a page go to other pages. The arrow goes back, and the house returns to the contents. Links to the web open in your browser.
  • Type in the search field to find pages: the ones with your words in their title come first, then the ones with them in their text, each with the line they’re on. Click one to read it. Large and small letters are the same to the search, and it needs two letters or more.
  • The documentation comes with Tessel and is read from your computer: it works without a network, and it’s the documentation of the version you have installed.

Drag the edge between the editor and the panel to make the panel wider or narrower. Click Docs again, or the × in the panel, to close it.

The edges between the parts of the window can be dragged: the one between the explorer and the editor, the one above Problems and Console, and the one beside the Preview, Design or Docs panel. An edge turns blue under the pointer. The sizes last until you close the IDE.

Click in the margin beside a line, left of its number, to set a breakpoint: a red dot marks it. Press Debug, and the program runs until it reaches that line. The line turns yellow, and the Debug tab at the bottom shows the calls that led there and the variables. Click a variable with an arrow to see its parts.

The IDE with a program stopped at line 9, which is yellow with a red dot beside it. The toolbar has Continue, Step over, Step in, Step out and Stop. The Debug tab at the bottom lists the calls total and main, and the variables: orders opened up to show its first Order with item "tea" and quantity 2, then sum and order

From there, Continue, Step over (Cmd+’), Step in (Cmd+;) and Step out (Shift+Cmd+;) say how the program goes on, and Stop ends it. A runtime error stops the program at the line where it happened, with its variables still there.

Debugging has the whole story.

The bottom of the window has five tabs:

  • Problems lists the errors in the program as it is in the editor, with the file and line of each one. The tab title shows how many there are. Click a problem to jump to it: its file opens and the editor goes to that line.
  • Console shows what the program prints while it runs, the output of Build and Package, and finally the exit code. Errors in the console show their location as --> file:line:column; click such a line to jump to it. This works for compile errors and for runtime errors, such as an index out of range.
  • Debug shows where a program being debugged is stopped: the calls that led there, and their variables.
  • Uses lists the places a name is used, after Find all uses (Shift+F12): the file and line of each, and the line’s code. Click one to go there.
  • Search finds text in all the project’s files; see Finding your way.

If you prefer VS Code or another editor, see Editor support. Everything the IDE does is also available from the command line.