neovim: attach eslint fix to the buffer

This commit is contained in:
Dmitriy Pleshevskiy 2024-05-10 18:50:22 +03:00
parent 8a3be7d159
commit 113e44cb04
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
2 changed files with 17 additions and 15 deletions

View file

@ -281,11 +281,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1715345894, "lastModified": 1715356074,
"narHash": "sha256-zf+D09uEUkbQKSpfdAqjIvCUKhVCe/NcJiyI9pyg1QU=", "narHash": "sha256-N1X04uvlAIStx/hzYZcqUhXiJne2sb3hxNDYA8DvJ3Q=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "77963b81974872d4f6693e7e6db1ea8d9eca4a72", "rev": "8d76150a25ca2bcf2383877518ea19133414f210",
"revCount": 60, "revCount": 61,
"type": "git", "type": "git",
"url": "https://git.pleshevski.ru/pleshevskiy/nixeovim" "url": "https://git.pleshevski.ru/pleshevskiy/nixeovim"
}, },

View file

@ -73,7 +73,7 @@ in
telescope.extensions.telescope-live-grep-args-nvim.settings = { telescope.extensions.telescope-live-grep-args-nvim.settings = {
auto_quoting = true; auto_quoting = true;
mappings.i = { mappings.i = {
"<C-K>" = pipe1 "${ctrl "k"}" = pipe1
(require "telescope-live-grep-args.actions") (require "telescope-live-grep-args.actions")
(call0 "quote_prompt") (call0 "quote_prompt")
; ;
@ -81,6 +81,17 @@ in
}; };
}; };
fn.lspconfig-eslint-on-attach = {
args = [ "client" "bufnr" ];
content = { bufnr, ... }: {
vim.augroup.eslint-fix = {
event = "BufWritePre";
buffer = bufnr;
command = "silent! EslintFixAll";
};
};
};
plugins.language-server.lspconfig.serverSettings = { plugins.language-server.lspconfig.serverSettings = {
nil_ls = { }; nil_ls = { };
rust_analyzer = { rust_analyzer = {
@ -95,16 +106,7 @@ in
}; };
tsserver = { }; tsserver = { };
eslint = { eslint = {
# TODO: on attach on_attach = config.fn.lspconfig-eslint-on-attach.lambda;
/*
vim.cmd([[
aug eslint_fix
au!
au BufWritePre *.tsx,*.ts,*.jsx,*.js silent! EslintFixAll
aug END
]])
*/
}; };
volar = { volar = {
init_options = { init_options = {