| 📦 Turbo Python 6fc62ea k33g 10h ago | 1 | package pythonlang |
| 2 | |
| 3 | import _ "embed" |
| 4 | |
| 5 | // The starter files Turbo Python writes into a project's .turbo-python |
| 6 | // directory. |
| 7 | // |
| 8 | // They live in four files beside this one and are embedded into the binary at |
| 9 | // compile time. Written out as text rather than encoded from structs because |
| 10 | // they are meant to be read and edited by a person: the comments in them say |
| 11 | // what each key is for, which is the whole reason the editor offers to create |
| 12 | // them at all rather than only to read them. |
| 13 | // |
| 14 | // Their contents are the one part of these four files that is about Python |
| 15 | // rather than about editing, which is why they live here 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 Python itself would |
| 21 | // colour it as TOML and draw it as broken. The blanks each one takes are |
| 22 | // documented 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, and the |
| 48 | // `menu` key that puts a tool in a menu of its own. |
| 49 | // |
| 50 | // The first of the six creates the virtual environment, because in Python that |
| 51 | // is the step that has to happen before any of the others can, and the one a |
| 52 | // newcomer to a project most often has not done yet. |
| 53 | // |
| 54 | //go:embed tools.toml.tmpl |
| 55 | var toolsTemplate string |
| 56 | |
| 57 | // agentsTemplate is the agents file a project gets when it asks for one. |
| 58 | // |
| 59 | // It takes two blanks, in this order: the editor's own project directory — |
| 60 | // which the example agent's arguments point into — and the path to the user's |
| 61 | // own agents file, which a comment names. |
| 62 | // |
| 63 | //go:embed acp.toml.tmpl |
| 64 | var agentsTemplate string |