108 lines
3.3 KiB
Lua
108 lines
3.3 KiB
Lua
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
|
|
|
require("lspconfig").basedpyright.setup({ capabilities = capabilities })
|
|
require("lspconfig").ruff.setup({ capabilities = capabilities })
|
|
|
|
require("lspconfig").ccls.setup({ capabilities = capabilities })
|
|
|
|
require("lspconfig").lua_ls.setup({
|
|
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.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,
|
|
})
|