[analysis_server] Remove ignoring `avoid_renaming_method_parameters`
Bug: #48785
Change-Id: I089dd5a76bf5c5c5d4e57ecc8ddaabda04866621
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245361
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
diff --git a/pkg/analysis_server/analysis_options.yaml b/pkg/analysis_server/analysis_options.yaml
index 548d7ea..a72e0f7 100644
--- a/pkg/analysis_server/analysis_options.yaml
+++ b/pkg/analysis_server/analysis_options.yaml
@@ -12,7 +12,6 @@
# Lints from the recommended set that conflict w/ analyzer style or will
# require some work to reach compliance.
# See: https://github.com/dart-lang/sdk/issues/48785
- avoid_renaming_method_parameters: ignore
camel_case_types: ignore
constant_identifier_names: ignore
file_names: ignore
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
index 84ccaac..b303906 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
@@ -2778,7 +2778,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is CodeActionKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is CodeActionKind && other._value == _value;
}
class CodeActionLiteralSupportCodeActionKind implements ToJsonable {
@@ -3354,8 +3355,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) =>
- o is CodeActionTriggerKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is CodeActionTriggerKind && other._value == _value;
}
/// Structure to capture a description for an error code.
@@ -6192,7 +6193,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is CompletionItemKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is CompletionItemKind && other._value == _value;
}
/// Additional details for a completion item label.
@@ -6385,7 +6387,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is CompletionItemTag && o._value == _value;
+ bool operator ==(Object other) =>
+ other is CompletionItemTag && other._value == _value;
}
class CompletionItemTagSupport implements ToJsonable {
@@ -7563,8 +7566,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) =>
- o is CompletionTriggerKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is CompletionTriggerKind && other._value == _value;
}
class ConfigurationItem implements ToJsonable {
@@ -10145,7 +10148,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is DiagnosticSeverity && o._value == _value;
+ bool operator ==(Object other) =>
+ other is DiagnosticSeverity && other._value == _value;
}
/// The diagnostic tags.
@@ -10179,7 +10183,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is DiagnosticTag && o._value == _value;
+ bool operator ==(Object other) =>
+ other is DiagnosticTag && other._value == _value;
}
/// Workspace client capabilities specific to diagnostic pull requests.
@@ -12065,8 +12070,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) =>
- o is DocumentDiagnosticReportKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is DocumentDiagnosticReportKind && other._value == _value;
}
/// A partial result for a document diagnostic report.
@@ -12726,8 +12731,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) =>
- o is DocumentHighlightKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is DocumentHighlightKind && other._value == _value;
}
class DocumentHighlightOptions implements WorkDoneProgressOptions, ToJsonable {
@@ -15514,7 +15519,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is ErrorCodes && o._value == _value;
+ bool operator ==(Object other) =>
+ other is ErrorCodes && other._value == _value;
}
class ExecuteCommandClientCapabilities implements ToJsonable {
@@ -16040,7 +16046,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is FailureHandlingKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is FailureHandlingKind && other._value == _value;
}
/// The file event type.
@@ -16071,7 +16078,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is FileChangeType && o._value == _value;
+ bool operator ==(Object other) =>
+ other is FileChangeType && other._value == _value;
}
/// Represents information on a file/folder create.
@@ -16980,8 +16988,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) =>
- o is FileOperationPatternKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is FileOperationPatternKind && other._value == _value;
}
/// Matching options for the file operation pattern.
@@ -17873,7 +17881,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is FoldingRangeKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is FoldingRangeKind && other._value == _value;
}
class FoldingRangeOptions implements WorkDoneProgressOptions, ToJsonable {
@@ -20823,7 +20832,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is InlayHintKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is InlayHintKind && other._value == _value;
}
/// An inlay hint label part allows for interactive and composite labels of
@@ -22529,7 +22539,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is InsertTextFormat && o._value == _value;
+ bool operator ==(Object other) =>
+ other is InsertTextFormat && other._value == _value;
}
/// How whitespace and indentation is handled during completion item insertion.
@@ -22566,7 +22577,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is InsertTextMode && o._value == _value;
+ bool operator ==(Object other) =>
+ other is InsertTextMode && other._value == _value;
}
class LinkedEditingRangeClientCapabilities implements ToJsonable {
@@ -23780,7 +23792,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is MarkupKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is MarkupKind && other._value == _value;
}
class MessageActionItem implements ToJsonable {
@@ -23881,7 +23894,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is MessageType && o._value == _value;
+ bool operator ==(Object other) =>
+ other is MessageType && other._value == _value;
}
/// Valid LSP methods known at the time of code generation from the spec.
@@ -24207,7 +24221,7 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is Method && o._value == _value;
+ bool operator ==(Object other) => other is Method && other._value == _value;
}
/// Moniker definition to match LSIF 0.5 moniker definition.
@@ -24457,7 +24471,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is MonikerKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is MonikerKind && other._value == _value;
}
class MonikerOptions implements WorkDoneProgressOptions, ToJsonable {
@@ -25084,7 +25099,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is NotebookCellKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is NotebookCellKind && other._value == _value;
}
/// A notebook cell text document filter denotes a cell text document by
@@ -27720,7 +27736,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is PositionEncodingKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is PositionEncodingKind && other._value == _value;
}
class PrepareRenameParams implements TextDocumentPositionParams, ToJsonable {
@@ -27846,8 +27863,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) =>
- o is PrepareSupportDefaultBehavior && o._value == _value;
+ bool operator ==(Object other) =>
+ other is PrepareSupportDefaultBehavior && other._value == _value;
}
/// A previous result id in a workspace pull request.
@@ -30646,8 +30663,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) =>
- o is ResourceOperationKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is ResourceOperationKind && other._value == _value;
}
class SaveOptions implements ToJsonable {
@@ -31255,8 +31272,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) =>
- o is SemanticTokenModifiers && o._value == _value;
+ bool operator ==(Object other) =>
+ other is SemanticTokenModifiers && other._value == _value;
}
class SemanticTokenTypes implements ToJsonable {
@@ -31303,7 +31320,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is SemanticTokenTypes && o._value == _value;
+ bool operator ==(Object other) =>
+ other is SemanticTokenTypes && other._value == _value;
}
class SemanticTokens implements ToJsonable {
@@ -36599,8 +36617,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) =>
- o is SignatureHelpTriggerKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is SignatureHelpTriggerKind && other._value == _value;
}
/// Represents the signature of something callable. A signature can have a
@@ -37200,7 +37218,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is SymbolKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is SymbolKind && other._value == _value;
}
/// Symbol tags are extra annotations that tweak the rendering of a symbol.
@@ -37226,7 +37245,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is SymbolTag && o._value == _value;
+ bool operator ==(Object other) =>
+ other is SymbolTag && other._value == _value;
}
/// Describe options to be used when registering for text document change
@@ -39232,8 +39252,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) =>
- o is TextDocumentSaveReason && o._value == _value;
+ bool operator ==(Object other) =>
+ other is TextDocumentSaveReason && other._value == _value;
}
class TextDocumentSaveRegistrationOptions
@@ -39503,7 +39523,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is TextDocumentSyncKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is TextDocumentSyncKind && other._value == _value;
}
class TextDocumentSyncOptions implements ToJsonable {
@@ -39802,7 +39823,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is TokenFormat && o._value == _value;
+ bool operator ==(Object other) =>
+ other is TokenFormat && other._value == _value;
}
class TypeDefinitionClientCapabilities implements ToJsonable {
@@ -41297,7 +41319,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is UniquenessLevel && o._value == _value;
+ bool operator ==(Object other) =>
+ other is UniquenessLevel && other._value == _value;
}
/// General parameters to unregister a capability.
@@ -41708,7 +41731,8 @@
@override
int get hashCode => _value.hashCode;
- bool operator ==(Object o) => o is WatchKind && o._value == _value;
+ bool operator ==(Object other) =>
+ other is WatchKind && other._value == _value;
}
/// The parameters send in a will save text document notification.
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart
index 57cce17..610813f 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart
@@ -70,6 +70,7 @@
const Either2.t1(T1 this._t1)
: _t2 = null,
_which = 1;
+
const Either2.t2(T2 this._t2)
: _t1 = null,
_which = 2;
@@ -78,8 +79,10 @@
int get hashCode => map(lspHashCode, lspHashCode);
@override
- bool operator ==(o) =>
- o is Either2<T1, T2> && lspEquals(o._t1, _t1) && lspEquals(o._t2, _t2);
+ bool operator ==(other) =>
+ other is Either2<T1, T2> &&
+ lspEquals(other._t1, _t1) &&
+ lspEquals(other._t2, _t2);
T map<T>(T Function(T1) f1, T Function(T2) f2) {
return _which == 1 ? f1(_t1 as T1) : f2(_t2 as T2);
@@ -104,10 +107,12 @@
: _t2 = null,
_t3 = null,
_which = 1;
+
Either3.t2(this._t2)
: _t1 = null,
_t3 = null,
_which = 2;
+
Either3.t3(this._t3)
: _t1 = null,
_t2 = null,
@@ -117,11 +122,11 @@
int get hashCode => map(lspHashCode, lspHashCode, lspHashCode);
@override
- bool operator ==(o) =>
- o is Either3<T1, T2, T3> &&
- lspEquals(o._t1, _t1) &&
- lspEquals(o._t2, _t2) &&
- lspEquals(o._t3, _t3);
+ bool operator ==(other) =>
+ other is Either3<T1, T2, T3> &&
+ lspEquals(other._t1, _t1) &&
+ lspEquals(other._t2, _t2) &&
+ lspEquals(other._t3, _t3);
T map<T>(T Function(T1) f1, T Function(T2) f2, T Function(T3) f3) {
switch (_which) {
@@ -161,16 +166,19 @@
_t3 = null,
_t4 = null,
_which = 1;
+
Either4.t2(this._t2)
: _t1 = null,
_t3 = null,
_t4 = null,
_which = 2;
+
Either4.t3(this._t3)
: _t1 = null,
_t2 = null,
_t4 = null,
_which = 3;
+
Either4.t4(this._t4)
: _t1 = null,
_t2 = null,
@@ -181,12 +189,12 @@
int get hashCode => map(lspHashCode, lspHashCode, lspHashCode, lspHashCode);
@override
- bool operator ==(o) =>
- o is Either4<T1, T2, T3, T4> &&
- lspEquals(o._t1, _t1) &&
- lspEquals(o._t2, _t2) &&
- lspEquals(o._t3, _t3) &&
- lspEquals(o._t4, _t4);
+ bool operator ==(other) =>
+ other is Either4<T1, T2, T3, T4> &&
+ lspEquals(other._t1, _t1) &&
+ lspEquals(other._t2, _t2) &&
+ lspEquals(other._t3, _t3) &&
+ lspEquals(other._t4, _t4);
T map<T>(T Function(T1) f1, T Function(T2) f2, T Function(T3) f3,
T Function(T4) f4) {
@@ -221,6 +229,7 @@
class ErrorOr<T> extends Either2<ResponseError, T> {
ErrorOr.error(super.error) : super.t1();
+
ErrorOr.success(super.result) : super.t2();
/// Returns the error or throws if object is not an error. Check [isError]
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 5974884..c2fa2c8 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -931,26 +931,25 @@
}
@override
- void listenAnalysisDriver(analysis.AnalysisDriver analysisDriver) {
- analysisDriver.results.listen((result) {
+ void listenAnalysisDriver(analysis.AnalysisDriver driver) {
+ driver.results.listen((result) {
if (result is FileResult) {
_handleFileResult(result);
}
});
- analysisDriver.exceptions.listen(analysisServer.logExceptionResult);
- analysisDriver.priorityFiles = analysisServer.priorityFiles.toList();
+ driver.exceptions.listen(analysisServer.logExceptionResult);
+ driver.priorityFiles = analysisServer.priorityFiles.toList();
}
@override
- void pubspecChanged(String pubspecPath) {
- analysisServer.pubPackageService.fetchPackageVersionsViaPubOutdated(
- pubspecPath,
- pubspecWasModified: true);
+ void pubspecChanged(String path) {
+ analysisServer.pubPackageService
+ .fetchPackageVersionsViaPubOutdated(path, pubspecWasModified: true);
}
@override
- void pubspecRemoved(String pubspecPath) {
- analysisServer.pubPackageService.flushPackageCaches(pubspecPath);
+ void pubspecRemoved(String path) {
+ analysisServer.pubPackageService.flushPackageCaches(path);
}
@override
diff --git a/pkg/analysis_server/lib/src/channel/channel.dart b/pkg/analysis_server/lib/src/channel/channel.dart
index 37a6e86..3005cf3 100644
--- a/pkg/analysis_server/lib/src/channel/channel.dart
+++ b/pkg/analysis_server/lib/src/channel/channel.dart
@@ -61,7 +61,7 @@
/// Instances of the class [JsonStreamDecoder] convert JSON strings to values.
class JsonStreamDecoder extends Converter<String, Object?> {
@override
- Object? convert(String text) => json.decode(text);
+ Object? convert(String input) => json.decode(input);
@override
ChunkedConversionSink<String> startChunkedConversion(Sink<Object?> sink) =>
@@ -73,7 +73,7 @@
class NotificationConverter
extends Converter<Map<String, Object?>, Notification> {
@override
- Notification convert(Map json) => Notification.fromJson(json);
+ Notification convert(Map input) => Notification.fromJson(input);
@override
ChunkedConversionSink<Map<String, Object?>> startChunkedConversion(
@@ -84,7 +84,7 @@
/// Instances of the class [ResponseConverter] convert JSON maps to [Response]s.
class ResponseConverter extends Converter<Map<String, Object?>, Response?> {
@override
- Response? convert(Map<String, Object?> json) => Response.fromJson(json);
+ Response? convert(Map<String, Object?> input) => Response.fromJson(input);
@override
ChunkedConversionSink<Map<String, Object?>> startChunkedConversion(
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/abstract_refactor.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/abstract_refactor.dart
index c710951..414d320 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/commands/abstract_refactor.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/abstract_refactor.dart
@@ -139,7 +139,7 @@
@override
Future<ErrorOr<void>> handle(List<Object?>? arguments,
- ProgressReporter reporter, CancellationToken cancellationToken) async {
+ ProgressReporter progress, CancellationToken cancellationToken) async {
if (arguments == null ||
arguments.length != 6 ||
arguments[0] is! String || // kind
@@ -169,7 +169,7 @@
final options = arguments[5] as Map<String, Object?>?;
return execute(path, kind, offset, length, options, cancellationToken,
- reporter, docVersion);
+ progress, docVersion);
}
}
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/fix_all.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/fix_all.dart
index c0c9aa7..6d0bdba 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/commands/fix_all.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/fix_all.dart
@@ -19,7 +19,7 @@
@override
Future<ErrorOr<void>> handle(List<Object?>? arguments,
- ProgressReporter reporter, CancellationToken cancellationToken) async {
+ ProgressReporter progress, CancellationToken cancellationToken) async {
if (arguments == null || arguments.length != 1 || arguments[0] is! String) {
return ErrorOr.error(ResponseError(
code: ServerErrorCodes.InvalidCommandArguments,
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart
index 5e5bcf9..e7e89cc 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart
@@ -17,7 +17,7 @@
@override
Future<ErrorOr<void>> handle(List<Object?>? arguments,
- ProgressReporter reporter, CancellationToken cancellationToken) async {
+ ProgressReporter progress, CancellationToken cancellationToken) async {
if (arguments == null || arguments.length != 1 || arguments[0] is! String) {
return ErrorOr.error(ResponseError(
code: ServerErrorCodes.InvalidCommandArguments,
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/send_workspace_edit.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/send_workspace_edit.dart
index 0043490..a430214 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/commands/send_workspace_edit.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/send_workspace_edit.dart
@@ -23,7 +23,7 @@
@override
Future<ErrorOr<void>> handle(List<Object?>? arguments,
- ProgressReporter reporter, CancellationToken cancellationToken) async {
+ ProgressReporter progress, CancellationToken cancellationToken) async {
if (arguments == null ||
arguments.length != 1 ||
arguments[0] is! Map<String, Object?>) {
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/sort_members.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/sort_members.dart
index 7634396..b008673 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/commands/sort_members.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/sort_members.dart
@@ -18,7 +18,7 @@
@override
Future<ErrorOr<void>> handle(List<Object?>? arguments,
- ProgressReporter reporter, CancellationToken cancellationToken) async {
+ ProgressReporter progress, CancellationToken cancellationToken) async {
if (arguments == null || arguments.length != 1 || arguments[0] is! String) {
return ErrorOr.error(ResponseError(
code: ServerErrorCodes.InvalidCommandArguments,
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_diagnostic_server.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_diagnostic_server.dart
index 067b15e..d29f493 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_diagnostic_server.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_diagnostic_server.dart
@@ -9,6 +9,7 @@
class DiagnosticServerHandler
extends MessageHandler<void, DartDiagnosticServer> {
DiagnosticServerHandler(super.server);
+
@override
Method get handlesMessage => CustomMethods.diagnosticServer;
@@ -17,7 +18,7 @@
@override
Future<ErrorOr<DartDiagnosticServer>> handle(
- void _, MessageInfo message, CancellationToken token) async {
+ void params, MessageInfo message, CancellationToken token) async {
final diagnosticServer = server.diagnosticServer;
if (diagnosticServer == null) {
return error(ServerErrorCodes.FeatureDisabled,
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_reanalyze.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_reanalyze.dart
index 4dde991..b3355c2d 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_reanalyze.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_reanalyze.dart
@@ -8,6 +8,7 @@
class ReanalyzeHandler extends MessageHandler<void, void> {
ReanalyzeHandler(super.server);
+
@override
Method get handlesMessage => CustomMethods.reanalyze;
@@ -16,7 +17,7 @@
@override
Future<ErrorOr<void>> handle(
- void _, MessageInfo message, CancellationToken token) async {
+ void params, MessageInfo message, CancellationToken token) async {
server.reanalyze();
return success(null);
}
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion_resolve.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion_resolve.dart
index 195fe66..772eb6b 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion_resolve.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion_resolve.dart
@@ -33,18 +33,18 @@
@override
Future<ErrorOr<CompletionItem>> handle(
- CompletionItem item,
+ CompletionItem params,
MessageInfo message,
CancellationToken token,
) async {
- final resolutionInfo = item.data;
+ final resolutionInfo = params.data;
if (resolutionInfo is DartSuggestionSetCompletionItemResolutionInfo) {
- return resolveDartSuggestionSetCompletion(item, resolutionInfo, token);
+ return resolveDartSuggestionSetCompletion(params, resolutionInfo, token);
} else if (resolutionInfo is PubPackageCompletionItemResolutionInfo) {
- return resolvePubPackageCompletion(item, resolutionInfo, token);
+ return resolvePubPackageCompletion(params, resolutionInfo, token);
} else {
- return success(item);
+ return success(params);
}
}
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart
index ebf7cdc..6a2cf7e 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart
@@ -18,6 +18,7 @@
class ExecuteCommandHandler
extends MessageHandler<ExecuteCommandParams, Object?> {
final Map<String, CommandHandler> commandHandlers;
+
ExecuteCommandHandler(super.server)
: commandHandlers = {
Commands.sortMembers: SortMembersCommandHandler(server),
@@ -37,7 +38,7 @@
@override
Future<ErrorOr<Object?>> handle(ExecuteCommandParams params,
- MessageInfo message, CancellationToken cancellationToken) async {
+ MessageInfo message, CancellationToken token) async {
final handler = commandHandlers[params.command];
if (handler == null) {
return error(ServerErrorCodes.UnknownCommand,
@@ -50,6 +51,6 @@
: server.clientCapabilities?.workDoneProgress ?? false
? ProgressReporter.serverCreated(server)
: ProgressReporter.noop;
- return handler.handle(params.arguments, progress, cancellationToken);
+ return handler.handle(params.arguments, progress, token);
}
}
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_exit.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_exit.dart
index e351b48..b8b2dbf 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_exit.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_exit.dart
@@ -23,7 +23,7 @@
@override
Future<ErrorOr<void>> handle(
- void _, MessageInfo message, CancellationToken token) async {
+ void params, MessageInfo message, CancellationToken token) async {
// Set a flag that the server shutdown is being controlled here to ensure
// that the normal code that shuts down the server when the channel closes
// does not fire.
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_reject.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_reject.dart
index 105a9e2..14348e8 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_reject.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_reject.dart
@@ -12,6 +12,7 @@
final Method handlesMessage;
final ErrorCodes errorCode;
final String errorMessage;
+
RejectMessageHandler(
super.server, this.handlesMessage, this.errorCode, this.errorMessage);
@@ -20,7 +21,7 @@
@override
ErrorOr<void> handle(
- Object? _, MessageInfo message, CancellationToken token) {
+ Object? params, MessageInfo message, CancellationToken token) {
return error(errorCode, errorMessage, null);
}
}
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_shutdown.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_shutdown.dart
index 4655b69..49e30bb 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_shutdown.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_shutdown.dart
@@ -8,6 +8,7 @@
class ShutdownMessageHandler extends MessageHandler<void, void> {
ShutdownMessageHandler(super.server);
+
@override
Method get handlesMessage => Method.shutdown;
@@ -15,7 +16,8 @@
LspJsonHandler<void> get jsonHandler => NullJsonHandler;
@override
- ErrorOr<void> handle(void _, MessageInfo message, CancellationToken token) {
+ ErrorOr<void> handle(
+ void params, MessageInfo message, CancellationToken token) {
// Move to the Shutting Down state so we won't process any more
// requests and the Exit notification will know it was a clean shutdown.
server.messageHandler = ShuttingDownStateMessageHandler(server);
diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
index dbc2832..5f2e759 100644
--- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
+++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
@@ -936,34 +936,33 @@
}
@override
- void listenAnalysisDriver(analysis.AnalysisDriver analysisDriver) {
+ void listenAnalysisDriver(analysis.AnalysisDriver driver) {
// TODO(dantup): Is this required, or covered by
// addContextsToDeclarationsTracker? The original server does not appear to
// have an equivalent call.
- final analysisContext = analysisDriver.analysisContext;
+ final analysisContext = driver.analysisContext;
if (analysisContext != null) {
analysisServer.declarationsTracker?.addContext(analysisContext);
}
- analysisDriver.results.listen((result) {
+ driver.results.listen((result) {
if (result is FileResult) {
_handleFileResult(result);
}
});
- analysisDriver.exceptions.listen(analysisServer.logExceptionResult);
- analysisDriver.priorityFiles = analysisServer.priorityFiles.toList();
+ driver.exceptions.listen(analysisServer.logExceptionResult);
+ driver.priorityFiles = analysisServer.priorityFiles.toList();
}
@override
- void pubspecChanged(String pubspecPath) {
- analysisServer.pubPackageService.fetchPackageVersionsViaPubOutdated(
- pubspecPath,
- pubspecWasModified: true);
+ void pubspecChanged(String path) {
+ analysisServer.pubPackageService
+ .fetchPackageVersionsViaPubOutdated(path, pubspecWasModified: true);
}
@override
- void pubspecRemoved(String pubspecPath) {
- analysisServer.pubPackageService.flushPackageCaches(pubspecPath);
+ void pubspecRemoved(String path) {
+ analysisServer.pubPackageService.flushPackageCaches(path);
}
@override
diff --git a/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart b/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart
index 4b72c5e..e64fb09 100644
--- a/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart
+++ b/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart
@@ -1415,45 +1415,47 @@
static SignatureElementVisitor instance = SignatureElementVisitor();
@override
- StringBuffer visitCompilationUnitElement(CompilationUnitElement e) {
+ StringBuffer visitCompilationUnitElement(CompilationUnitElement element) {
return StringBuffer();
}
@override
- StringBuffer visitElement(Element e) {
- assert(e is! MultiplyInheritedExecutableElement);
- var enclosingElt = e.enclosingElement!;
+ StringBuffer visitElement(Element element) {
+ assert(element is! MultiplyInheritedExecutableElement);
+ var enclosingElt = element.enclosingElement!;
var buffer = enclosingElt.accept(this)!;
if (buffer.isNotEmpty) {
buffer.write('#');
}
- if (e is MethodElement && e.name == '-' && e.parameters.length == 1) {
+ if (element is MethodElement &&
+ element.name == '-' &&
+ element.parameters.length == 1) {
buffer.write('unary-');
- } else if (e is ConstructorElement) {
- buffer.write(_computeConstructorElementName(e));
+ } else if (element is ConstructorElement) {
+ buffer.write(_computeConstructorElementName(element));
} else {
- buffer.write(e.name);
+ buffer.write(element.name);
}
if (enclosingElt is ExecutableElement) {
buffer
..write('@')
- ..write(e.nameOffset - enclosingElt.nameOffset);
+ ..write(element.nameOffset - enclosingElt.nameOffset);
}
return buffer;
}
@override
- StringBuffer visitLibraryElement(LibraryElement e) {
- return StringBuffer('library:${e.displayName}');
+ StringBuffer visitLibraryElement(LibraryElement element) {
+ return StringBuffer('library:${element.displayName}');
}
@override
- StringBuffer visitTypeParameterElement(TypeParameterElement e) {
+ StringBuffer visitTypeParameterElement(TypeParameterElement element) {
// It is legal to have a named constructor with the same name as a type
// parameter. So we distinguish them by using '.' between the class (or
// typedef) name and the type parameter name.
- return e.enclosingElement!.accept(this)!
+ return element.enclosingElement!.accept(this)!
..write('.')
- ..write(e.name);
+ ..write(element.name);
}
}
diff --git a/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart b/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
index 3ed9228..91c2d41 100644
--- a/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
+++ b/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
@@ -465,12 +465,13 @@
firstValueType is LiteralType ? firstValueType.type : firstValueType;
final typeOfValues =
resolveTypeAlias(requiredValueType, resolveEnumClasses: true);
+ final namespaceName = namespace.name;
buffer
- ..writeln('class ${namespace.name} implements ToJsonable {')
+ ..writeln('class $namespaceName implements ToJsonable {')
..indent()
- ..writeIndentedln('const ${namespace.name}$constructorName(this._value);')
- ..writeIndentedln('const ${namespace.name}.fromJson(this._value);')
+ ..writeIndentedln('const $namespaceName$constructorName(this._value);')
+ ..writeIndentedln('const $namespaceName.fromJson(this._value);')
..writeln()
..writeIndentedln('final ${typeOfValues.dartTypeWithTypeArgs} _value;')
..writeln()
@@ -506,7 +507,7 @@
}
_writeDocCommentsAndAnnotations(buffer, cons);
buffer.writeIndentedln(
- 'static const ${_makeValidIdentifier(cons.name)} = ${namespace.name}$constructorName(${cons.valueAsLiteral});');
+ 'static const ${_makeValidIdentifier(cons.name)} = $namespaceName$constructorName(${cons.valueAsLiteral});');
});
buffer
..writeln()
@@ -517,7 +518,7 @@
..writeIndentedln('@override int get hashCode => _value.hashCode;')
..writeln()
..writeIndentedln(
- 'bool operator ==(Object o) => o is ${namespace.name} && o._value == _value;')
+ 'bool operator ==(Object other) => other is $namespaceName && other._value == _value;')
..outdent()
..writeln('}')
..writeln();
@@ -1012,9 +1013,11 @@
final int _indentSpaces = 2;
int get totalIndent => _indentLevel * _indentSpaces;
+
String get _indentString => ' ' * totalIndent;
void indent() => _indentLevel++;
+
void outdent() => _indentLevel--;
void writeIndented(Object obj) {
diff --git a/pkg/analysis_server/tool/lsp_spec/generate_all.dart b/pkg/analysis_server/tool/lsp_spec/generate_all.dart
index 92e5880..74f5644 100644
--- a/pkg/analysis_server/tool/lsp_spec/generate_all.dart
+++ b/pkg/analysis_server/tool/lsp_spec/generate_all.dart
@@ -417,7 +417,7 @@
// Generate an enum for all of the request methods to avoid strings.
types.add(extractMethodsEnum(spec));
- // Extract additional inline types that are specificed online in the `results`
+ // Extract additional inline types that are specified online in the `results`
// section of the doc.
types.addAll(extractResultsInlineTypes(spec));
return types;
@@ -472,7 +472,7 @@
final fullUri = baseUri.resolve(relativeUri);
final response = await http.get(fullUri);
if (response.statusCode != 200) {
- throw 'Faild to fetch $fullUri (${response.statusCode} ${response.reasonPhrase})';
+ throw 'Failed to fetch $fullUri (${response.statusCode} ${response.reasonPhrase})';
}
includeStrings[relativeUri] = response.body;
}