From eb1c9690350b28853bcf59f35e3476504a5e9f0c Mon Sep 17 00:00:00 2001 From: Pascal Welsch Date: Mon, 22 Jul 2024 19:03:20 +0200 Subject: [PATCH] Fix SdkInitializerContext when calling dart format Now includes the package, when explicitly called for a package --- sidekick_core/lib/src/commands/format_command.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sidekick_core/lib/src/commands/format_command.dart b/sidekick_core/lib/src/commands/format_command.dart index b8ef7019..cc5699e0 100644 --- a/sidekick_core/lib/src/commands/format_command.dart +++ b/sidekick_core/lib/src/commands/format_command.dart @@ -106,6 +106,7 @@ class FormatCommand extends Command { lineLength: lineLength, files: allDartFiles, verify: verify, + workingDirectory: package.root, ); _verifyThrow(); return; @@ -159,6 +160,7 @@ class FormatCommand extends Command { required int lineLength, required Iterable files, bool verify = false, + Directory? workingDirectory, }) async { if (verify) { print("Verifying $name"); @@ -177,7 +179,7 @@ class FormatCommand extends Command { '-l', '$lineLength', if (!verify) '--fix', - ...files.map((file) => file.path), + ...files.map((file) => file.absolute.path), if (verify) '--set-exit-if-changed', if (verify) '--output=none', ], @@ -185,6 +187,7 @@ class FormatCommand extends Command { // Lines like `Changed x.dart`, `Formatted x files (y changed) in z seconds` // should only be printed when the change is actually written to the files (when verify is false) progress: progress, + workingDirectory: workingDirectory, ); exitCode = completion.exitCode ?? 1; if (exitCode != 0) {