turbo-editors/turbo-corepublic Fork 0
28d59854361aeda8541d853093e732126f3d7bff
Commits
Clone
git clone https://git.rickub.com/turbo-editors/turbo-core.git
git clone ssh://git@rickub.com/turbo-editors/turbo-core.git

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

profile.md · 84 lines · 3.7 KBmarkdown Blame HistoryRaw
🛟 Updated. 28d5985 k33g 18h ago1# Reference: profile
2
3> Neutral, exhaustive description of `codeberg.org/turbo-editors/turbo-core/profile`.
4
5`Profile` is the value an editor built on turbo-core differs by. Every field that would otherwise be a hardcoded name, path or command is here.
6
7## Profile
8
9| Field | Type | Default | Description |
10| --- | --- | --- | --- |
11| `Name` | `string` | `""` | What the editor calls itself, in window titles and the About box. `"Turbo Go"`. Also sent to the language server as the client's name. |
12| `Slug` | `string` | `""` | Its one-word name. `"turbo-go"`. The binary, the project directory, the user directory and the environment variables are all derived from it. |
13| `Language` | `string` | `""` | What the editor is for, in prose meant to be read. `"Go"`, `"Rust"`. Appears in messages and in the About box, not in file formats. |
14| `ToolsMenu` | `string` | `""` | The label of the toolchain menu, with its hot key marked between tildes. `"~G~o"`, `"Rus~t~"`. |
15| `RootMarkers` | `[]string` | `nil` | Files that mark a project's root, in the order they are looked for. `["go.mod"]`, `["Cargo.toml"]`. Empty means no walk up. |
16| `Server` | `Server` | zero | The language server. The zero value means the editor runs without one. |
17| `Templates` | `Templates` | zero | The starter files the editor offers to write. |
18
19### Derived values
20
21| Method | Returns | Example for `Slug: "turbo-go"` |
22| --- | --- | --- |
23| `ProjectDir()` | `string` | `".turbo-go"` |
24| `UserDir()` | `string` | `"~/.config/turbo-go"`, or `""` when the system has no configuration directory |
25| `ThemeDir()` | `string` | `"~/.config/turbo-go/themes"`, or `""` |
26| `DirEnvVar()` | `string` | `"TURBO_GO_DIR"` |
27| `ThemeDirEnvVar()` | `string` | `"TURBO_GO_THEME_DIR"` |
28| `SnippetDirEnvVar()` | `string` | `"TURBO_GO_SNIPPET_DIR"` |
29
30`UserDir` returns the value of `DirEnvVar` when it is set. `ThemeDir` returns the value of `ThemeDirEnvVar` when it is set, and that variable names the theme directory itself rather than the directory above it.
31
32A slug's dashes become underscores in an environment variable name: `turbo-rust` gives `TURBO_RUST_THEME_DIR`.
33
34## Server
35
36| Field | Type | Default | Description |
37| --- | --- | --- | --- |
38| `Command` | `string` | `""` | The executable's name, looked up on PATH first. `"gopls"`, `"rust-analyzer"`. |
39| `Args` | `[]string` | `nil` | The arguments it is started with. gopls takes `["serve"]`; rust-analyzer takes none. |
40| `InstallHint` | `string` | `""` | One command the user can copy when the server is missing. Shown on the status bar, so it must fit on a line. |
41| `Dirs` | `[]string` | `nil` | Extra directories searched after PATH, in order. Empty strings are skipped. |
42
43### Example
44
45```go
46profile.Server{
47 Command: "gopls",
48 Args: []string{"serve"},
49 InstallHint: "go install golang.org/x/tools/gopls@latest",
50 Dirs: []string{goBinDir()},
51}
52```
53
54## Templates
55
56| Field | Type | Formatting arguments, in order |
57| --- | --- | --- |
58| `Settings` | `string` | the theme name (`%q`), the autosave delay (`%q`) |
59| `Snippets` | `string` | the ungrouped group's name (`%s`), the user's own snippets path (`%s`) |
60| `Tools` | `string` | none |
61
62A template with the wrong number of verbs produces `%!s(MISSING)` or `%!(EXTRA …)` in the file that is written; nothing checks it for you.
63
64### Example
65
66```go
67const settingsTemplate = `# turbo-go project settings.
68
69[editor]
70
71theme = %q
72autosave = false
73autosave_delay = %q
74`
75```
76
77## Errors
78
79`profile` returns no errors. A `Profile` with an empty `Slug` produces a project directory called `"."` and environment variables called `_DIR`; nothing refuses it.
80
81## See also
82
83- [Talk to a language server](../how-to/talk-to-a-language-server.md)
84- [Write the starter files](../how-to/write-the-starter-files.md)