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

Formatting can get thrown off by * modifier #12

Open
anguslocke opened this issue Mar 22, 2023 · 4 comments
Open

Formatting can get thrown off by * modifier #12

anguslocke opened this issue Mar 22, 2023 · 4 comments

Comments

@anguslocke
Copy link

Minor formatting bug:

Take example (Google-style formatting)

union() {
  difference() {
    circle();
    square();
  }
}

circle();

Suppose you want to hide the last circle, like:

union() {
  difference() {
    circle();
    square();
  }
}

*circle();

Formatting the file results in

union(){difference(){circle();
square();
}
}

*circle();

(workaround: make a dummy module hide(), and use that instead of * )

@Leathong
Copy link
Owner

In fact there is no dedicated OpenSCAD formatting tool, the formatting function simply calls clang-format. So if the format is too different from the c language, it will not be formatted correctly. There is no good resolution for now, it is a big project.

@Leathong
Copy link
Owner

I'll try a workaround, replacing the * modifier by a mark before formatting and restoring it after it was done.

@anguslocke
Copy link
Author

ah, ok, I thought there was already some openSCAD special formatting sauce already.
That sounds like a good workaround; same with the ! and # modifiers too?

@Leathong
Copy link
Owner

All modifier characters are not handled for now, they can be processed by the same way.

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