Language support
This guide is also in the app, under Help › Guide. The dotted names are buttons, panels and options there: in the app, clicking one lights up its place in the window. That only works in the app.
Code Canvas reads code in two ways. Most languages have both.
- : Code Canvas reads the syntax of each file, without building or running anything. It draws an edge between two files when one depends on the other. These are the dependency edges, and the layout follows them.
- : when you click a symbol, the server for its language finds where it is defined, used and called. These are the language server edges.
Supported languages
Programming languages
Frameworks
Markup, styles and data
Dependencies, by language
These are the dependency edges, which show by default. asks its language server, which can show more.
For example, a file might import a function from another file. One dependency edge connects the import to the export. But the importing file might call that function in several places. When you click the function, its language server shows every place it is used in the file. It also shows its incoming and outgoing calls: the functions that call it and the ones it calls. The dependency edge only connects the import to the export.
A few examples of each language's edges
TypeScript and JavaScript
import { Chart } from './chart', require('./config'), dynamic import(), re-exports through barrel files, classes they extend and interfaces they implement, JSX, Vue, Svelte and Astro components they render, Astro content collections, and paths set in tsconfig.json. Scripts with no imports that no tsconfig.json or jsconfig.json takes in share one page: a script's edge goes to the script in its folder that declares a name it uses.
Python
import app.models and from .models import User, imports through a package's __init__.py, base classes, and imports only for type checkers.
Rust
mod declarations, use crate::shapes::Circle, other crates of the workspace, trait impls and supertraits, macros, and files read with include_str!.
Go
imports of a package, symbols from the same package, struct and interface embedding, and files embedded with //go:embed.
Java and Kotlin
imports, symbols from the same package, superclasses and interfaces, annotations and static members.
C#
using directives, global and static usings, base classes and interfaces, partial types, and attributes.
Swift
whole modules imported, the dependencies between targets in Package.swift or an XcodeGen project.yml, superclasses, protocols and extensions.
C, C++ and Objective-C
#include and #import, a declaration to the source defining it, base classes, namespaces, protocols and categories, and the include paths of compile_commands.json.
PHP
use statements, require and include, extends, implements and traits, and classes Composer autoloads.
Ruby
require and require_relative, classes Rails and Zeitwerk load by name, include and extend, and a route to its controller.
Shell
scripts brought in with source, and scripts run by their path.
WGSL and WESL
#include and Bevy's #import. An app often joins shaders' text, so a shader's edge also goes to the shader in its folder that declares a struct, function or constant it uses.
HTML and CSS
scripts, stylesheets and pictures a page (or an Astro component's markup) loads, links between pages, @import and pictures in url().
Markdown and configuration
links and images to other files, and the files a tsconfig.json extends or a JSON Schema refers to.
Modules and packages
Some languages import a whole module or package instead of a file. Then the edge goes to the folder of that module. For example, a Swift import Models goes to the folder of the Models module. A Go import goes to the folder of its package. In Package.swift, each dependency of a target connects the folders of the two modules.
These edges connect at the top of the folder, just under its label. An edge that connects in the middle of the side of a folder is different. It goes to a file inside that folder, and the folder is closed.
Language servers
Click a symbol in the code of a file, and its language server shows language server edges. What it finds depends on the server.
Most servers find definitions and uses. Many also find calls and type hierarchies. In the browser, Code Canvas comes with servers for TypeScript, JavaScript and Python. For other languages, says how to install one.