A formatter for Flow?
mlp1802 opened this issue · 1 comments
mlp1802 commented
Does it exist? I use nvim and this is my setup:
lsp.configure('flow', {
cmd = { 'npx', 'flow', 'lsp' }, -- Flow LSP command
filetypes = { 'javascript', 'javascriptreact' },
root_dir = require('lspconfig').util.root_pattern('.flowconfig'),
on_attach = function(client, bufnr)
-- Default keymaps for LSP
lsp.default_keymaps({ buffer = bufnr })
-- Enable autoformat on save
if client.server_capabilities.documentFormattingProvider then
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ async = false })
end
})
end
-- Set indentation settings (adjust to your preferences)
vim.bo.tabstop = 2 -- Number of spaces per tab
vim.bo.shiftwidth = 2 -- Number of spaces to use for indentation
vim.bo.expandtab = true -- Convert tabs to spaces
end,
})
Flow language server works, but whenever it tried to format the text, I get the error:[LSP] Format request failed, no matching language servers.
is there maybe a command line tool or something? in case lsp doesn't support it
SamChou19815 commented
Flow doesn't ship with a formatter. We recommend to use prettier