Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-format used when formatter fails in some filetypes #452

Open
wilfredjonathanjames opened this issue Mar 18, 2023 · 0 comments
Open

Comments

@wilfredjonathanjames
Copy link

Often when I attempt to format certain filetypes that contain a syntax error, Neoformat mangles everything with clang-format. When my desired formatter fails to run, clang-format is used as a fallback.

Doesn't happen in languages like Rust that don't have clang-format defined as a default fallback.

If I have an error, I would only like to see that my chosen linter failed to run. I don't want clang-format attempting to rewrite my broken typescript file.

I've solved this with the following:

vim.g.neoformat_enabled_cpp = { "uncrustify" }
vim.g.neoformat_enabled_javascript = { "prettier" }
vim.g.neoformat_enabled_typescript = { "prettier" }
vim.g.neoformat_enabled_typescriptreact = { "prettier" }

I'm raising this in case anyone else has the same issue, but can I suggest a usability improvement; a configuration flag to make Neoformat not attempt other formatters if a formatter is installed but fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant