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

Treat as expressions as block-formattable if the subexpression is #1542

Open
dcharkes opened this issue Aug 17, 2024 · 3 comments
Open

Treat as expressions as block-formattable if the subexpression is #1542

dcharkes opened this issue Aug 17, 2024 · 3 comments

Comments

@dcharkes
Copy link

dcharkes commented Aug 17, 2024

Update: awaits are fixed, as is not yet.

        final result = await buildDryRun(
          packageUri,
          createCapturingLogger(logMessages, level: Level.SEVERE),
          dartExecutable,
          linkingEnabled: false,
        );

->

        final result =
            await buildDryRun(
              packageUri,
              createCapturingLogger(logMessages, level: Level.SEVERE),
              dartExecutable,
              linkingEnabled: false,
            );

I'm not sure why the extra indentation is needed here. I expect this to be indented like it would be without an await

        final result = buildDryRun(
          packageUri,
          createCapturingLogger(logMessages, level: Level.SEVERE),
          dartExecutable,
          linkingEnabled: false,
        );

Is the await significant here? Or is it simply that the formatter deems the expression getting too big?

Source: https://github.com/dart-lang/native/blob/main/pkgs/native_assets_builder/test/build_runner/build_runner_cycle_test.dart

@dcharkes
Copy link
Author

      final buildConfig = BuildConfig.build(
        outputDirectory: outputDirectory,
        packageName: await _packageName(),
        packageRoot: Directory.current.uri,
        buildMode: buildMode ?? BuildMode.release,
        targetArchitecture: targetArchitecture ?? Architecture.current,
        targetOS: targetOS ?? OS.current,
        linkModePreference: linkModePreference ?? LinkModePreference.dynamic,
        linkingEnabled: linkingEnabled ?? true,
        cCompiler: cCompiler,
        supportedAssetTypes: supportedAssetTypes,
        targetAndroidNdkApi: targetAndroidNdkApi,
        targetIOSSdk: targetIOSSdk,
        targetIOSVersion: targetIOSVersion,
        targetMacOSVersion: targetMacOSVersion,
      ) as BuildConfigImpl;

->

    final buildConfig =
        BuildConfig.build(
              outputDirectory: outputDirectory,
              packageName: await _packageName(),
              packageRoot: Directory.current.uri,
              buildMode: buildMode ?? BuildMode.release,
              targetArchitecture: targetArchitecture ?? Architecture.current,
              targetOS: targetOS ?? OS.current,
              linkModePreference:
                  linkModePreference ?? LinkModePreference.dynamic,
              linkingEnabled: linkingEnabled ?? true,
              cCompiler: cCompiler,
              supportedAssetTypes: supportedAssetTypes,
              targetAndroidNdkApi: targetAndroidNdkApi,
              targetIOSSdk: targetIOSSdk,
              targetIOSVersion: targetIOSVersion,
              targetMacOSVersion: targetMacOSVersion,
            )
            as BuildConfigImpl;

Is this similar as to the await? that an as prevents no indentation?

Source: https://github.com/dart-lang/native/blob/main/pkgs/native_assets_cli/lib/src/api/test.dart

@dcharkes dcharkes changed the title [tall style] Multi-line variable initializer with await indentation [tall style] Multi-line variable initializer with await or as indentation Aug 17, 2024
@dcharkes
Copy link
Author

Duplicate: #1531

@dcharkes dcharkes changed the title [tall style] Multi-line variable initializer with await or as indentation Treat as expressions as block-formattable if the subexpression is Aug 22, 2024
@dcharkes dcharkes reopened this Aug 22, 2024
@dcharkes
Copy link
Author

awaits are fixed as of #1538 ❤️

as expressions are not block-formatted.

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