Skip to content

Commit

Permalink
feat: Add onAttach option for none-ls to avoid using lsp-format plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
redyf committed Feb 10, 2024
1 parent c0803d1 commit 50563d0
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion config/none-ls/none-ls.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
{
plugins.none-ls = {
enable = false;
enableLspFormat = true;
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;
Expand Down

0 comments on commit 50563d0

Please sign in to comment.