mhartington / formatter.nvim

MIT License
1.33k stars 140 forks source link

How to use with typescript.nvim and nvim-lint #272

Open kolpav opened 1 year ago

kolpav commented 1 year ago
vim.api.nvim_create_autocmd('User', {
  pattern = 'FormatterPre',
  callback = function()
    -- local ts = require('typescript').actions
    -- ts.addMissingImports({ sync = true })
    -- ts.removeUnused({ sync = true })
    -- ts.organizeImports({ sync = true })
    -- ts.fixAll({ sync = true })
  end,
})
vim.api.nvim_create_autocmd('BufWritePost', {
  pattern = '*',
  callback = function() vim.cmd('FormatWriteLock') end,
})
vim.api.nvim_create_autocmd('User', {
  pattern = 'FormatterPost',
  callback = function() require('lint').try_lint() end,
})

Could you please help me make above plugins work nicely with formatter.nvim? Things need to happen in order and formatter.nvim complains that buffer changed. I have read almost every related github code search hit and I still cannot make it work.

BAndersenRP commented 1 year ago

Hey I'm in the same boat! Thanks for raising this issue, I've tried many setups.