DAS plugins: Fix parameter type of registerFixForRule

Fixes https://github.com/dart-lang/sdk/issues/61928

Change-Id: Ibdd63ebe9d70217e8699546d916826480bdfd3f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460901
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Sam Rawlins
2025-11-10 13:25:11 -08:00
committed by Commit Queue
parent 5dc92fd0ad
commit b08eab360c
6 changed files with 14 additions and 7 deletions
+5
View File
@@ -1,3 +1,8 @@
## 0.3.5-dev
- `PluginRegistry.registerFixForRule` now accepts a `DiagnosticCode` (a
supertype of the old parameter type, `LintCode`).
## 0.3.4
- Require version `9.0.0` of the `analyzer` package.
+2 -3
View File
@@ -147,7 +147,7 @@ package:analysis_server_plugin/registry.dart:
PluginRegistry (class extends Object):
new (constructor: PluginRegistry Function())
registerAssist (method: void Function(CorrectionProducer<ParsedUnitResult> Function({required CorrectionProducerContext context})))
registerFixForRule (method: void Function(LintCode, CorrectionProducer<ParsedUnitResult> Function({required CorrectionProducerContext context})))
registerFixForRule (method: void Function(DiagnosticCode, CorrectionProducer<ParsedUnitResult> Function({required CorrectionProducerContext context})))
registerLintRule (method: void Function(AbstractAnalysisRule))
registerWarningRule (method: void Function(AbstractAnalysisRule))
dart:async:
@@ -164,6 +164,7 @@ dart:core:
int (referenced)
package:_fe_analyzer_shared/src/base/errors.dart:
Diagnostic (referenced)
DiagnosticCode (referenced)
package:_fe_analyzer_shared/src/scanner/token.dart:
Token (referenced)
package:analyzer/analysis_rule/analysis_rule.dart:
@@ -212,8 +213,6 @@ package:analyzer/src/dart/ast/ast.dart:
package:analyzer/src/dart/element/inheritance_manager3.dart:
InheritanceManager3 (referenced)
Name (referenced)
package:analyzer/src/dart/error/lint_codes.dart:
LintCode (referenced)
package:analyzer_plugin/protocol/protocol_common.dart:
SourceChange (referenced)
package:analyzer_plugin/utilities/assist/assist.dart:
+1 -1
View File
@@ -12,7 +12,7 @@ abstract class PluginRegistry {
/// Registers this fix [generator] for the given lint [code] with the
/// analyzer's rule registry.
void registerFixForRule(LintCode code, ProducerGenerator generator);
void registerFixForRule(DiagnosticCode code, ProducerGenerator generator);
/// Registers this [rule] with the analyzer's rule registry.
void registerLintRule(AbstractAnalysisRule rule);
@@ -62,7 +62,10 @@ class _RegisteredFixGenerators {
/// Associates the given correction producer [generator] with the lint with
/// the given [lintCode].
void registerFixForLint(LintCode lintCode, ProducerGenerator generator) {
void registerFixForLint(
DiagnosticCode lintCode,
ProducerGenerator generator,
) {
lintProducers.putIfAbsent(lintCode, () => []).add(generator);
}
}
@@ -44,7 +44,7 @@ final class PluginRegistryImpl implements PluginRegistry {
}
@override
void registerFixForRule(LintCode code, ProducerGenerator generator) {
void registerFixForRule(DiagnosticCode code, ProducerGenerator generator) {
var producer = generator(context: StubCorrectionProducerContext.instance);
var fixKind = producer.fixKind;
if (fixKind == null) {
+1 -1
View File
@@ -1,6 +1,6 @@
name: analysis_server_plugin
description: A framework and support code for building plugins for the analysis server.
version: 0.3.4
version: 0.3.5-dev
repository: https://github.com/dart-lang/sdk/tree/main/pkg/analysis_server_plugin
environment: