turbo-editors/turbo-jspublic Fork 0
v1.0.0
Commits
Clone
git clone https://git.rickub.com/turbo-editors/turbo-js.git
git clone ssh://git@rickub.com/turbo-editors/turbo-js.git

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

📦 Turbo JS 91999d1 · on v1.0.0 · k33g · 12h ago
README.md · 115 lines · 10.3 KBmarkdown
Blame HistoryOpen raw

turbo-js

A Turbo C-style editor for JavaScript on Node.js, written in Go.

Built on turbo-core, the library every Turbo editor shares. What is in this repository is the command, the profile that says this editor is for JavaScript, a JavaScript scanner and a JSON one — about twelve hundred lines. Everything else lives in the library.

A full-screen terminal IDE with the Borland furniture — a menu bar with hot keys, movable windows that cast shadows, modal dialogs, a clickable status bar — and the things a Node editor needs today: syntax colouring that knows regular expressions, template literals, private fields and Node's globals, loadable colour themes, completion and diagnostics from typescript-language-server, shell windows, per-project settings, a project tree, snippets, windows onto coding agents, and the Node toolchain a menu away.

 File  Edit  Search  Run  Code  Options  Window  Snippets  Agent  JavaScript  Help
╔═[x]═══════════════════════════════════════ main.js ═══════════════════════════1═[■]╗
║ 1 #!/usr/bin/env node                                                          ▲║
║ 2 // Greets whoever is named on the command line, or JavaScript.               ▓║
║ 3 import { argv } from "node:process";                                         ░║
║ 4 import { Greeter } from "./greeter.js";                                      ░║
║ 5                                                                              ░║
║ 6 const who = argv[2] ?? "JavaScript";                                         ░║
║ 7 new Greeter(who).greet(3);                                                   ▼║
║◄▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░►║
╚═════════════════════════════════════════════════════════════════════════════════╝
 F1 Describe  F2 Save  F3 Open  F6 Window  F7 Next  F10 Menu  Alt-X Exit  1:1  LSP: ready

Getting started

make install

That builds the editor, puts it where your shell looks for commands, and reports what it found — the Go version it built with, where the binary went, whether that directory is on your PATH, and whether typescript-language-server is installed. Then, from any Node project:

turbo-js main.js

To build without installing, make build leaves the binary in bin/turbo-js. From the module proxy instead of a checkout: go install rickub.com/turbo-editors/turbo-js@latest.

For completion, install the language server as well — the editor works without it, and says so on the status bar:

npm install -g typescript-language-server typescript@6

The @6 is not optional: TypeScript 7 ships no tsserver.js, and the server refuses to start beside it. make install with --with-serverscripts/install.sh --with-server — runs that line for you.

The tutorial walks through a first session in about ten minutes, and demos/greeter is a small project to open once you have the editor.

