-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
27 lines (27 loc) · 783 Bytes
/
Copy pathinit.lua
File metadata and controls
27 lines (27 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
local config_path = vim.fn.stdpath("config") --[[@as string]]
local output = vim.system({
"cargo",
"build",
--"--release",
"--message-format=json-render-diagnostics",
}, {
cwd = config_path,
text = true,
}):wait()
if output.code ~= 0 then
error(output.stderr)
end
local artifacts = vim.tbl_filter(
function(msg)
return msg.reason == "compiler-artifact" and msg.target.name == "nvim_config"
end,
vim.tbl_map(
vim.json.decode, --
vim.split(output.stdout --[[@as string]], "\n", { trimempty = true })
)
)
if #artifacts ~= 1 or #artifacts[1].filenames ~= 1 then
error("expected exactly one compiler-artifact message with one filename, found: \n" .. vim.inspect(artifacts))
end
local libpath = artifacts[1].filenames[1]
package.loadlib(libpath, "luaopen_nvim_config")()