# Errors and good habits

Vi checks the code as you type. Problems show as red (errors: the app can't run) or yellow
(warnings: it runs, but something is off) underlines and in the **Problems** tab. Most have a
**Fix** button there, or a light bulb in the editor.

| You see | It means | The fix |
|---|---|---|
| `Unknown container 'heder'` | a misspelt or missing name | pick the suggested name, or **Create container 'heder'** |
| `Unknown function 'ad_task'` | the function doesn't exist | pick the suggested name, or **Create function 'ad_task()'** |
| `Unknown attribute 'colour'` | not an attribute Vi knows | **Change to 'color'** |
| `Nothing to run: mark the screen with 'main'…` | no `main` container | **Add main container**, or **Mark … as the main container** |
| `Your own files need no import…` | an `import` of a file of the project | **Remove this import line** |
| `'header' is also defined in src/a.vi` | the same name in two files | rename one of them |
| `'name_box' is defined inside 'form' and is not visible here` | an inside name used from outside | **Use 'form.name_box'** |

Good habits:

- **One job per file.** `config.vi` for settings, `theme.vi` for colours, a data file for the
  variables and the functions that change them, one file per piece of the screen in `components/`.
- **Colours in one place.** Name them once (`violet = rgb(109, 74, 255)`) and use the names.
- **Write a piece inside the one container that uses it**; give it its own block when several do.
  Right-click a container for **Move out** and **Move in**.
- **Name things for what they are:** `task_row`, `score_card`, `add_task()`.
- **Format Document** (Shift+Alt+F) tidies spacing and puts attributes in the same order
  everywhere: what it is, size, look, text, layout, children, events.
