nv/config/none-ls/none-ls.nix
2024-03-06 18:29:28 +05:30

90 lines
1.9 KiB
Nix

{
plugins.none-ls = {
enable = false;
enableLspFormat = false;
updateInInsert = false;
onAttach = ''
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
'';
sources = {
code_actions = {
eslint_d.enable = true;
gitsigns.enable = true;
statix.enable = true;
};
diagnostics = {
checkstyle = {
enable = true;
};
statix = {
enable = true;
};
luacheck = {
enable = true;
};
flake8 = {
enable = true;
};
eslint_d = {
enable = true;
};
};
formatting = {
alejandra = {
enable = true;
};
prettier = {
enable = true;
withArgs = ''
{
extra_args = { "--no-semi", "--single-quote" },
}
'';
};
google_java_format = {
enable = true;
};
rustfmt = {
enable = true;
};
stylua = {
enable = true;
};
black = {
enable = true;
withArgs = ''
{
extra_args = { "--fast" },
}
'';
};
jq = {
enable = true;
};
};
};
};
# keymaps = [
# {
# mode = [ "n" "v" ];
# key = "<leader>cf";
# action = "<cmd>lua vim.lsp.buf.format()<cr>";
# options = {
# silent = true;
# desc = "Format";
# };
# }
# ];
}