Features

  • Every build knows what it isturbo-js -version and Help ▸ About name the version, the commit and the build date, stamped in by the linker from git describe rather than read from a constant somebody forgot to bump
  • Turbo Vision interface — menu bar with Alt-letter hot keys, overlapping movable and resizable windows, modal dialogs, mouse support throughout
  • Syntax colouring for nine languages — JavaScript by a hand-written scanner that knows regular expressions, template literals across lines, the hashbang line, private #fields, decorators and Node's globals; JSON with keys told from values; plus TOML, YAML, Markdown, HTML, XML, Dockerfiles and shell scripts from turbo-core
  • Themes in TOML, eleven embedded — Borland navy, dark grey, paper white, espresso, Catppuccin Frappé and Latte, cobalt, Darcula and IntelliJ Light, and a hueless monochrome in both polarities — and any number of your own, with inheritance between files and between style keys. Every shipped theme is held to its contrast by tests
  • Per-project settings in .turbo-js/settings.toml — pin a theme, turn on automatic saving — created from a menu item and never by itself, and re-read every time you save it
  • Completion, hover, definitions, references, implementations, symbols and diagnostics from typescript-language-server, all nine questions answered for plain JavaScript, entirely optional
  • Terminal windowsF8 opens a real shell in a window, with its own VT/ANSI emulator, scrollback and job control (Linux, macOS and Windows)
  • Project treeF9 shows the project's files in a window; walk it with the arrows and press Enter to open one
  • Snippets — a Snippets menu built from .turbo-js/snippets.toml, grouped into submenus and filtered by the file you are in; the chosen text is inserted at the cursor, re-indented to match
  • The Node toolchain a menu awayAlt-J runs npm install, npx prettier --write ., npx eslint ., node --test, node <script> and npm start from .turbo-js/tools.toml, each showing its output where the tool asked: a popup that fills in as it goes, a terminal window, or an editing window to search. Files the command rewrote are re-read for you, and a tool naming a menu of its own gets that menu on the bar
  • Agent windowsAlt-A opens a conversation with a coding agent that speaks the Agent Client Protocol, configured in .turbo-js/acp.toml; the code it sends in a ```js fence is coloured by the same scanner as your files, and copies straight out of the conversation
  • Editing with word movement, block indent, a shared clipboard, and undo that merges a run of typing into one step
  • Faithful files — line endings and the trailing newline are preserved, and saving is atomic
  • Automatic saving, off by default, writing a short while after you stop typing

Commands

Command What it does
make install Build and install onto your PATH
make build Compile into bin/turbo-js
make test Run the whole test suite
make check fmt, vet, then the tests — what a commit should pass
make run FILE=main.js Build and start the editor on a file
make help List every target
turbo-js [-theme name] [-no-lsp] [file...]
turbo-js -list-themes

Documentation

Full documentation in English and French, organised by the Diátaxis method:

Tutorial Your first Node program in Turbo JS
How-to install · install Node.js · run the tests · enable completion · write a theme · move around a file · ask about code · use a terminal · configure a project · browse a project · use snippets · run Node commands · talk to an agent · make a release
Reference command line · keyboard · menus · theme format · terminal windows · project settings · project tree · languages · snippets · JavaScript tools · agents and ACP · the version number
Explanation architecture · design decisions · colouring and completion · terminal windows · project settings · project tree · snippets · JavaScript tools · agent windows

The library's packages each carry their own README.md beside the code, in turbo-core.

Where the code is

main.go flags, the terminal, the wiring
internal/jslang the profile, the JavaScript and JSON scanners, the four starter files
demos/ a small Node project to open in the editor
everything else turbo-core

The dependency graph is drawn in docs/diagrams/packages.drawio, checked against go list.

Design in one line

Two dependencies — tcell/v2 and BurntSushi/toml — and everything else from the standard library, including the Language Server Protocol client. Both come through turbo-core; this repository adds none of its own. The design decisions page explains why.

Requirements

Go 1.26 or later to build it — the editor is written in Go even though it is an editor for JavaScript. A terminal with mouse reporting, which is all of them. Node and npm for the JavaScript menu; typescript-language-server with typescript@6 for completion. All three are optional.

Licence

The other editors in the family are MIT-licensed; this repository's licence file is the owner's to add.

  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
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# turbo-js

A Turbo C-style editor for JavaScript on Node.js, written in Go.

Built on **[turbo-core](https://rickub.com/turbo-editors/turbo-core)**, the library every Turbo editor shares. What is in this repository is the command, the profile that says this editor is for JavaScript, a JavaScript scanner and a JSON one — about twelve hundred lines. Everything else lives in the library.

A full-screen terminal IDE with the Borland furniture — a menu bar with hot keys, movable windows that cast shadows, modal dialogs, a clickable status bar — and the things a Node editor needs today: syntax colouring that knows regular expressions, template literals, private fields and Node's globals, loadable colour themes, completion and diagnostics from `typescript-language-server`, shell windows, per-project settings, a project tree, snippets, windows onto coding agents, and the Node toolchain a menu away.

```
 File  Edit  Search  Run  Code  Options  Window  Snippets  Agent  JavaScript  Help
