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

Only add dart format width comment on format #733

Merged
merged 2 commits into from
Dec 12, 2024
Merged

Conversation

natebosch
Copy link
Member

Closes #724

A use case with a custom formatCode callback can reasonably use a
different line width than the default, so only add the width comment
when this package is responsible for performing a format.

Uses with a custom header will no longer slot the width comment in
following the header.

Some outputs will no longer have the comment. This is not breaking since
there has been no published since the comment was introduced.

Closes #724

A use case with a custom `formatCode` callback can reasonably use a
different line width than the default, so only add the width comment
when this package is responsible for performing a format.

Uses with a custom header will no longer slot the width comment in
following the header.

Some outputs will no longer have the comment. This is not breaking since
there has been no published since the comment was introduced.
@natebosch natebosch requested a review from jakemac53 December 10, 2024 00:07
Files using the shared part builder will need to resolve format width
conflicts using some other mechanism. A shared part file can have
outputs contributed from different code generators that are unrelated,
and may have different behavior around formatting, so it is not possible
to write a single width comment that applies to the combined file.
@kevmoo
Copy link
Member

kevmoo commented Dec 12, 2024

So the idea here is that we don't have a good way to extract the style info from analysis_options, so we're just going to hard-wire?

@natebosch
Copy link
Member Author

So the idea here is that we don't have a good way to extract the style info from analysis_options, so we're just going to hard-wire?

Yes. It is not guaranteed that the configuration is in a file that we make readable during builds.

@natebosch natebosch merged commit 9f95ac3 into master Dec 12, 2024
12 checks passed
@natebosch natebosch deleted the width-on-format branch December 12, 2024 21:50
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.

Add "// dart format width=80" comment in generated code
3 participants