57 lines
1.6 KiB
Lua
57 lines
1.6 KiB
Lua
local lspconfig = require "lspconfig"
|
|
local on_attach = require("nvchad.configs.lspconfig").on_attach
|
|
local capabilities = require("nvchad.configs.lspconfig").capabilities
|
|
|
|
-- if you just want default config for the servers then put them in a table
|
|
local servers = {
|
|
"html",
|
|
"cssls",
|
|
"tsserver",
|
|
"clangd",
|
|
"gopls",
|
|
"astro",
|
|
"docker_compose_language_service",
|
|
"ast_grep",
|
|
-- "basedpyright",
|
|
"bashls",
|
|
"css_variables",
|
|
}
|
|
|
|
for _, lsp in ipairs(servers) do
|
|
lspconfig[lsp].setup {
|
|
on_attach = on_attach,
|
|
capabilities = capabilities,
|
|
}
|
|
end
|
|
|
|
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 = {
|
|
-- Tell the language server which version of Lua you're using
|
|
-- (most likely LuaJIT in the case of Neovim)
|
|
version = "LuaJIT",
|
|
},
|
|
-- Make the server aware of Neovim runtime files
|
|
workspace = {
|
|
checkThirdParty = false,
|
|
library = {
|
|
vim.env.VIMRUNTIME,
|
|
-- "${3rd}/luv/library"
|
|
-- "${3rd}/busted/library",
|
|
},
|
|
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower
|
|
-- library = vim.api.nvim_get_runtime_file("", true)
|
|
},
|
|
},
|
|
})
|
|
client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
|
|
end
|
|
return true
|
|
end,
|
|
}
|
|
|
|
require("copilot").setup()
|