mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-08-08 03:44:52 +02:00
enc: java default cconfig
This commit is contained in:
parent
f0f7958de7
commit
cecf29d7db
9 changed files with 247 additions and 73 deletions
58
lua/plugins/nonels.lua
Normal file
58
lua/plugins/nonels.lua
Normal file
|
@ -0,0 +1,58 @@
|
|||
return {
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
lazy = true,
|
||||
dependencies = {
|
||||
{
|
||||
"jayp0521/mason-null-ls.nvim",
|
||||
opts = {
|
||||
ensure_installed = pcode.null_ls_ensure_installed or {},
|
||||
automatic_setup = true,
|
||||
handlers = {},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("mason-null-ls").setup(opts)
|
||||
end,
|
||||
},
|
||||
"nvimtools/none-ls-extras.nvim",
|
||||
},
|
||||
event = "InsertEnter",
|
||||
opts = function()
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
local sources = {}
|
||||
local data_ok, data_sources = pcall(require, "custom.null-ls")
|
||||
if data_ok then
|
||||
for _, cfg in pairs(data_sources.sources) do
|
||||
table.insert(sources, cfg)
|
||||
end
|
||||
end
|
||||
local on_save = pcode.format_on_save or 0
|
||||
if on_save == 1 then
|
||||
return {
|
||||
debug = false,
|
||||
sources = sources,
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
}
|
||||
else
|
||||
return {
|
||||
debug = false,
|
||||
sources = sources,
|
||||
}
|
||||
end
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("null-ls").setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue