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

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

📦 Turbo Python 6fc62ea · on v1.0.1 · k33g · 9h ago
templates.go · 64 lines · 2.7 KBGo Blame HistoryRaw
 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
package pythonlang

import _ "embed"

// The starter files Turbo Python writes into a project's .turbo-python
// directory.
//
// They live in four files beside this one and are embedded into the binary at
// compile time. Written out as text rather than encoded from structs because
// they are meant to be read and edited by a person: the comments in them say
// what each key is for, which is the whole reason the editor offers to create
// them at all rather than only to read them.
//
// Their contents are the one part of these four files that is about Python
// rather than about editing, which is why they live here and not in turbo-core.
//
// **The .tmpl suffix is not decoration.** Each file is formatted with
// fmt.Sprintf before it is written, and settings.toml.tmpl holds `theme = %q`
// — which is not valid TOML. Naming it settings.toml would be a claim it
// cannot meet: a TOML linter would reject it, and Turbo Python itself would
// colour it as TOML and draw it as broken. The blanks each one takes are
// documented on profile.Templates, and templates_test.go holds them to it.

// settingsTemplate is the settings file a project gets when it asks for one.
//
// autosave is on: a project that has gone to the trouble of creating a
// settings file has said what it wants, and the file is the visible, editable
// place to say otherwise. settings.Default() — what applies with no file at
// all — stays off.
//
//go:embed settings.toml.tmpl
var settingsTemplate string

// snippetsTemplate is the snippets file a project gets when it asks for one.
//
// It lists every language name the editor knows in its `languages` comment,
// because that comment is where a user finds out what they may write there. A
// test iterates syntax.Registered() rather than a hardcoded list, so the
// comment cannot fall behind the registry.
//
//go:embed snippets.toml.tmpl
var snippetsTemplate string

// toolsTemplate is the tools file a project gets when it asks for one.
//
// Six commands, and the two features that are invisible otherwise: a
// {{placeholder}} that asks for a value before the command runs, and the
// `menu` key that puts a tool in a menu of its own.
//
// The first of the six creates the virtual environment, because in Python that
// is the step that has to happen before any of the others can, and the one a
// newcomer to a project most often has not done yet.
//
//go:embed tools.toml.tmpl
var toolsTemplate string

// agentsTemplate is the agents file a project gets when it asks for one.
//
// It takes two blanks, in this order: the editor's own project directory —
// which the example agent's arguments point into — and the path to the user's
// own agents file, which a comment names.
//
//go:embed acp.toml.tmpl
var agentsTemplate string