126 lines
3.8 KiB
Lua
126 lines
3.8 KiB
Lua
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
|
|
|
vim.lsp.config("basedpyright", { capabilities = capabilities })
|
|
vim.lsp.config("ruff", { capabilities = capabilities })
|
|
vim.lsp.enable({ "basedpyright", "ruff" })
|
|
|
|
-- npm i -g bash-language-server
|
|
-- Also install shellcheck using system package manager.
|
|
vim.lsp.config("bashls", { capabilities = capabilities })
|
|
vim.lsp.enable("bashls")
|
|
|
|
-- cargo install --features lsp --locked taplo-cli
|
|
-- (For toml)
|
|
vim.lsp.config("taplo", { capabilities = capabilities })
|
|
vim.lsp.enable("taplo")
|
|
|
|
-- npm i -g yaml-language-server
|
|
vim.lsp.config("yamlls", { capabilities = capabilities })
|
|
vim.lsp.enable("yamlls")
|
|
|
|
vim.lsp.config("ccls", { capabilities = capabilities })
|
|
vim.lsp.enable("ccls")
|
|
|
|
vim.lsp.config("lua_ls", {
|
|
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,
|
|
},
|
|
},
|
|
})
|
|
end,
|
|
settings = {
|
|
Lua = {},
|
|
},
|
|
capabilities = capabilities,
|
|
})
|
|
vim.lsp.enable("lua_ls")
|
|
|
|
|
|
vim.g.rustaceanvim = {
|
|
-- Plugin configuration
|
|
-- tools = {
|
|
-- },
|
|
-- LSP configuration
|
|
server = {
|
|
-- on_attach = function(client, bufnr)
|
|
-- -- you can also put keymaps in here
|
|
--end,
|
|
default_settings = {
|
|
-- rust-analyzer language server configuration
|
|
["rust-analyzer"] = {
|
|
cargoWatch = true,
|
|
cargo = {
|
|
allFeatures = true,
|
|
allTargets = false,
|
|
loadOutDirsFromCheck = true,
|
|
buildScripts = {
|
|
enable = true,
|
|
},
|
|
},
|
|
checkOnSave = {
|
|
allFeatures = true,
|
|
allTargets = false,
|
|
},
|
|
diagnostics = {
|
|
enable = true,
|
|
},
|
|
procMacro = {
|
|
enable = true,
|
|
ignored = {
|
|
["async-trait"] = { "async_trait" },
|
|
["napi-derive"] = { "napi" },
|
|
["async-recursion"] = { "async_recursion" },
|
|
},
|
|
},
|
|
files = {
|
|
excludeDirs = {
|
|
".direnv",
|
|
".git",
|
|
".github",
|
|
".gitlab",
|
|
"bin",
|
|
"node_modules",
|
|
"target",
|
|
"venv",
|
|
".venv",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
-- DAP configuration
|
|
dap = {},
|
|
}
|
|
|
|
vim.api.nvim_create_autocmd("LspAttach", {
|
|
group = vim.api.nvim_create_augroup("lsp", { clear = true }),
|
|
callback = function(args)
|
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
|
buffer = args.buf,
|
|
callback = function()
|
|
vim.lsp.buf.format({ async = false, id = args.data.client_id })
|
|
end,
|
|
})
|
|
end,
|
|
})
|