mhartington/formatter.nvim

How to use with typescript.nvim and nvim-lint

kolpav opened this issue · 1 comments

kolpav commented
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.

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