# turbo-core The library every Turbo editor is built on. turbo-core is a Turbo C-style terminal IDE with a hole where the language goes: a menu bar, movable overlapping windows, modal dialogs, mouse support, loadable TOML themes, completion over LSP, terminal windows running a real shell, per-project settings, a project tree, snippets, and a menu of the commands a project runs on itself. None of it knows what language is being edited. An editor built on it is a command, a `profile.Profile`, and a scanner: - **[Turbo Go](https://rickub.com/turbo-editors/turbo-go)** — `codeberg.org/turbo-editors/turbo-go` - **[Turbo Rust](https://codeberg.org/turbo-editors/turbo-rust)** — `codeberg.org/turbo-editors/turbo-rust` - **[Turbo Python](https://codeberg.org/turbo-editors/turbo-python)** — `codeberg.org/turbo-editors/turbo-python` - **[Turbo MoonBit](https://codeberg.org/turbo-editors/turbo-moonbit)** — `codeberg.org/turbo-editors/turbo-moonbit` - **[Turbo Golo](https://codeberg.org/turbo-editors/turbo-golo)** — `codeberg.org/turbo-editors/turbo-golo` - **[Turbo JS](https://codeberg.org/turbo-editors/turbo-js)** — `codeberg.org/turbo-editors/turbo-js` ## The whole of the difference ```go profile.Profile{ Name: "Turbo Rust", Slug: "turbo-rust", Language: "Rust", ToolsMenu: "Rus~t~", RootMarkers: []string{"Cargo.toml"}, Server: profile.Server{ Command: "rust-analyzer", InstallHint: "rustup component add rust-analyzer", Dirs: []string{cargoBinDir()}, }, Templates: profile.Templates{Settings: …, Snippets: …, Tools: …}, } ``` That, plus `syntax.Register` for the colouring, is everything Turbo Rust is that Turbo Go is not. ## Getting started [Build an editor](docs/en/tutorials/build-an-editor.md) walks through a working IDE for a language of your own, in about eighty lines. It has been run start to finish. ```bash go get codeberg.org/turbo-editors/turbo-core ``` Go 1.26.5 or later. ## What is in it Sixteen packages. Dependencies run strictly downwards, with no cycles and no interface indirection introduced to prevent one. | Package | What it holds | | --- | --- | | `profile` | The editor's identity: name, slug, language server, starter templates | | `buffer` | The text of one file: lines of runes, cursor, selection, undo, search | | `projectfile` | Atomic writes of a project's own TOML files | | `version` | What build of itself a binary is | | `lsp` | LSP framing, JSON-RPC 2.0, the child process | | `theme` | TOML into tcell styles; eleven embedded themes plus the user's own | | `syntax` | Colouring for eight shared languages, the registry an editor adds its own to, and the scanner toolkit | | `settings` `snippets` `tools` | A project's own three files | | `ui` | Turbo Vision widgets: painter, desktop, window, menu, dialog, controls | | `editor` | The editing widget: viewport, scrolling, keys, mouse | | `terminal` | A shell in a window: pty, VT/ANSI emulator, the widget | | `filetree` | A project's files as an expandable tree | | `app` | Assembly: menus, dialogs, event routing, completion, the server's lifecycle | Each has a `README.md` of its own. The dependency graph is drawn in [`docs/diagrams/packages.drawio`](docs/diagrams/packages.drawio). **Three third-party dependencies**: `tcell/v2` for the terminal, `BurntSushi/toml` for every configuration file, and `golang.org/x/sys` for the pty ioctls. The tokeniser, the JSON-RPC client, the LSP framing and the VT emulator are hand-written. ## Build and test ```bash make test # the whole suite — the single documented command make race # the same under the race detector make cover # statement coverage per package make check # fmt, vet and test — what a commit should pass make help # every target ``` Quality gate, separate from the tests: ```bash python3 ~/.claude/skills/quality/scripts/quality_report.py --workspace . ``` ## Documentation Full documentation in **English** and **French**, following [Diátaxis](https://diataxis.fr): - [English](docs/en/README.md) — tutorial, five how-to guides, four reference pages, two explanations - [Français](docs/fr/README.md) — le même, en français ## Licence MIT. See [LICENSE](LICENSE).