-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlua_ls.lua
42 lines (35 loc) · 956 Bytes
/
lua_ls.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
local merge = require('utils').merge
local default_settings = require('plugins.lsp.servers._default_settings')
local runtime_exclude = {
user = vim.fn.expand('~/.config/nvim'),
user_after = vim.fn.expand('~/.config/nvim/after'),
}
local function on_init(client)
if client.workspace_folders then
local path = client.workspace_folders[1].name
if path ~= runtime_exclude.user then
return
end
end
local runtime_files = vim.api.nvim_get_runtime_file('', true)
for k, v in ipairs(runtime_files) do
if v == runtime_exclude.user_after or v == runtime_exclude.user then
table.remove(runtime_files, k)
end
end
client.config.settings.Lua = merge(client.config.settings.Lua, {
runtime = {
version = 'LuaJIT',
},
workspace = {
checkThirdParty = false,
library = runtime_files,
},
})
end
return merge(default_settings, {
settings = {
Lua = {},
},
on_init = on_init,
})