KScript docs
EN

Formatting

Settings

Put style settings under "format" in kscript.json. Every setting is optional:

JSON
{
  "format": {
    "indent": 2,              // spaces per level, or "tab"
    "tab_width": 2,            // with "indent": "tab", the columns a tab counts as
    "print_width": 80,         // the longest a line should be; longer lines are wrapped
    "max_blank_lines": 1,       // blank lines kept in a row
    "end_of_line": "auto",      // auto (keep each file's), lf or crlf
    "preserve": ["pre-like"], // elements whose content is kept exactly
    "rules": {},              // turn rules off, e.g. { "statement_per_line": false }; see below
    "enabled": true,          // false: no formatting anywhere in this project
    "include": ["**/*.kscript", "**/*.ks.xml", "**/*.html"],
    "exclude": ["_templates", "node_modules", ".git"]
  }
}

These settings can also come from a standard, so several projects can share one style: put them under "format" in a standard file and name it with "standard" in kscript.json. The default standard, kscript:recommended, writes out the values above. Anything kscript.json sets itself wins over its standard.

In the editor, the editor's own tab settings (editor.tabSize, editor.insertSpaces) are used for the indent when neither kscript.json nor its standard sets it. When a project or its standard sets format.indent, that wins, so everyone on the project gets the same result.