turbo-editors/turbo-rustpublic Fork 0
main
Commits
Clone
git clone https://git.rickub.com/turbo-editors/turbo-rust.git
git clone ssh://git@rickub.com/turbo-editors/turbo-rust.git

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

templates.go · 59 lines · 2.5 KBGo Blame HistoryRaw
📦 Turbo Rust 713ea5c k33g 11h ago1package rustlang
2
3import _ "embed"
4
5// The starter files Turbo Rust writes into a project's .turbo-rust directory.
6//
7// They live in four files beside this one and are embedded into the binary at
8// compile time. Written out as text rather than encoded from structs because
9// they are meant to be read and edited by a person: the comments in them say
10// what each key is for, which is the whole reason the editor offers to create
11// them at all rather than only to read them.
12//
13// Their contents are the one part of these four files that is about Rust
14// rather than about editing, which is why they live here and not in turbo-core.
15//
16// **The .tmpl suffix is not decoration.** Each file is formatted with
17// fmt.Sprintf before it is written, and settings.toml.tmpl holds `theme = %q`
18// — which is not valid TOML. Naming it settings.toml would be a claim it
19// cannot meet: a TOML linter would reject it, and Turbo Rust itself would colour it
20// as TOML and draw it as broken. The blanks each one takes are documented on
21// profile.Templates, and templates_test.go holds them to it.
22
23// settingsTemplate is the settings file a project gets when it asks for one.
24//
25// autosave is on: a project that has gone to the trouble of creating a
26// settings file has said what it wants, and the file is the visible, editable
27// place to say otherwise. settings.Default() — what applies with no file at
28// all — stays off.
29//
30//go:embed settings.toml.tmpl
31var settingsTemplate string
32
33// snippetsTemplate is the snippets file a project gets when it asks for one.
34//
35// It lists every language name the editor knows in its `languages` comment,
36// because that comment is where a user finds out what they may write there. A
37// test iterates syntax.Registered() rather than a hardcoded list, so the
38// comment cannot fall behind the registry.
39//
40//go:embed snippets.toml.tmpl
41var snippetsTemplate string
42
43// toolsTemplate is the tools file a project gets when it asks for one.
44//
45// Five commands, and the two features that are invisible otherwise: a
46// {{placeholder}} that asks for a value before the command runs, and the
47// `menu` key that puts a tool in a menu of its own.
48//
49//go:embed tools.toml.tmpl
50var toolsTemplate string
51
52// agentsTemplate is the agents file a project gets when it asks for one.
53//
54// It takes two blanks, in this order: the editor's own project directory —
55// which the example agent's arguments point into — and the path to the user's
56// own agents file, which a comment names.
57//
58//go:embed acp.toml.tmpl
59var agentsTemplate string