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
|
package moonbitlang
import _ "embed"
// The starter files Turbo MoonBit writes into a project's .turbo-moonbit
// 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 MoonBit
// 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 MoonBit 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.
//
// Every MoonBit body in it is a TOML *literal* multi-line string — the form
// written with three apostrophes rather than three double quotes. (Spelling
// that out in words is deliberate: gofmt rewrites a bare run of apostrophes in
// a doc comment into typographic quotes.) MoonBit interpolates with \{…}, and
// a backslash before a brace is not one of TOML's escape sequences — so a body
// written in basic strings would not parse, and the snippets file the editor
// had just offered to create would be refused the moment it was read back.
//
//go:embed snippets.toml.tmpl
var snippetsTemplate string
// toolsTemplate is the tools file a project gets when it asks for one.
//
// Eight 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.
//
// `moon check` comes first rather than `moon build`, because it is the command
// that answers "is this sound?" without producing anything, and it is what the
// MoonBit toolchain itself puts in a project's pre-commit hook.
//
//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
|