generated from LazyVim/starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.nvim.luarc.lua
47 lines (43 loc) · 1.47 KB
/
.nvim.luarc.lua
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/lua_ls.lua
-- [lua ls: Settings](https://luals.github.io/wiki/settings/)
---@type _.lspconfig.settings.lua_ls.Config
---@diagnostic disable: missing-fields
local lua_ls_settings = {
---@type _.lspconfig.settings.lua_ls.Runtime
runtime = { version = "LuaJIT" },
---@type _.lspconfig.settings.lua_ls.Format
format = { enable = true },
---@type _.lspconfig.settings.lua_ls.Workspace
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME,
---@diagnostic disable-next-line: param-type-mismatch
vim.fs.joinpath(vim.fn.stdpath("data"), "lazy"),
-- Depending on the usage, you might want to add additional paths here.
"${3rd}/luv/library",
"${3rd}/busted/library",
},
-- An array of paths that will be ignored and not included in the workspace diagnosis. Uses .gitignore grammar. Can be a file or directory.
-- https://luals.github.io/wiki/settings/#workspaceignoredir
-- ignoreDir = {"/lua/plugins/example.lua"}
},
}
local settings_json = vim.fn.json_encode(lua_ls_settings)
-- vim.print(vim.inspect(arg) .. " len: " .. #arg .. " arg1=" .. arg[1])
if #arg <= 0 then
vim.print(settings_json)
return
end
if #arg > 1 then
error("invalid args: " .. vim.inspect(arg))
return
end
-- 输出 json 到文件
local file, open_err = io.open(arg[1], "w+")
if not file then
error(open_err)
return
end
file:write(settings_json)
file:close()