Archived
0
0
Fork 0
This repository has been archived on 2024-02-06. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/.config/nvim/lua/user/lsp/nullls.lua

29 lines
650 B
Lua
Raw Normal View History

2022-01-21 08:22:02 +00:00
local null_ls_status_ok, null_ls = pcall(require, "null-ls")
if not null_ls_status_ok then
return
end
local formatting = null_ls.builtins.formatting
2022-06-23 14:33:09 +00:00
local code_actions = null_ls.builtins.code_actions
local diagnostics = null_ls.builtins.diagnostics
2022-01-21 08:22:02 +00:00
null_ls.setup({
debug = false,
sources = {
formatting.stylua,
2022-06-23 14:33:09 +00:00
code_actions.eslint_d,
diagnostics.eslint_d,
formatting.eslint_d,
2022-01-21 08:22:02 +00:00
},
on_attach = function(client)
2022-06-23 07:34:18 +00:00
if client.server_capabilities.documentFormattingProvider then
2022-01-21 08:22:02 +00:00
vim.cmd([[
augroup LspFormatting
autocmd! * <buffer>
2022-06-23 07:34:18 +00:00
autocmd BufWritePre <buffer> lua vim.lsp.buf.format()
2022-01-21 08:22:02 +00:00
augroup END
]])
end
end,
})