Skip to content

feat: bump typstyle to v0.13.9 and add config for hard wrap #1737

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

Merged
merged 1 commit into from
May 28, 2025

Conversation

Enter-tainer
Copy link
Collaborator

@Enter-tainer Enter-tainer commented May 3, 2025

TODO:

  • should we use enabled, disabled, auto enum for hard wrapping?

@Enter-tainer Enter-tainer force-pushed the mgt/typstyle-0.13.4 branch 4 times, most recently from 1d56f44 to eb10071 Compare May 4, 2025 08:17
@Enter-tainer Enter-tainer marked this pull request as ready for review May 4, 2025 08:24
@Enter-tainer Enter-tainer force-pushed the mgt/typstyle-0.13.4 branch from eb10071 to 6ecfcf6 Compare May 4, 2025 08:25
@Myriad-Dreamin
Copy link
Owner

we should remove the auto, as we didn't enable it for typstfmt as well. Just disable it by default.

@Enter-tainer Enter-tainer force-pushed the mgt/typstyle-0.13.4 branch 2 times, most recently from a5e81af to 358e739 Compare May 4, 2025 15:45
@@ -116,7 +116,8 @@ pub struct Config {
pub formatter_print_width: Option<u32>,
/// Sets the indent size (using space) for the formatter.
pub formatter_indent_size: Option<u32>,

/// Sets the hard line wrapping mode for the formatter.
pub formatter_hard_wrap: Option<bool>,
Copy link
Owner

@Myriad-Dreamin Myriad-Dreamin May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bikeshedding time, this should be "prose wrap". Existing editors and tools say "line wrap", "word wrap", or "prose wrap" and I haven't seen any configuration named "hard wrap". I understand "hard wrap" comes from "hard line wrap", but it becomes unclear when we omit the thing to wrap. Meanwhile, formatterPrintWidth already means hard line wrap that the formatter should fit in best effort, then "hard wrap" might be confusing. People may also ask: does "hard wrap" mean that whether "formatterPrintWidth" should be respect or not?

For the concrete name, I haven't decide a certain good choice:

  • By mode:
    • formatterMarkupWrap: wrap lines under markup mode.
    • formatterMathWrap or formatterEquationWrap may mean: wrap lines under math mode.
    • formatterCommentWrap may mean: wrap lines under comment mode.
  • By abstract concepts:
    • formatterProseWrap: wrap proses under comment, math, or markup mode.
    • formatterEquationWrap may mean: wrap lines in equations.
  • Special cases:
    • formatterCodeInProseWrap: this is subtle that whether we will do it or not.
// Show the following hash expression be affected by prose configuration?
lorem #a-func-call-between-proses(a, b, c) ipsum.

Make things clear will benefit to extend the semantics in future. For example, prettier's prose wrap has mode more than true (always) or false (preserve?):

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, PTAL

@Enter-tainer Enter-tainer marked this pull request as draft May 9, 2025 03:18
@Enter-tainer Enter-tainer force-pushed the mgt/typstyle-0.13.4 branch 2 times, most recently from 9df1e1b to 3f9b26b Compare May 9, 2025 15:09
@Enter-tainer Enter-tainer marked this pull request as ready for review May 10, 2025 04:26
@Enter-tainer Enter-tainer force-pushed the mgt/typstyle-0.13.4 branch 4 times, most recently from 8e3d0f5 to 296371c Compare May 15, 2025 14:58
@Enter-tainer Enter-tainer changed the title feat: bump typstyle to v0.13.4 and add config for hard wrap feat: bump typstyle to v0.13.7 and add config for hard wrap May 15, 2025
@Enter-tainer Enter-tainer force-pushed the mgt/typstyle-0.13.4 branch from 296371c to 0aa3d63 Compare May 25, 2025 05:46
@Enter-tainer Enter-tainer changed the title feat: bump typstyle to v0.13.7 and add config for hard wrap feat: bump typstyle to v0.13.9 and add config for hard wrap May 27, 2025
@Myriad-Dreamin Myriad-Dreamin merged commit 39368da into main May 28, 2025
42 checks passed
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

Successfully merging this pull request may close these issues.

2 participants