# Configuration
`angular-switcher` reads TOML configuration with the following precedence (first match wins):
1. `--config <PATH>` on the command line
2. `.angular-switcher.toml` at `$ZED_WORKTREE_ROOT`
3. `$XDG_CONFIG_HOME/angular-switcher/config.toml` (macOS: `~/Library/Application Support/angular-switcher/config.toml`)
4. Built-in defaults
When no config file is found, the built-in defaults are used — they match a standard Angular project out of the box.
## Full schema
See [`templates/angular-switcher.toml`](../templates/angular-switcher.toml) for an annotated example.
### `[cycle]`
| `order` | `Vec<String>` | `["ts","html","style","spec"]` | Must reference targets defined under `[targets.*]` |
| `wrap` | `bool` | `true` | Cycle wraps past the end |
| `skip_missing` | `bool` | `true` | Skip targets whose sibling file doesn't exist |
### `[targets.<name>]`
Each target identifies a category of files. The default config defines `ts`, `html`, `style`, and `spec`.
| `extensions` | `Vec<String>` | — | Required. File extensions (no dot) that belong to this target |
| `exclude_suffixes` | `Vec<String>` | `[]` | Filename suffixes that disqualify a match. Useful when one extension is a prefix of another (e.g. `ts` vs `spec.ts`) |
| `preference` | `Vec<String>` | `[]` | When multiple extensions match an existing file, prefer the first listed |
### `[naming]`
| `fallback_to_stem` | `bool` | `true` | When the current file matches no target, fall back to the filename stem |
## Recipes
### Skip specs from the cycle
```toml
[cycle]
order = ["ts", "html", "style"]
```
### Prefer Less over Sass
```toml
[targets.style]
extensions = ["less", "scss", "css", "sass"]
preference = ["less", "scss", "css", "sass"]
```
### Use a non-standard spec suffix (e.g. `.test.ts`)
```toml
[targets.ts]
extensions = ["ts"]
exclude_suffixes = ["test.ts"]
[targets.spec]
extensions = ["test.ts"]
```
### Disable wrap (error at the last sibling instead of cycling back)
```toml
[cycle]
wrap = false
```
## Debugging
Pass `--verbose` to see resolution steps on stderr:
```bash
$ angular-switcher --verbose --print foo.component.ts
config: /Users/me/.config/angular-switcher/config.toml
current: target='ts' basename='foo.component' parent='.'
opening: ./foo.component.html
./foo.component.html
```
Strict-schema typos surface as `config error: ...` with exit code `3`.