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

Does not handle spaces in arguments well #36

Open
UtkarshVerma opened this issue Aug 18, 2023 · 2 comments
Open

Does not handle spaces in arguments well #36

UtkarshVerma opened this issue Aug 18, 2023 · 2 comments

Comments

@UtkarshVerma
Copy link

UtkarshVerma commented Aug 18, 2023

I'm trying to have cbfmt autoformat my C code blocks using clang-format with the following config:

[languages]
c = ["clang-format -style=\"{BasedOnStyle: Google, IndentWidth: 4, UseTab: Never, TabWidth: 4}\""]

However, it seems to split args on spaces without respecting the escaped quote. clang-format thinks that it has received 6 filenames which yields the error:

$ cbfmt -w test.md
[Error]: test.md:3 [c] -> [clang-format]
No such file or directory
No such file or directory
No such file or directory
No such file or directory
No such file or directory
No such file or directory
No such file or directory


[0/1] files were written.

Here's my test markdown file:

Hello

```c
struct MailStructure {
  unsigned int data : 18;  // Assuming data is 18 bits
  unsigned int reserved : 10;
  unsigned int channel : 4;
};
```
@lukas-reineke
Copy link
Owner

Yeah it naively just splits by whitespace at the moment.

I'll look into this when I have some time.

For now, I guess an easy workaround is to just not use spaces.

@UtkarshVerma
Copy link
Author

Thanks, please take your time. I'm using .clang-format for the time being, as the style argument strictly requires spaces.

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

2 participants