setup lsp for lua
This commit is contained in:
parent
ad97ce229c
commit
09e396ede2
1 changed files with 25 additions and 0 deletions
25
after/plugin/lsp.lua
Normal file
25
after/plugin/lsp.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local lspconfig = require("lspconfig")
|
||||
|
||||
lspconfig.lua_ls.setup({
|
||||
on_init = function(client)
|
||||
local path = client.workspace_folders[1].name
|
||||
if not vim.loop.fs_stat(path .. "/.luarc.json") and not vim.loop.fs_stat(path .. "/.luarc.jsonc") then
|
||||
client.config.settings = vim.tbl_deep_extend("force", client.config.settings, {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
Loading…
Reference in a new issue