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

Enable fixes/assits to edit other files #187

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add new parameter customPath to method addGenericFileEdit
matthiaslarisch authored Sep 8, 2023
commit 138d860685216770825c8588288110c5d3cae141
15 changes: 10 additions & 5 deletions packages/custom_lint_core/lib/src/change_reporter.dart
Original file line number Diff line number Diff line change
@@ -76,9 +76,13 @@ abstract class ChangeBuilder {
///
/// The builder passed to the [buildFileEdit] function has no special support
/// for any particular kind of file.
///
/// Use the [customPath] if the collection of edits should be written to another
/// file.
void addGenericFileEdit(
void Function(analyzer_plugin.FileEditBuilder builder) buildFileEdit,
);
void Function(analyzer_plugin.FileEditBuilder builder) buildFileEdit, {
String? customPath,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We'd need this on all addXFileEdit, such as addDartFileEdit

Copy link
Author

Choose a reason for hiding this comment

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

Done. customPath parameter added to all addXFileEdit methods

});

/// Use the [buildFileEdit] function to create a collection of edits to the
/// currently analyzed file. The edits will be added to the source change
@@ -124,10 +128,11 @@ class _ChangeBuilderImpl implements ChangeBuilder {

@override
void addGenericFileEdit(
void Function(analyzer_plugin.FileEditBuilder builder) buildFileEdit,
) {
void Function(analyzer_plugin.FileEditBuilder builder) buildFileEdit, {
String? customPath,
}) {
_operations.add(
_innerChangeBuilder.addGenericFileEdit(path, buildFileEdit),
_innerChangeBuilder.addGenericFileEdit(customPath ?? path, buildFileEdit),
);
}