more more more
This commit is contained in:
135
lua/conf/plugins/lsp.lua
Normal file
135
lua/conf/plugins/lsp.lua
Normal file
@ -0,0 +1,135 @@
|
||||
local nonels_augroup = core.misc.augroup("nullls formatting")
|
||||
|
||||
return {
|
||||
{ "neovim/nvim-lspconfig",
|
||||
disable = not vim.fn.has("nvim-0.10.0"),
|
||||
reqs = {
|
||||
"mason-org/mason.nvim",
|
||||
"mason-org/mason-lspconfig.nvim"
|
||||
},
|
||||
load = function()
|
||||
core.lsp.setup()
|
||||
require("mason-lspconfig").setup {
|
||||
ensure_added = {
|
||||
"clangd",
|
||||
"mesonlsp",
|
||||
|
||||
"bashls",
|
||||
"jdtls",
|
||||
"lua_ls",
|
||||
|
||||
-- python
|
||||
"basedpyright",
|
||||
"mypy",
|
||||
"black",
|
||||
"debugpy"
|
||||
}
|
||||
}
|
||||
end
|
||||
},
|
||||
|
||||
{ "mason-org/mason.nvim",
|
||||
disable = not vim.fn.has("nvim-0.7.0"),
|
||||
load = function()
|
||||
local mason = require("mason")
|
||||
|
||||
mason.setup {
|
||||
ui = {
|
||||
border = vim.g.border_style,
|
||||
width = 0.8,
|
||||
height = 0.9,
|
||||
|
||||
icons = {
|
||||
package_installed = "+",
|
||||
package_pending = "?",
|
||||
package_uninstalled = "x"
|
||||
}
|
||||
},
|
||||
keymaps = {
|
||||
toggle_package_expand = "<CR>",
|
||||
install_package = "i",
|
||||
update_package = "u",
|
||||
check_package_version = "c",
|
||||
update_all_packages = "U",
|
||||
check_outdated_packages = "C",
|
||||
uninstall_package = "r",
|
||||
cancel_installation = "<C-c>",
|
||||
apply_language_filter = "<C-f>"
|
||||
}
|
||||
}
|
||||
end
|
||||
},
|
||||
|
||||
{ "j-hui/fidget.nvim",
|
||||
disable = not vim.fn.has("nvim-0.9.0"),
|
||||
branch = "v1.*",
|
||||
lazy = dep_short.auto("LspAttach"),
|
||||
load = function()
|
||||
local notification_defaults = require("fidget.notification").default_config
|
||||
notification_defaults["icon"] = ""
|
||||
|
||||
require("fidget").setup {
|
||||
progress = {
|
||||
display = {
|
||||
progress_icon = {
|
||||
pattern = "line",
|
||||
period = 1
|
||||
},
|
||||
done_icon = ":)"
|
||||
}
|
||||
},
|
||||
notification = {
|
||||
filter = vim.log.levels.DEBUG,
|
||||
override_vim_notify = true,
|
||||
configs = {
|
||||
default = notification_defaults
|
||||
},
|
||||
view = {
|
||||
icon_separator = " ",
|
||||
group_separator = "---",
|
||||
group_separator_hl = "Comment"
|
||||
},
|
||||
window = {
|
||||
zindex = 44,
|
||||
relative = "editor"
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
},
|
||||
|
||||
{ "mfussenegger/nvim-jdtls",
|
||||
disable = not vim.fn.has("nvim-0.6.0"),
|
||||
reqs = "mfussenegger/nvim-dap",
|
||||
lazy = dep_short.ft("java")
|
||||
},
|
||||
|
||||
{ "nvimtools/none-ls.nvim",
|
||||
lazy = dep_short.ft("python"),
|
||||
load = function()
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
null_ls.setup {
|
||||
sources = {
|
||||
null_ls.builtins.formatting.black,
|
||||
},
|
||||
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({
|
||||
group = nonels_augroup,
|
||||
buffer = bufnr
|
||||
})
|
||||
core.misc.auto("BufWritePre", {
|
||||
group = nonels_augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user