Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/api/json/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -7928,6 +7928,12 @@
"description": "PEP 751 lock file",
"fileMatch": ["pylock.toml", "pylock.*.toml"],
"url": "https://json.schemastore.org/pylock.json"
},
{
"name": "Stylua Config",
"description": "Stylua configuration",
"fileMatch": [".stylua.toml", "stylua.toml"],
"url": "https://json.schemastore.org/stylua.json"
}
]
}
3 changes: 3 additions & 0 deletions src/negative_test/stylua/call-parens.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#:schema ../../schemas/json/stylua.json

call_parentheses = "Never"
105 changes: 105 additions & 0 deletions src/schemas/json/stylua.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://json.schemastore.org/stylua.json",
"title": "Stylua Config",
"description": "Configuration files for the Stylua formatter",
"type": "object",
"properties": {
"syntax": {
"description": "Specify a disambiguation for the style of Lua syntax being formatted.",
"type": "string",
"default": "All",
"enum": ["All", "Lua51", "Lua52", "Lua53", "Lua54", "LuaJIT", "Luau"]
},
"column_width": {
"description": "Approximate line length for printing.\nUsed as a guide for line wrapping - this is not a hard requirement: lines may fall under or over the limit.",
"type": "integer",
"default": 120
},
"line_endings": {
"description": "Line endings type.",
"type": "string",
"default": "Unix",
"enum": ["Unix", "Windows"],
"x-taplo": {
"docs": {
"enumValues": ["LF", "CRLF"]
}
}
},
"indent_type": {
"description": "Indent type.",
"type": "string",
"default": "Tabs",
"enum": ["Tabs", "Spaces"]
},
"indent_width": {
"type": "integer",
"default": 4,
"description": "Character size of single indentation.\nIf indent_type is set to Tabs, this option is used as a heuristic to determine column width only."
},
"quote_style": {
"description": "Quote style for string literals.",
"type": "string",
"default": "AutoPreferDouble",
"enum": [
"AutoPreferDouble",
"AutoPreferSingle",
"ForceDouble",
"ForceSingle"
],
"x-taplo": {
"docs": {
"enumValues": [
"Prefer double, but fallback to single if it has fewer escapes.",
"Prefer single, but fallback to double if it has fewer escapes.",
"Force double quotes regardless of escapes.",
"Force single quotes regardless of escapes."
]
}
}
},
"call_parentheses": {
"description": "Whether parentheses should be applied on function calls with a single string/table argument.",
"type": "string",
"default": "Always",
"enum": ["Always", "NoSingleString", "NoSingleTable", "None", "Input"],
"x-taplo": {
"docs": {
"enumValues": [
"Applies parentheses in all cases.",
"Omits parentheses on calls with a single string argument.",
"Omits parentheses on calls with a single table argument.",
"Omits parentheses in both cases.\nNote: parentheses are still kept in situations where removal can lead to obscurity (e.g. foo \"bar\".setup -> foo(\"bar\").setup, since the index is on the call result, not the string).",
"Removes all automation and preserves parentheses only if they were present in input code: consistency is not enforced."
]
}
}
},
"space_after_function_names": {
"type": "string",
"description": "Specify whether to add a space between the function name and parentheses.",
"default": "Never",
"enum": ["Never", "Definitions", "Calls", "Always"]
},
"collapse_simple_statement": {
"default": "Never",
"description": "Specify whether to collapse simple statements.",
"type": "string",
"enum": ["Never", "FunctionOnly", "ConditionalOnly", "Always"]
},
"sort_requires": {
"type": "object",
"description": "StyLua has built-in support for sorting require statements. We group consecutive require statements into a single \"block\", and then requires are sorted only within that block. Blocks of requires do not move around the file.\n\nStyLua only considers requires of the form local NAME = require(EXPR), and sorts lexicographically based on NAME. (StyLua can also sort Roblox services of the form local NAME = game:GetService(EXPR))\n\nRequires sorting is off by default.",
"properties": {
"enabled": {
"type": "boolean",
"default": false
}
},
"x-taplo": {
"initKeys": ["enabled"]
}
}
}
}
1 change: 1 addition & 0 deletions src/test/stylua/blank.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#:schema ../../schemas/json/stylua.json
14 changes: 14 additions & 0 deletions src/test/stylua/default.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#:schema ../../schemas/json/stylua.json

syntax = "All"
column_width = 120
line_endings = "Unix"
indent_type = "Tabs"
indent_width = 4
quote_style = "AutoPreferDouble"
call_parentheses = "Always"
collapse_simple_statement = "Never"
space_after_function_names = "Never"

[sort_requires]
enabled = false