設定
スタイルの設定はkscript.json内の"format"の下に記述してください。すべての設定は省略可能です:
{
"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"]
}
}これらの設定は標準からも取得できるため、複数のプロジェクトで同じスタイルを共有できます。標準ファイルの"format"の下に設定を記述し、kscript.jsonの"standard"で名前を指定してください。既定の標準であるkscript:recommendedは、上記の値を書き出します。kscript.json自身が設定した内容は、その標準よりも優先されます。
エディターでは、kscript.jsonもその標準設定もインデントを指定していない場合、エディター自体のタブ設定(editor.tabSize、editor.insertSpaces)がインデントに使われます。プロジェクトまたはその標準設定でformat.indentが指定されている場合は、そちらが優先されるため、プロジェクトの全員が同じ結果を得られます。