From cc8b3f792eb245cfdcc7c6dce76f2eaf18061d18 Mon Sep 17 00:00:00 2001 From: Sigmund Cherem Date: Thu, 18 May 2023 18:53:39 +0000 Subject: [PATCH] [analyzer] minor updates to the quick_fix.md documentation The changes are: * Use the current tear-off syntax for constuctors in the example * Add references to the code where certain maps are defined. Change-Id: I5710090c1ecb2939d74a3822b8c7b35090be378c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304323 Commit-Queue: Sigmund Cherem Reviewed-by: Brian Wilkerson --- .../doc/implementation/quick_fix.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pkg/analysis_server/doc/implementation/quick_fix.md b/pkg/analysis_server/doc/implementation/quick_fix.md index 21f65a2c577..04df53d3840 100644 --- a/pkg/analysis_server/doc/implementation/quick_fix.md +++ b/pkg/analysis_server/doc/implementation/quick_fix.md @@ -207,14 +207,14 @@ The list of fixes is computed by a `FixProcessor`. For each diagnostic passed to it, it will look up the diagnostic in a table to get a list of the correction producers it can use to produce fixes. There are three tables: -- The `lintProducerMap` is used for fixes related to lint rules. The table is - keyed by the name of the lint to which the fix applies. +- The [`lintProducerMap`][lintmap] is used for fixes related to lint rules. The + table is keyed by the name of the lint to which the fix applies. -- The `nonLintProducerMap` is used for all other fixes. The table is keyed by - the `ErrorCode` associated with the diagnostic. +- The [`nonLintProducerMap`][nonlintmap] is used for all other fixes. The table + is keyed by the `ErrorCode` associated with the diagnostic. -- The `nonLintMultiProducerMap` is used for multi-producers, which are - described below in "Multi-fix producers". +- The [`nonLintMultiProducerMap`][multimap] is used for multi-producers, which + are described below in "Multi-fix producers". Actually, the tables contain lists of functions used to create the producers. We do that so that producers can't accidentally carry state over from one use to @@ -226,7 +226,7 @@ you're adding a fix for a lint, then you'd add an entry like ```dart LintNames.could_be_final: [ - AddFinal.newInstance, + AddFinal.new, ], ``` @@ -562,3 +562,7 @@ will be identical in nature to those written to test the fix-in-file use case, but will be in a subclass of `BulkFixProcessorTest`. They should also be added to the test file you created earlier for the single-site and fix-in-file fixes (`analysis_server/test/src/services/correction/fix/add_final_test.dart`). + +[lintmap]: https://github.com/dart-lang/sdk/blob/cc461910af5f138bb54025e33f539835262b02bc/pkg/analysis_server/lib/src/services/correction/fix_internal.dart#L394 +[nonlintmap]: https://github.com/dart-lang/sdk/blob/cc461910af5f138bb54025e33f539835262b02bc/pkg/analysis_server/lib/src/services/correction/fix_internal.dart#L959 +[multimap]: https://github.com/dart-lang/sdk/blob/cc461910af5f138bb54025e33f539835262b02bc/pkg/analysis_server/lib/src/services/correction/fix_internal.dart#L791