Running Biome (linter) fix-all and formatting on save
github.com·17h·
Discuss: r/neovim
Flag this post

I am probably not the only one using biome in neovim (with neovim’s lsp), so I figure i’m probably not the only person that has run into this issue. So I thought i might as well share this in case someone else embarks on their own journey trying to get biome to not run into race conditions running both fixing and formatting at the same time as an on-save hook, in the hopes that they find this before banging their heads into their mechanical keyboards.

The problem:

Say you have this piece of code in your neovim lsp stuff (for biome)

function format_and_fix(event)
local bufnr = event.buf
local clients = vim.lsp.get_active_clients({ bufnr = bufnr })
for _, client in ipairs(clients) do
local name = client.name

-- format client filter, to only format items for one single client, ...

Similar Posts

Loading similar posts...