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

Feature Proposal: Improved Array Literal Formatting in Typstyle #211

Open
Tracked by #214
Enter-tainer opened this issue Dec 29, 2024 · 1 comment
Open
Tracked by #214

Comments

@Enter-tainer
Copy link
Owner

generated by genai from unstructured chat log

Issue Description

Currently, the formatting of array literals in Typstyle can be improved to enhance readability and compactness. This proposal suggests several enhancements to the way array elements are formatted, particularly focusing on multi-line arrays and import sorting.

Proposed Features

  1. Multi-line Array Literals:
    • Allow array elements to be placed on the same line when possible, rather than forcing each element onto a new line. For example:
      [1, 2, 3, 4,
       5, 6, 7, 8]
      Instead of:
      [1,
       2,
       3,
       4]
    • Implement a heuristic to determine when to break lines based on element length and column width. For instance:
      • Calculate the length variance of elements.
      • Ensure no single element exceeds a certain proportion of the column width (e.g., half or one-quarter).
      • If the longest element exceeds the threshold, place each element on a new line.
@Enter-tainer
Copy link
Owner Author

cc @QuadnucYard

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

1 participant