mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-24 09:48:51 +02:00
enc: java default cconfig
This commit is contained in:
parent
f0f7958de7
commit
cecf29d7db
9 changed files with 247 additions and 73 deletions
|
@ -1,6 +1,6 @@
|
|||
local null_ls_status_ok, null_ls = pcall(require, "null-ls")
|
||||
if not null_ls_status_ok then
|
||||
return
|
||||
return
|
||||
end
|
||||
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||
|
@ -15,70 +15,70 @@ local ensure_installed = {}
|
|||
|
||||
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
|
||||
for _, cfg in pairs(data_sources.sources) do
|
||||
table.insert(sources, cfg)
|
||||
end
|
||||
end
|
||||
|
||||
-- load data null-ls
|
||||
local nullls_data = pcode.null_ls_ensure_installed or {}
|
||||
for _, nullls in pairs(nullls_data) do
|
||||
table.insert(ensure_installed, nullls)
|
||||
table.insert(ensure_installed, nullls)
|
||||
end
|
||||
|
||||
local mason_ok, mason_null_ls = pcall(require, "mason-null-ls")
|
||||
if mason_ok then
|
||||
mason_null_ls.setup({
|
||||
ensure_installed = ensure_installed,
|
||||
})
|
||||
mason_null_ls.setup({
|
||||
ensure_installed = ensure_installed,
|
||||
})
|
||||
end
|
||||
|
||||
local run = 0
|
||||
local frmt = pcode.format_on_save or 0
|
||||
if frmt == 1 then
|
||||
run = 1
|
||||
run = 1
|
||||
end
|
||||
|
||||
if run == 1 then
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
ensure_installed = ensure_installed,
|
||||
sources = sources,
|
||||
--sources = {
|
||||
--formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }),
|
||||
--formatting.prettier,
|
||||
-- formatting.prettierd,
|
||||
-- formatting.black.with({ extra_args = { "--fast" } }),
|
||||
-- formatting.stylua,
|
||||
-- formatting.eslint_d,
|
||||
-- formatting.google_java_format,
|
||||
-- formatting.phpcbf,
|
||||
-- formatting.clang_format,
|
||||
-- diagnostics.flake8
|
||||
-- diagnostics.eslint_d,
|
||||
--},
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
ensure_installed = ensure_installed,
|
||||
sources = sources,
|
||||
--sources = {
|
||||
--formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }),
|
||||
--formatting.prettier,
|
||||
-- formatting.prettierd,
|
||||
-- formatting.black.with({ extra_args = { "--fast" } }),
|
||||
-- formatting.stylua,
|
||||
-- formatting.eslint_d,
|
||||
-- formatting.google_java_format,
|
||||
-- formatting.phpcbf,
|
||||
-- formatting.clang_format,
|
||||
-- diagnostics.flake8
|
||||
-- diagnostics.eslint_d,
|
||||
--},
|
||||
|
||||
on_attach = function(client, bufnr)
|
||||
--if client.resolved_capabilities.document_formatting then
|
||||
--vim.cmd("autocmd BufWritePre <buffer> lua vim.lsp.buf.format{async=true}")
|
||||
--end
|
||||
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 })
|
||||
-- vim.lsp.buf.formatting_sync()
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
on_attach = function(client, bufnr)
|
||||
--if client.resolved_capabilities.document_formatting then
|
||||
--vim.cmd("autocmd BufWritePre <buffer> lua vim.lsp.buf.format{async=true}")
|
||||
--end
|
||||
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 })
|
||||
-- vim.lsp.buf.formatting_sync()
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
else
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
ensure_installed = ensure_installed,
|
||||
sources = sources,
|
||||
})
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
ensure_installed = ensure_installed,
|
||||
sources = sources,
|
||||
})
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue