-
Hi Kim, In the codebase where I'm working, there are some functions that should always be preceded by a newline, for example:
Is there a way to configure zprint to always insert that newline, instead of collapsing to:
Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hey Aron! There is no way, at present, to have a function affect the formatting of the function containing it. Well, not without having every function look into what it contains and look for specific functions that needed to be proceeded by a newline. Which could be done, but it would make the configuration truly unpleasant for every function to be configured to do that. It would be possible to have some specific functions look into what they contain and precede some functions with newlines. Alternatively, it is very simple to have
That may be overmuch change to Let me know if you would like me to put together something which you could attach to some specific functions and which would check their arguments for a particular set of other functions and if any of them appeared, would cause the containing function to not format on a single line. I'm pretty sure that I could make this work with If you are interested in something like that, it would help me to know what functions you think you might want to look into themselves for the functions which would force printing to never be on the same line, and which functions you would expect would force that "not on the same line" behavior. I am aware that I have restated your request to be "some functions force the containing function to never format on the same line" instead of "some function force a newline before they format". I believe that my restatement will cause your original request to happen, and it is something that I think zprint can actually achieve in a reasonable way. It is possible that I could actually insert a newline before some functions, and I would look into that, but it is considerably more complex for reasons that nobody is really interested in hearing about. |
Beta Was this translation helpful? Give feedback.
Hey Aron!
There is no way, at present, to have a function affect the formatting of the function containing it. Well, not without having every function look into what it contains and look for specific functions that needed to be proceeded by a newline. Which could be done, but it would make the configuration truly unpleasant for every function to be configured to do that.
It would be possible to have some specific functions look into what they contain and precede some functions with newlines.
Alternatively, it is very simple to have
when
always place its first argument on the same line (if possible) and then the remaining arguments on the next line, regardless of the next arguments and reg…