# turbo-golo A Turbo C-style editor for Golo, 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 Golo, and the Golo scanner — about a thousand lines, comments and all. 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 Golo editor needs: syntax colouring written against GoloScript's own lexer, loadable colour themes, completion and diagnostics from `golo lsp`, shell windows, per-project settings, a project tree, snippets, and the GoloScript toolchain a menu away. ``` File Edit Search Run Code Options Window Snippets Golo Help ╔═[x]═════════════════════════════ hello.golo ══════════════════════════════1═[■]╗ ║ 1 module hello.World ▲║ ║ 2 ▓║ ║ 3 # Greet someone several times ░║ ║ 4 struct Greeting = { name, times } ░║ ║ 5 ░║ ║ 6 function greet = |g| { ░║ ║ 7 foreach i in range(1, g: times() + 1) { ░║ ║ 8 println("Hello, " + g: name() + "! (" + i + ")") ░║ ║ 9 } ▼║ ║◄▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░►║ ╚════════════════════════════════════════════════════════════════════════════════╝ F1 Describe F2 Save F3 Open F6 Window F7 Next F10 Menu 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 `golo` is installed. Then, from any directory of Golo scripts: ```bash turbo-golo main.golo ``` To build without installing, `make build` leaves the binary in `bin/turbo-golo`. From the module proxy instead of a checkout: `go install rickub.com/turbo-editors/turbo-golo@latest`. For completion and diagnostics, install GoloScript as well — the editor works without it, and says so on the status bar. The language server is the interpreter itself, in `golo lsp` mode, so there is nothing separate to install: a machine that can run Golo can complete Golo. Precompiled binaries are on [the release page](https://codeberg.org/TypeUnsafe/golo-script/releases); [the install guide](docs/en/how-to/install-goloscript.md) covers them, building from source, and how to check the editor really found it. The [tutorial](docs/en/tutorials/getting-started.md) walks through a first session in about ten minutes, and [`demos/`](demos/) holds three Golo programs to open in it — a small one, one with tests, and a tour of every construct the scanner colours. ## Features - **Every build knows what it is** — `turbo-golo -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** — Golo by a hand-written scanner that follows GoloScript's lexer: `#` and `----` comments, strings carried to their closing quote wherever it is, `"""` multi-line strings, character literals, the `L` and `F` suffixes, the rule that keeps `1..3` an integer and a range, and names made of any Unicode letter or emoji. Plus TOML, YAML, Markdown, JavaScript, HTML, XML, Dockerfiles and shell scripts from turbo-core - **Types by convention** — a capitalised name is a struct, a union or a variant, because that is how Golo writes them; `Some`, `None`, `Ok` and `Err` are types here and not constants, because in Golo they are variants of ordinary unions from `gololang.Errors` - **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-golo/settings.toml` — pin a theme, turn on automatic saving — created from a menu item, never by itself, and re-read on every save so a change takes effect without a restart - **Completion, hover, go-to-definition, references, symbols and diagnostics** from `golo lsp`, entirely optional. The server is the interpreter, looked for on `PATH` and in `/usr/local/bin`, where GoloScript's installer puts it. It does not answer type definitions, and the editor says so rather than pretending - **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-golo/snippets.toml`, grouped into submenus and filtered by the file you are in; the chosen text is inserted at the cursor and re-indented to match - **The GoloScript toolchain a menu away** — `Alt-G` runs the script, the tests, the debugger, the REPL, `golo new`, `gogolo build` and `wagolo build` from `.turbo-golo/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. Golo has no manifest, so six of the eight commands ask which file they are for before they run — and a tool naming a `menu` of its own gets that menu on the bar - **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-golo` | | `make test` | Run the whole test suite | | `make check` | `fmt`, `vet`, then the tests — what a commit should pass | | `make run FILE=x.golo` | Build and start the editor on a file | | `make help` | List every target | ```bash turbo-golo [-theme name] [-no-lsp] [file...] turbo-golo -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 Golo program in Turbo Golo](docs/en/tutorials/getting-started.md) | | **How-to** | [install the editor](docs/en/how-to/install.md) · [install GoloScript](docs/en/how-to/install-goloscript.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 Golo commands](docs/en/how-to/run-golo-commands.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) · [Golo tools](docs/en/reference/golo-tools.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) · [Golo tools](docs/en/explanation/golo-tools.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/gololang` | the profile, the Golo scanner, the three starter files | | `demos/` | three Golo programs to open in the editor; each runs under `golo` | | 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` by `diagram_test.go`. ## Design in one line Two dependencies — `tcell/v2` and `BurntSushi/toml` — and everything else from the standard library, including the scanner toolkit and 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 Golo. A terminal with mouse reporting, which is all of them. GoloScript is optional, and is what completion, the error marks and the Golo menu's commands need. ## Licence See [LICENSE](LICENSE).