Closed remy-poirier closed 2 years ago
The issue is that multiple LSP servers are capable to format the same filetype (e.g. both null-ls
with prettier.nvim
, and tsserver
can format js/ts files). So in your case, tsserver
is probably winning and null-ls
(with prettier.nvim
) is not formatting the file on save.
What you need is a script like this: https://github.com/MunifTanjim/dotfiles/blob/b8269d77fc8cc7a9693e8d95908ef299aa1550f6/private_dot_config/nvim/lua/config/lsp/custom/format.lua
And instead of using vim.lsp.buf.formatting
or vim.lsp.buf.format
, use that custom format
function to set up formatting for the files.
OK thanks, I will look at this !
Hello, I am a front end developer and I want to try developing with NeoVim, I followed a tutorial, and I'm almost done, in reality the last thing I need to achieve is prettier config.
I think it only misses a really few configurations, because when I run
:Prettier
in a file, it formats the file correctly.Here are some of my config files:
null-ls.rc.lua
prettier.rc.lua
I also put my lspconfig.rc.lua file in case it can be useful:
Do you see something weird in my config files ? Really the last part I'm missing is to add :Prettier on save :D