mirror of
https://github.com/lune-org/mlua-luau-scheduler.git
synced 2025-04-10 21:40:55 +01:00
Add stylua and other formatters, apply formatting
This commit is contained in:
parent
99409e4b7a
commit
ae1535fcc4
6 changed files with 44 additions and 12 deletions
8
.vscode/extensions.json
vendored
Normal file
8
.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"rust-lang.rust-analyzer",
|
||||||
|
"esbenp.prettier-vscode",
|
||||||
|
"JohnnyMorganz.stylua",
|
||||||
|
"DavidAnson.vscode-markdownlint"
|
||||||
|
]
|
||||||
|
}
|
17
.vscode/settings.json
vendored
Normal file
17
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"luau-lsp.sourcemap.enabled": false,
|
||||||
|
"luau-lsp.types.roblox": false,
|
||||||
|
"rust-analyzer.check.command": "clippy",
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"stylua.searchParentDirectories": true,
|
||||||
|
"prettier.tabWidth": 2,
|
||||||
|
"[luau][lua]": {
|
||||||
|
"editor.defaultFormatter": "JohnnyMorganz.stylua"
|
||||||
|
},
|
||||||
|
"[json][jsonc][markdown][yaml]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[rust]": {
|
||||||
|
"editor.defaultFormatter": "rust-lang.rust-analyzer"
|
||||||
|
}
|
||||||
|
}
|
|
@ -50,7 +50,7 @@ lua.globals().set(
|
||||||
"readFile",
|
"readFile",
|
||||||
lua.create_async_function(|lua, path: String| async move {
|
lua.create_async_function(|lua, path: String| async move {
|
||||||
// Spawn background task that does not take up resources on the lua thread
|
// Spawn background task that does not take up resources on the lua thread
|
||||||
// Normally, futures in mlua can not be shared across threads, but this can
|
// Normally, futures in mlua can not be shared across threads, but this can
|
||||||
let task = lua.spawn(async move {
|
let task = lua.spawn(async move {
|
||||||
match read_to_string(path).await {
|
match read_to_string(path).await {
|
||||||
Ok(s) => Ok(Some(s)),
|
Ok(s) => Ok(Some(s)),
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
--!nolint UnknownGlobal
|
--!nolint UnknownGlobal
|
||||||
|
|
||||||
local _, err = pcall(function()
|
local _, err = pcall(function()
|
||||||
local file = readFile("Cargo.toml")
|
local file = readFile("Cargo.toml")
|
||||||
if file ~= nil then
|
if file ~= nil then
|
||||||
print("Cargo.toml found!")
|
print("Cargo.toml found!")
|
||||||
print("Contents:")
|
print("Contents:")
|
||||||
print(file)
|
print(file)
|
||||||
else
|
else
|
||||||
print("Cargo.toml not found!")
|
print("Cargo.toml not found!")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if err ~= nil then
|
if err ~= nil then
|
||||||
print("Error while reading file: " .. err)
|
print("Error while reading file: " .. err)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
--!nocheck
|
--!nocheck
|
||||||
--!nolint UnknownGlobal
|
--!nolint UnknownGlobal
|
||||||
|
|
||||||
|
|
||||||
if math.random() < 0.25 then
|
if math.random() < 0.25 then
|
||||||
error("Unlucky error!")
|
error("Unlucky error!")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local main = coroutine.running()
|
local main = coroutine.running()
|
||||||
local start = os.clock()
|
local start = os.clock()
|
||||||
|
|
||||||
|
|
9
stylua.toml
Normal file
9
stylua.toml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
column_width = 100
|
||||||
|
line_endings = "Unix"
|
||||||
|
indent_type = "Tabs"
|
||||||
|
indent_width = 4
|
||||||
|
quote_style = "AutoPreferDouble"
|
||||||
|
call_parentheses = "Always"
|
||||||
|
|
||||||
|
[sort_requires]
|
||||||
|
enabled = true
|
Loading…
Add table
Reference in a new issue