Skip to content

Conversation

Vild
Copy link
Contributor

@Vild Vild commented May 23, 2025

Adds a flag to the build.xml's options to prefix the generated code with // dart format off.
I set the default value is true to not affect any existing output.

Do I need to make any other changes for this simple feature?

Copy link

netlify bot commented May 23, 2025

Deploy Preview for ferry-gql ready!

Name Link
🔨 Latest commit 0e34bae
🔍 Latest deploy log https://app.netlify.com/projects/ferry-gql/deploys/689afd84a7c4750008050a4f
😎 Deploy Preview https://deploy-preview-640--ferry-gql.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@knaeckeKami knaeckeKami requested a review from Copilot June 19, 2025 11:05
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces an option to disable formatting in the generated code by conditionally adding a "// dart format off" prefix.

  • Adds a boolean flag in the writeDocument function to control formatting
  • Updates BuilderConfig to read this flag from the configuration with a default of true
  • Propagates the flag through serializer_builder.dart and graphql_builder.dart to ensure consistent behavior

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/ferry_generator/lib/src/utils/writer.dart Adds a new bool parameter to control whether the formatting comment is prepended
packages/ferry_generator/lib/src/utils/config.dart Includes the new flag in BuilderConfig with a default value to preserve existing behavior
packages/ferry_generator/lib/serializer_builder.dart Passes the new flag from config into writeDocument
packages/ferry_generator/lib/graphql_builder.dart Passes the new flag from config into writeDocument
Comments suppressed due to low confidence (2)

packages/ferry_generator/lib/src/utils/writer.dart:17

  • [nitpick] Consider renaming the 'format' flag to 'enableFormatting' to more clearly express that a true value means formatting is enabled, which may improve code readability.
  bool format,

packages/ferry_generator/lib/src/utils/config.dart:51

  • [nitpick] Consider renaming the 'format' property to 'enableFormatting' in your configuration for consistency and clarity.
        format = config['format'] ?? true;

@knaeckeKami
Copy link
Collaborator

Thanks and sorry for the long delay, i missed this.

Please document this feature in

docs/codegen.md, this will be used the generate the website.

@Vild
Copy link
Contributor Author

Vild commented Aug 11, 2025

Done :)

@Vild Vild force-pushed the feat/disable_formatter branch from f343fe8 to 0e34bae Compare August 12, 2025 08:38
@knaeckeKami knaeckeKami merged commit f3a9456 into gql-dart:master Aug 12, 2025
8 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