╔═[x]═══════════════════════════════════════ main.js ═══════════════════════════1═[■]╗
║ 1 #!/usr/bin/env node                                                          ▲║
║ 2 // Greets whoever is named on the command line, or JavaScript.               ▓║
║ 3 import { argv } from "node:process";                                         ░║
║ 4 import { Greeter } from "./greeter.js";                                      ░║
║ 5                                                                              ░║
║ 6 const who = argv[2] ?? "JavaScript";                                         ░║
║ 7 new Greeter(who).greet(3);                                                   ▼║
║◄▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░►║
╚═════════════════════════════════════════════════════════════════════════════════╝
 F1 Describe  F2 Save  F3 Open  F6 Window  F7 Next  F10 Menu  Alt-X Exit  1:1  LSP: ready
```

## Getting started

```bash
make install
```

That builds the editor, puts it where your shell looks for commands, and reports what it found — the Go version it built with, where the binary went, whether that directory is on your `PATH`, and whether `typescript-language-server` is installed. Then, from any Node project:

```bash
turbo-js main.js
```

To build without installing, `make build` leaves the binary in `bin/turbo-js`. From the module proxy instead of a checkout: `go install rickub.com/turbo-editors/turbo-js@latest`.

For completion, install the language server as well — the editor works without it, and says so on the status bar:

```bash
npm install -g typescript-language-server typescript@6
```

The `@6` is not optional: TypeScript 7 ships no `tsserver.js`, and the server refuses to start beside it. `make install` with `--with-server``scripts/install.sh --with-server` — runs that line for you.

The [tutorial](docs/en/tutorials/getting-started.md) walks through a first session in about ten minutes, and [`demos/greeter`](demos/) is a small project to open once you have the editor.

## Features

- **Every build knows what it is** — `turbo-js -version` and **Help ▸ About** name the version, the commit and the build date, stamped in by the linker from `git describe` rather than read from a constant somebody forgot to bump
- **Turbo Vision interface** — menu bar with `Alt`-letter hot keys, overlapping movable and resizable windows, modal dialogs, mouse support throughout
- **Syntax colouring for nine languages** — JavaScript by a hand-written scanner that knows regular expressions, template literals across lines, the hashbang line, private `#fields`, decorators and Node's globals; JSON with keys told from values; plus TOML, YAML, Markdown, HTML, XML, Dockerfiles and shell scripts from turbo-core
- **Themes** in TOML, eleven embedded — Borland navy, dark grey, paper white, espresso, Catppuccin Frappé and Latte, cobalt, Darcula and IntelliJ Light, and a hueless monochrome in both polarities — and any number of your own, with inheritance between files and between style keys. Every shipped theme is held to its contrast by tests
- **Per-project settings** in `.turbo-js/settings.toml` — pin a theme, turn on automatic saving — created from a menu item and never by itself, and re-read every time you save it
- **Completion, hover, definitions, references, implementations, symbols and diagnostics** from `typescript-language-server`, all nine questions answered for plain JavaScript, entirely optional
- **Terminal windows** — `F8` opens a real shell in a window, with its own VT/ANSI emulator, scrollback and job control (Linux, macOS and Windows)
- **Project tree** — `F9` shows the project's files in a window; walk it with the arrows and press Enter to open one
- **Snippets** — a `Snippets` menu built from `.turbo-js/snippets.toml`, grouped into submenus and filtered by the file you are in; the chosen text is inserted at the cursor, re-indented to match
- **The Node toolchain a menu away** — `Alt-J` runs `npm install`, `npx prettier --write .`, `npx eslint .`, `node --test`, `node <script>` and `npm start` from `.turbo-js/tools.toml`, each showing its output where the tool asked: a popup that fills in as it goes, a terminal window, or an editing window to search. Files the command rewrote are re-read for you, and a tool naming a `menu` of its own gets that menu on the bar
- **Agent windows** — `Alt-A` opens a conversation with a coding agent that speaks the Agent Client Protocol, configured in `.turbo-js/acp.toml`; the code it sends in a ```js fence is coloured by the same scanner as your files, and copies straight out of the conversation
- **Editing** with word movement, block indent, a shared clipboard, and undo that merges a run of typing into one step
- **Faithful files** — line endings and the trailing newline are preserved, and saving is atomic
- **Automatic saving**, off by default, writing a short while after you stop typing

## Commands

| Command | What it does |
| --- | --- |
| `make install` | Build and install onto your `PATH` |
| `make build` | Compile into `bin/turbo-js` |
| `make test` | Run the whole test suite |
| `make check` | `fmt`, `vet`, then the tests — what a commit should pass |
| `make run FILE=main.js` | Build and start the editor on a file |
| `make help` | List every target |

```bash
turbo-js [-theme name] [-no-lsp] [file...]
turbo-js -list-themes
```

## Documentation

Full documentation in **[English](docs/en/)** and **[French](docs/fr/)**, organised by the [Diátaxis](https://diataxis.fr) method:

| | |
| --- | --- |
| **Tutorial** | [Your first Node program in Turbo JS](docs/en/tutorials/getting-started.md) |
| **How-to** | [install](docs/en/how-to/install.md) · [install Node.js](docs/en/how-to/install-node.md) · [run the tests](docs/en/how-to/run-the-tests.md) · [enable completion](docs/en/how-to/enable-completion.md) · [write a theme](docs/en/how-to/write-a-theme.md) · [move around a file](docs/en/how-to/navigate-code.md) · [ask about code](docs/en/how-to/ask-about-code.md) · [use a terminal](docs/en/how-to/use-a-terminal.md) · [configure a project](docs/en/how-to/configure-a-project.md) · [browse a project](docs/en/how-to/browse-a-project.md) · [use snippets](docs/en/how-to/use-snippets.md) · [run Node commands](docs/en/how-to/run-node-commands.md) · [talk to an agent](docs/en/how-to/talk-to-an-agent.md) · [make a release](docs/en/how-to/make-a-release.md) |
| **Reference** | [command line](docs/en/reference/cli.md) · [keyboard](docs/en/reference/keyboard.md) · [menus](docs/en/reference/menus.md) · [theme format](docs/en/reference/themes.md) · [terminal windows](docs/en/reference/terminal.md) · [project settings](docs/en/reference/project-settings.md) · [project tree](docs/en/reference/project-tree.md) · [languages](docs/en/reference/languages.md) · [snippets](docs/en/reference/snippets.md) · [JavaScript tools](docs/en/reference/javascript-tools.md) · [agents and ACP](docs/en/reference/acp.md) · [the version number](docs/en/reference/versioning.md) |
| **Explanation** | [architecture](docs/en/explanation/architecture.md) · [design decisions](docs/en/explanation/design-decisions.md) · [colouring and completion](docs/en/explanation/colouring-and-completion.md) · [terminal windows](docs/en/explanation/terminal-windows.md) · [project settings](docs/en/explanation/project-settings.md) · [project tree](docs/en/explanation/project-tree.md) · [snippets](docs/en/explanation/snippets.md) · [JavaScript tools](docs/en/explanation/javascript-tools.md) · [agent windows](docs/en/explanation/agent-windows.md) |

The library's packages each carry their own `README.md` beside the code, in [turbo-core](https://rickub.com/turbo-editors/turbo-core).

## Where the code is

| | |
| --- | --- |
| `main.go` | flags, the terminal, the wiring |
| `internal/jslang` | the profile, the JavaScript and JSON scanners, the four starter files |
| `demos/` | a small Node project to open in the editor |
| everything else | [turbo-core](https://rickub.com/turbo-editors/turbo-core) |

The dependency graph is drawn in [`docs/diagrams/packages.drawio`](docs/diagrams/packages.drawio), checked against `go list`.

## Design in one line

Two dependencies — `tcell/v2` and `BurntSushi/toml` — and everything else from the standard library, including the Language Server Protocol client. Both come through turbo-core; this repository adds none of its own. The [design decisions](docs/en/explanation/design-decisions.md) page explains why.

## Requirements

Go 1.26 or later to build it — the editor is written in Go even though it is an editor for JavaScript. A terminal with mouse reporting, which is all of them. Node and npm for the JavaScript menu; `typescript-language-server` with `typescript@6` for completion. All three are optional.

## Licence

The other editors in the family are MIT-licensed; this repository's licence file is the owner's to add.