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

refactor: Rename clang_format to clang-format #352

Merged
merged 1 commit into from
Mar 28, 2024

Conversation

tsakirist
Copy link
Contributor

Scope

This makes the formatter name consistent with the executable and also with other tools like e.g. Mason, for better interoperability.

Why

One use-case is to be able to automatically install formatters that are registered with other tools like Mason.

local registered_formatters = require("conform").list_all_formatters()
for _, formatter in ipairs(registered_formatters) do
   MasonInstall(formatter) -- Asume a MasonInstall function exists
end

This makes the formatter name consistent with the executable and also
with other tools like e.g. Mason, for better interoperability.
@github-actions github-actions bot requested a review from stevearc March 27, 2024 17:07
@stevearc
Copy link
Owner

Sure, seems fine to me

@stevearc stevearc merged commit b168ff5 into stevearc:master Mar 28, 2024
8 checks passed
@FIONover
Copy link

nope, it isn't fine @stevearc
try to customize formatter)

require("conform").formatters.clang-format = {
prepend_args = {"--style", "{ BasedOnStyle: LLVM, IndentWidth: 4 }"},
}

@tsakirist
Copy link
Contributor Author

tsakirist commented May 30, 2024

nope, it isn't fine @stevearc
try to customize formatter)

require("conform").formatters.clang-format = {
prepend_args = {"--style", "{ BasedOnStyle: LLVM, IndentWidth: 4 }"},
}

You can index the formatters table with:
require("conform").formatters["clang-format"] = { prepend_args = {"--style", "{ BasedOnStyle: LLVM, IndentWidth: 4 }"} }

@FIONover
Copy link

Oh thanks <3
I'm not that good at lua, I think it should be mentioned somewhere for people like me

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

Successfully merging this pull request may close these issues.

3 participants