Skip to content

Commit bc4d026

Browse files
committed
chore: Format with stylua
Copying the stylua I use from my dotfiles to the project, should help folks from accidentally submitting PRs with whitespace changes.
1 parent 0d1782d commit bc4d026

11 files changed

Lines changed: 497 additions & 496 deletions

File tree

lua/elixir/init.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ M.settings = language_server.settings
88
M.open_output_panel = language_server.open_output_panel
99

1010
function M.setup(opts)
11-
mix.setup()
12-
projectionist.setup()
13-
language_server.setup(opts)
11+
mix.setup()
12+
projectionist.setup()
13+
language_server.setup(opts)
1414
end
1515

1616
return M

lua/elixir/language_server/compile.lua

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -11,62 +11,62 @@ local bin = { compile = tostring(bin_dir:joinpath("compile")) }
1111
local M = {}
1212

1313
local p = function(x)
14-
io.stdout:write(x .. "\n")
15-
return x
14+
io.stdout:write(x .. "\n")
15+
return x
1616
end
1717

1818
function M.compile(source_path, install_path, opts)
19-
local do_sync = opts.sync or false
20-
local v = Version.get()
19+
local do_sync = opts.sync or false
20+
local v = Version.get()
2121

22-
local printer = function(err, line)
23-
if opts.bufnr then
24-
vim.api.nvim_buf_set_lines(opts.bufnr, -1, -1, false, { line })
25-
vim.api.nvim_buf_call(opts.bufnr, function()
26-
vim.api.nvim_command("normal G")
27-
end)
28-
else
29-
if err then
30-
p(err)
31-
else
32-
p(line)
33-
end
34-
end
35-
end
22+
local printer = function(err, line)
23+
if opts.bufnr then
24+
vim.api.nvim_buf_set_lines(opts.bufnr, -1, -1, false, { line })
25+
vim.api.nvim_buf_call(opts.bufnr, function()
26+
vim.api.nvim_command("normal G")
27+
end)
28+
else
29+
if err then
30+
p(err)
31+
else
32+
p(line)
33+
end
34+
end
35+
end
3636

37-
local compile = Job:new({
38-
command = bin.compile,
39-
args = { install_path },
40-
cwd = source_path,
41-
on_start = function()
42-
vim.notify("Compiling ElixirLS...")
43-
end,
44-
on_stdout = do_sync and printer or vim.schedule_wrap(printer),
45-
on_stderr = do_sync and printer or vim.schedule_wrap(printer),
46-
on_exit = vim.schedule_wrap(function(_, code)
47-
if code == 0 then
48-
if opts.bufnr then
49-
vim.api.nvim_buf_call(opts.bufnr, function()
50-
vim.api.nvim_command("quit")
51-
end)
52-
end
37+
local compile = Job:new {
38+
command = bin.compile,
39+
args = { install_path },
40+
cwd = source_path,
41+
on_start = function()
42+
vim.notify("Compiling ElixirLS...")
43+
end,
44+
on_stdout = do_sync and printer or vim.schedule_wrap(printer),
45+
on_stderr = do_sync and printer or vim.schedule_wrap(printer),
46+
on_exit = vim.schedule_wrap(function(_, code)
47+
if code == 0 then
48+
if opts.bufnr then
49+
vim.api.nvim_buf_call(opts.bufnr, function()
50+
vim.api.nvim_command("quit")
51+
end)
52+
end
5353

54-
vim.notify("Finished compiling ElixirLS!")
55-
vim.notify("Reloading buffer")
56-
vim.api.nvim_command("edit")
57-
vim.notify("Restarting LSP client")
58-
vim.api.nvim_command("LspRestart")
59-
end
60-
end),
61-
})
54+
vim.notify("Finished compiling ElixirLS!")
55+
vim.notify("Reloading buffer")
56+
vim.api.nvim_command("edit")
57+
vim.notify("Restarting LSP client")
58+
vim.api.nvim_command("LspRestart")
59+
end
60+
end),
61+
}
6262

63-
-- sync is just for testing
64-
if do_sync then
65-
compile:sync(60000)
66-
else
67-
compile:start()
68-
end
63+
-- sync is just for testing
64+
if do_sync then
65+
compile:sync(60000)
66+
else
67+
compile:start()
68+
end
6969

70-
return compile
70+
return compile
7171
end
7272
return M

lua/elixir/language_server/download.lua

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,39 @@ local Utils = require("elixir.utils")
77
local M = {}
88

99
function M.clone(dir, opts)
10-
opts = opts or {}
11-
local r = opts.repo
12-
local rr = Utils.safe_path(opts.ref or "HEAD")
13-
local dir_identifier = Path:new(r, rr).filename
10+
opts = opts or {}
11+
local r = opts.repo
12+
local rr = Utils.safe_path(opts.ref or "HEAD")
13+
local dir_identifier = Path:new(r, rr).filename
1414

15-
vim.notify(string.format("Cloning ref %s from repo %s", opts.ref or "default", opts.repo))
15+
vim.notify(string.format("Cloning ref %s from repo %s", opts.ref or "default", opts.repo))
1616

17-
local made_path = Path:new(dir):mkdir({ parents = true, mode = 493 })
18-
assert(made_path, "failed to make the path")
17+
local made_path = Path:new(dir):mkdir { parents = true, mode = 493 }
18+
assert(made_path, "failed to make the path")
1919

20-
local clone = Job:new({
21-
command = "git",
22-
args = { "-C", dir, "clone", string.format("https://github.com/%s.git", opts.repo), dir_identifier },
23-
enable_recording = true,
24-
})
20+
local clone = Job:new {
21+
command = "git",
22+
args = { "-C", dir, "clone", string.format("https://github.com/%s.git", opts.repo), dir_identifier },
23+
enable_recording = true,
24+
}
2525

26-
clone:sync()
26+
clone:sync()
2727

28-
assert(clone.code == 0, "Failed to clone")
28+
assert(clone.code == 0, "Failed to clone")
2929

30-
if opts.ref ~= "HEAD" then
31-
local checkout = Job:new({
32-
command = "git",
33-
args = { "-C", Path:new(dir, dir_identifier).filename, "checkout", opts.ref },
34-
})
35-
checkout:sync()
30+
if opts.ref ~= "HEAD" then
31+
local checkout = Job:new {
32+
command = "git",
33+
args = { "-C", Path:new(dir, dir_identifier).filename, "checkout", opts.ref },
34+
}
35+
checkout:sync()
3636

37-
assert(checkout.code == 0, "Failed to checkout ref " .. opts.ref)
38-
end
37+
assert(checkout.code == 0, "Failed to checkout ref " .. opts.ref)
38+
end
3939

40-
vim.notify("Downloaded ElixirLS!")
40+
vim.notify("Downloaded ElixirLS!")
4141

42-
return dir_identifier
42+
return dir_identifier
4343
end
4444

4545
return M

0 commit comments

Comments
 (0)