typescript-tools.nvim
typescript-tools.nvim copied to clipboard
Unable to pass format options to tsserver
I'm trying to set my project like this
require("typescript-tools").setup {
on_attach = on_attach,
capabilities = capabilities,
settings = {
-- IT DOESN"T WORK!
tsserver_format_options = {
indentSize = 4,
tabSize = 4,
convertTabsToSpaces = false,
},
},
}
My autocmd is as follows:
autocmd("FileType", {
pattern = { "rust", "javascript", "typescript", "typescriptreact", "proto", "yaml", "lua", "javascriptreact" },
callback = function()
vim.opt_local.tabstop = 4
vim.opt_local.shiftwidth = 4
vim.opt_local.softtabstop = 4
vim.opt_local.expandtab = false
vim.opt_local.signcolumn = "yes"
end,
})
I can validate with LspLog that it passes the argument correctly
[DEBUG][2025-03-18 09:51:17] ...m/lsp/client.lua:678 "LSP[typescript-tools]" "client.request" 3 "textDocument/formatting" { options = { insertSpaces = false, tabSize = 4 }, textDocument = { uri = "file:///Users/nma/dev/dankfolio/frontend/src/components/CoinCard.tsx" }} <function 1> 3
Verified that they are the correct options in tsserver also.
But somehow whenever I do redraw! I can see the \t but they get replaced as soon as I format the file.
I'm not sure what I'm doing wrong here.