turbo-editors/turbo-corepublic Fork 0
v1.0.1
Commits
Clone
git clone https://git.rickub.com/turbo-editors/turbo-core.git
git clone ssh://git@rickub.com/turbo-editors/turbo-core.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

📦 Turbo Core f3ade8d · on v1.0.1 · k33g · 6h ago
README.md · 95 lines · 4.1 KBmarkdown
Blame HistoryOpen raw

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 Gorickub.com/turbo-editors/turbo-go
  • Turbo Rustrickub.com/turbo-editors/turbo-rust
  • Turbo Pythonrickub.com/turbo-editors/turbo-python
  • Turbo MoonBitrickub.com/turbo-editors/turbo-moonbit
  • Turbo Golorickub.com/turbo-editors/turbo-golo
  • Turbo JSrickub.com/turbo-editors/turbo-js

The whole of the difference

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 walks through a working IDE for a language of your own, in about eighty lines. It has been run start to finish.

go get rickub.com/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.

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

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:

python3 ~/.claude/skills/quality/scripts/quality_report.py --workspace .

Documentation

Full documentation in English and French, following Diátaxis:

  • English — tutorial, five how-to guides, four reference pages, two explanations
  • Français — le même, en français

Licence

MIT. See LICENSE.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# 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)** — `rickub.com/turbo-editors/turbo-go`
- **[Turbo Rust](https://rickub.com/turbo-editors/turbo-rust)** — `rickub.com/turbo-editors/turbo-rust`
- **[Turbo Python](https://rickub.com/turbo-editors/turbo-python)** — `rickub.com/turbo-editors/turbo-python`
- **[Turbo MoonBit](https://rickub.com/turbo-editors/turbo-moonbit)** — `rickub.com/turbo-editors/turbo-moonbit`
- **[Turbo Golo](https://rickub.com/turbo-editors/turbo-golo)** — `rickub.com/turbo-editors/turbo-golo`
- **[Turbo JS](https://rickub.com/turbo-editors/turbo-js)** — `rickub.com/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 rickub.com/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).