2023-10-02 10:33:32 +03:00

24 lines
710 B
Lua

-- Null-ls.
local status, null_ls = pcall(require, 'null-ls')
if (not status) then return end
local prettier_config = vim.fn.stdpath('config') .. '/lua/axp/plugins/null-ls/.prettierrc'
local formatting = null_ls.builtins.formatting
-- Init.
null_ls.setup {
sources = {
formatting.prettier.with({ extra_args = { "--config", prettier_config } })
},
on_attach = function (client, bufnr)
if client.supports_method('textDocument/formatting') then
print('Test textDocument/formatting')
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.lsp.buf.format()
end, { desc = 'Format current buffer with LSP' })
end
end
}