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": {
"lastModified": 1715345894,
"narHash": "sha256-zf+D09uEUkbQKSpfdAqjIvCUKhVCe/NcJiyI9pyg1QU=",
"lastModified": 1715356074,
"narHash": "sha256-N1X04uvlAIStx/hzYZcqUhXiJne2sb3hxNDYA8DvJ3Q=",
"ref": "refs/heads/main",
"rev": "77963b81974872d4f6693e7e6db1ea8d9eca4a72",
"revCount": 60,
"rev": "8d76150a25ca2bcf2383877518ea19133414f210",
"revCount": 61,
"type": "git",
"url": "https://git.pleshevski.ru/pleshevskiy/nixeovim"
},

View file

@ -73,7 +73,7 @@ in
telescope.extensions.telescope-live-grep-args-nvim.settings = {
auto_quoting = true;
mappings.i = {
"<C-K>" = pipe1
"${ctrl "k"}" = pipe1
(require "telescope-live-grep-args.actions")
(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 = {
nil_ls = { };
rust_analyzer = {
@ -95,16 +106,7 @@ in
};
tsserver = { };
eslint = {
# TODO: on attach
/*
vim.cmd([[
aug eslint_fix
au!
au BufWritePre *.tsx,*.ts,*.jsx,*.js silent! EslintFixAll
aug END
]])
*/
on_attach = config.fn.lspconfig-eslint-on-attach.lambda;
};
volar = {
init_options = {