-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
How can I set .clang-format globally? #39
Comments
I'm not sure about this: e.g. `clangd -fallback-style="{BasedOnStyle: LLVM, IndentWidth: 4}'" That said, using a |
I tried like As you said, duplicating I thought clangd doesn't have arguments for this purpose (I tried clangd --help and as far as I know there was nothing like |
That seems not to be the case, or it's bugged, or I'm setting it incorrectly in I tried
with corresponding LLVM tooling being version 10 (same as clangd). So I'm either not setting it correctly, or there are 2 issues:
Third issue is cosmetic -- unmatched |
I'm experiencing the same issue as @avemilia |
Fixed this issue by using a .clang-format file instead. It works but it's not optimal |
There are two issues here, mostly inherited from clang-format itself:
The first issue limits users ability to define a custom "global" fallback for format style to clangd. We can extend FallbackStyle handling in clang-format to accept custom ones. That's not the case currently probably because they don't want to parse the fallback configuration string at every call(but they are happy to read it from file and parse it again ?!?). But we can overcome this by parsing it once on the caller side and taking a pre-built FallbackStyle, rather than a string one. In addition to that, we might want to have a section in Config for FallbackStyle. WDYT @sam-mccall ? For the second issue, it seems like a straight forward fix, but it implies a change in behaviour. Maybe they've a good reason for bailing out early whenever the FallbackStyle is malformed. I'll put together a patch and try to find some clang-format reviewers to see if they got any concerns. As for a workaround until we take some action, similar to what @ErikReider did, you can put a |
Sent out https://reviews.llvm.org/D95538 for the latter issue. |
Right - I was mistaken about the -fallback-style behavior, sorry. This could be fixed in clang-format, it seems a little cumbersome to use but not terrible.
This doesn't seem like a problem. If FallbackStyle is effectively an enum, then what's the purpose of allowing an invalid value so long as you never use the feature? No other flags work that way. |
Fair point if you treat this as a "flag", and if we are going down that path, I would suggest literally checking for that and shutting down if need be at the startup (same with other flags) rather than just logging some errors. |
What I did to work this around is to copy my |
Is this fixed? I switched to this extension from https://github.com/microsoft/vscode-cpptools this one, it provides an option
Can we have this option for clangd extension. |
clangd's issue. |
I'm struggling with this problem for hours.
As far as I know, clangd doesn't have
-style
option unlike clang-format and there's no way to set my custom format in my coc.nvim + coc-clang environment (I found-fallback-style
option but it is not customizable because it is a kind of presets).So, is there any way to set a global formating option like vim-clang-format?
The text was updated successfully, but these errors were encountered: