| 📦 Turbo JS 91999d1 k33g 12h ago | 1 | package jslang |
| 2 | |
| 3 | import _ "embed" |
| 4 | |
| 5 | // The starter files Turbo JS writes into a project's .turbo-js 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 |
| 14 | // JavaScript and Node rather than about editing, which is why they live here |
| 15 | // and not in turbo-core. |
| 16 | // |
| 17 | // **The .tmpl suffix is not decoration.** Each file is formatted with |
| 18 | // fmt.Sprintf before it is written, and settings.toml.tmpl holds `theme = %q` |
| 19 | // — which is not valid TOML. Naming it settings.toml would be a claim it |
| 20 | // cannot meet: a TOML linter would reject it, and Turbo JS itself would colour |
| 21 | // it as TOML and draw it as broken. The blanks each one takes are documented |
| 22 | // on profile.Templates, and templates_test.go holds them to it. |
| 23 | |
| 24 | // settingsTemplate is the settings file a project gets when it asks for one. |
| 25 | // |
| 26 | // autosave is on: a project that has gone to the trouble of creating a |
| 27 | // settings file has said what it wants, and the file is the visible, editable |
| 28 | // place to say otherwise. settings.Default() — what applies with no file at |
| 29 | // all — stays off. |
| 30 | // |
| 31 | //go:embed settings.toml.tmpl |
| 32 | var settingsTemplate string |
| 33 | |
| 34 | // snippetsTemplate is the snippets file a project gets when it asks for one. |
| 35 | // |
| 36 | // It lists every language name the editor knows in its `languages` comment, |
| 37 | // because that comment is where a user finds out what they may write there. A |
| 38 | // test iterates syntax.Registered() rather than a hardcoded list, so the |
| 39 | // comment cannot fall behind the registry. |
| 40 | // |
| 41 | //go:embed snippets.toml.tmpl |
| 42 | var snippetsTemplate string |
| 43 | |
| 44 | // toolsTemplate is the tools file a project gets when it asks for one. |
| 45 | // |
| 46 | // Six commands, and the two features that are invisible otherwise: a |
| 47 | // {{placeholder}} that asks for a value before the command runs — Run uses a |
| 48 | // real one, because a Node project has no single entry point the editor could |
| 49 | // know — and the `menu` key that puts a tool in a menu of its own. |
| 50 | // |
| 51 | //go:embed tools.toml.tmpl |
| 52 | var toolsTemplate string |
| 53 | |
| 54 | // agentsTemplate is the agents file a project gets when it asks for one. |
| 55 | // |
| 56 | // It takes two blanks, in this order: the editor's own project directory — |
| 57 | // which the example agent's arguments point into — and the path to the user's |
| 58 | // own agents file, which a comment names. |
| 59 | // |
| 60 | //go:embed acp.toml.tmpl |
| 61 | var agentsTemplate string |