Skip to Content
GuidesProjects and BuildingBackground compilation

Background Compilation

While you type, Klive compiles your project in the background and uses the result to drive the editor’s live features. You do not have to turn anything on for this. The Compile in the background setting only adds inline error markers, and the same background check for the external toolchains.

What happens while you type

When you stop typing for about 1.2 seconds, Klive compiles the project quietly. Nothing is written to disk. When the compile finishes:

  • Editor intelligence is refreshed: hover information, go to definition, find references and rename work with the latest symbols.
  • Semantic colours are refreshed: labels, macros, structs and constants are coloured by their role.
  • Inline errors are shown, if Compile in the background is on (see below). Errors and warnings are underlined in the editor and marked in the scrollbar’s overview ruler, and hovering an underline shows the message.

What gets compiled

  • In a Klive project, Klive compiles the project’s build root, whichever file you are editing. An error in an included file is reported at its own line.
  • A ZX BASIC program is checked with Boriel BASIC’s zxbc --parse-only. The check reports errors and warnings, marked on the whole line, but gives the editor none of the program’s own names; see Editing ZX BASIC.
  • A folder that is not a Klive project is not compiled.

To make a file the build root, right-click it in the Project Explorer and choose Promote to Build Root.

The setting

Settings › Editor › Compile in the background is off by default. It is saved with the IDE, so it applies to every project. When it is on:

  • errors and warnings are shown inline, as described above;
  • the external toolchains, such as sjasmplus, are compiled in the background too.

The Klive Z80 Assembler and Boriel BASIC always compile in the background, whatever the setting says. Boriel BASIC’s check (zxbc --parse-only) is cheap and writes no files.

💡

If an external toolchain makes the editor feel slow on a large project, turn the setting off. The Klive Z80 Assembler keeps the editor’s intelligence working without it.

Last updated on