init.lua/after/plugin/lsp.lua

35 lines
927 B
Lua
Raw Normal View History

2024-02-11 17:31:06 +05:30
require("lspkind").init({
mode = "symbol_text",
})
local capabilities = require("cmp_nvim_lsp").default_capabilities()
2024-02-11 14:02:09 +05:30
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup({
2024-02-11 17:31:06 +05:30
capabilities = capabilities,
2024-02-11 14:02:09 +05:30
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,
})
2024-02-11 17:31:06 +05:30
lspconfig.nixd.setup({
capabilities = capabilities,
})