nvim/lua/plugins/lspconfig.lua
sudacode 03701f3616
fix cmp and codecompanion
- remove blink dependency
- set up telescope as default provider for codecompanion slash commands
2025-02-16 14:14:13 -08:00

78 lines
2.0 KiB
Lua

return {
"neovim/nvim-lspconfig",
config = function()
local lspconfig = require("lspconfig")
vim.notify = require("notify")
local servers = {
"bashls",
"jedi_language_server",
"jsonls",
"yamlls",
"vimls",
"dotls",
"dockerls",
"html",
"cssls",
"lua_ls",
"eslint",
"ts_ls",
"angularls",
"ansiblels",
}
for _, lsp in ipairs(servers) do
if lsp == "lua_ls" then
lspconfig[lsp].setup({
-- on_attach = require("lsp-format").on_attach,
on_attach = function()
vim.notify("Lua LSP attached", nil, { title = "LSP" })
end,
on_init = function(client)
if client.workspace_folders then
local path = client.workspace_folders[1].name
if
path ~= vim.fn.stdpath("config")
and (
vim.loop.fs_stat(path .. "/.luarc.json")
or vim.loop.fs_stat(path .. "/.luarc.jsonc")
)
then
return
end
end
client.config.settings.Lua = 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,
-- Depending on the usage, you might want to add additional paths here.
-- "${3rd}/luv/library"
-- "${3rd}/busted/library",
},
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower and will cause issues when working on your own configuration (see https://github.com/neovim/nvim-lspconfig/issues/3189)
-- library = vim.api.nvim_get_runtime_file("", true)
},
})
end,
callSnippet = "Replace",
settings = {
Lua = {},
},
})
else
lspconfig[lsp].setup({
on_attach = function()
vim.notify(lsp .. " LSP attached", nil, { title = "LSP" })
end,
})
end
end
end,
}