LSP format request on save woes…

I recently moved to the built-in LSP server configuration. I cannot get the LSP to format code/text for the life of me. All I get is the unhelpful message: [LSP] Format request failed, no matching language server. with nothing helpful in the logs.

For example, I have this in .config/nvim/init.lua:

vim.lsp.enable("tinymist")
vim.lsp.enable("ruff")
[…]
vim.api.nvim_create_autocmd("BufWritePost", {
    callback = function()
        vim.lsp.buf.format() 
    end
})

and in .config/nvim/lsp/tinymist.lua, the following:

return {
    cmd = { "tinymist" },
    filetypes = { "typst" },
    settings = {
      formatterMode = "typstyle",
    },
}

Neither Python nor typist files get formatted. However, both ruff and tinymist do have formatting. :enraged_face:

Thus, two burning questions:

  1. What the H*** am I doing wrong?
  2. How can I debug these problems in the future?

Back to using Conform since that actually works… ¯\_(ツ)_/¯

If anyone cares to make LSP work, that would be nice. I won’t be holding my breath. :sob: