Closed mweinelt closed 5 months ago
one thing to notice is that column width is not a hard limit. and it mostly apply to scripting mode at this moment.
currently typsyle tend to keep content untouched. so the behavior is expected
@Enter-tainer Hi! I'm migrating from typstfmt where max_line_length
acted as a hard limit, so I'm noticing a difference in how typstyle handles this. Could you clarify what you meant by "it mostly apply to scripting mode at this moment"?
I'd also like to understand the purpose of a soft limit option. Is there a way to configure typstyle to enforce a hard limit like typstfmt did? I'm curious about the reasoning behind this design choice. Thanks!
can you show relevant code snippets so we can better understand it?
Is there a way to configure typstyle to enforce a hard limit like typstfmt did?
To clarify this, typstyle only format code. this is one of the main design goals of typstyle:
Code only: We want to format only the code. Contents should be left untouched as much as possible.
I'd also like to understand the purpose of a soft limit option. I'm curious about the reasoning behind this design choice.
reflowing content is very risky and error prone. and this only works for languages that use spaces to seprate words. for other languages, it is not even possible to do reflow.
Since we cannot do it well, i prefer not touch it and leave it as is.
why soft limit: hard limit is impossible to have on corner cases. like you have a variable name of 81 characters. no matter how you format the code, there is always a line exceed the 80 char limit. so typstyle cannot guarantee a hard limit. it can only try its best to meet the soft limit
reflowing content is very risky and error prone.
see https://github.com/astrale-sharp/typstfmt/issues/164 for example.
Hm, yes, everything you say makes a lot of sense to me. I didn't think about the risks involved, but that example is a very strong argument (as well as the reasoning to create soft limits instead of hard limits).
Thanks for your time and the detailed explanation, I really appreciate it.
But it would be nice if there was an option if "normal" text would get broken up after the column limit.
@Wulfheart tracking in #104
Hi, thank you for creating and maintaining typstyle!
I noticed an issue with the
--column
option on 0.11.22 (from nixpkgs), where it would not enforce the default or any other configured column width. Wondering if my understanding of this option is wrong, or if the option is just broken at this point.