Add stylua (#105)

This commit is contained in:
Kisaragi Hiu 2022-06-21 06:21:27 +09:00 committed by GitHub
parent 67853e98b1
commit 2fa9dd97ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 0 deletions

View file

@ -7,6 +7,11 @@ The format is based on [Keep a Changelog].
### Enhancements
* shfmt uses 4 spaces instead of tabs by default.
### Formatters
* [stylua](https://github.com/JohnnyMorganz/StyLua) for Lua ([#105]).
[#105]: https://github.com/raxod502/apheleia/pull/105
## 3.0 (released 2022-06-01)
### Breaking changes
* The arguments of formatters defined as Elisp functions has changed.

View file

@ -936,6 +936,7 @@ being run, for diagnostic purposes."
(phpcs . ("apheleia-phpcs"))
(prettier . (npx "prettier" "--stdin-filepath" filepath))
(shfmt . ("shfmt" "-i" "4"))
(stylua . ("stylua" "-"))
(rustfmt . ("rustfmt" "--quiet" "--emit" "stdout"))
(terraform . ("terraform" "fmt" "-")))
"Alist of code formatting commands.
@ -1064,6 +1065,7 @@ function: %s" command)))
(kotlin-mode . ktlint)
(latex-mode . latexindent)
(LaTeX-mode . latexindent)
(lua-mode . stylua)
(nix-mode . nixfmt)
(python-mode . black)
(ruby-mode . prettier)

View file

@ -0,0 +1,6 @@
ver="$(latest_release JohnnyMorganz/StyLua | sed 's/^v//')"
wget "https://github.com/JohnnyMorganz/StyLua/releases/download/v${ver}/stylua-linux.zip" -O stylua.zip
unzip stylua.zip
chmod +x stylua
cp stylua /usr/local/bin/

View file

@ -0,0 +1,20 @@
too_many_spaces = true
-- stylua: ignore
local function foo ()
return 1,
2,
3
end
local many, vars = function() return true end
local function what_indent ()
noindent = true
if noindent then
x = false
end
return x
end
local y = 'Double quotes are used'

View file

@ -0,0 +1,22 @@
too_many_spaces = true
-- stylua: ignore
local function foo ()
return 1,
2,
3
end
local many, vars = function()
return true
end
local function what_indent()
noindent = true
if noindent then
x = false
end
return x
end
local y = "Double quotes are used"