[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>
This commit is contained in:
@@ -12,7 +12,6 @@ analyzer:
|
||||
# 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
|
||||
|
||||
@@ -2778,7 +2778,8 @@ class CodeActionKind implements ToJsonable {
|
||||
@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 @@ class CodeActionTriggerKind implements ToJsonable {
|
||||
@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 @@ class CompletionItemKind implements ToJsonable {
|
||||
@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 @@ class CompletionItemTag implements ToJsonable {
|
||||
@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 @@ class CompletionTriggerKind implements ToJsonable {
|
||||
@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 @@ class DiagnosticSeverity implements ToJsonable {
|
||||
@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 @@ class DiagnosticTag implements ToJsonable {
|
||||
@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 @@ class DocumentDiagnosticReportKind implements ToJsonable {
|
||||
@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 @@ class DocumentHighlightKind implements ToJsonable {
|
||||
@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 @@ class ErrorCodes implements ToJsonable {
|
||||
@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 @@ class FailureHandlingKind implements ToJsonable {
|
||||
@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 @@ class FileChangeType implements ToJsonable {
|
||||
@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 @@ class FileOperationPatternKind implements ToJsonable {
|
||||
@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 @@ class FoldingRangeKind implements ToJsonable {
|
||||
@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 @@ class InlayHintKind implements ToJsonable {
|
||||
@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 @@ class InsertTextFormat implements ToJsonable {
|
||||
@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 @@ class InsertTextMode implements ToJsonable {
|
||||
@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 @@ class MarkupKind implements ToJsonable {
|
||||
@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 @@ class MessageType implements ToJsonable {
|
||||
@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 @@ class Method implements ToJsonable {
|
||||
@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 @@ class MonikerKind implements ToJsonable {
|
||||
@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 @@ class NotebookCellKind implements ToJsonable {
|
||||
@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 @@ class PositionEncodingKind implements ToJsonable {
|
||||
@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 @@ class PrepareSupportDefaultBehavior implements ToJsonable {
|
||||
@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 @@ class ResourceOperationKind implements ToJsonable {
|
||||
@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 @@ class SemanticTokenModifiers implements ToJsonable {
|
||||
@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 @@ class SemanticTokenTypes implements ToJsonable {
|
||||
@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 @@ class SignatureHelpTriggerKind implements ToJsonable {
|
||||
@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 @@ class SymbolKind implements ToJsonable {
|
||||
@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 @@ class SymbolTag implements ToJsonable {
|
||||
@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 @@ class TextDocumentSaveReason implements ToJsonable {
|
||||
@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 @@ class TextDocumentSyncKind implements ToJsonable {
|
||||
@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 @@ class TokenFormat implements ToJsonable {
|
||||
@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 @@ class UniquenessLevel implements ToJsonable {
|
||||
@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 @@ class WatchKind implements ToJsonable {
|
||||
@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.
|
||||
|
||||
@@ -70,6 +70,7 @@ class Either2<T1, T2> {
|
||||
const Either2.t1(T1 this._t1)
|
||||
: _t2 = null,
|
||||
_which = 1;
|
||||
|
||||
const Either2.t2(T2 this._t2)
|
||||
: _t1 = null,
|
||||
_which = 2;
|
||||
@@ -78,8 +79,10 @@ class Either2<T1, T2> {
|
||||
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 @@ class Either3<T1, T2, T3> {
|
||||
: _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 @@ class Either3<T1, T2, T3> {
|
||||
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 @@ class Either4<T1, T2, T3, T4> {
|
||||
_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 @@ class Either4<T1, T2, T3, T4> {
|
||||
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 Either4<T1, T2, T3, T4> {
|
||||
|
||||
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]
|
||||
|
||||
@@ -931,26 +931,25 @@ class ServerContextManagerCallbacks extends ContextManagerCallbacks {
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
@@ -61,7 +61,7 @@ abstract class ClientCommunicationChannel {
|
||||
/// 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 JsonStreamDecoder extends Converter<String, Object?> {
|
||||
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 @@ class NotificationConverter
|
||||
/// 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(
|
||||
|
||||
@@ -139,7 +139,7 @@ abstract class AbstractRefactorCommandHandler extends SimpleEditCommandHandler {
|
||||
|
||||
@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 @@ abstract class AbstractRefactorCommandHandler extends SimpleEditCommandHandler {
|
||||
final options = arguments[5] as Map<String, Object?>?;
|
||||
|
||||
return execute(path, kind, offset, length, options, cancellationToken,
|
||||
reporter, docVersion);
|
||||
progress, docVersion);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class FixAllCommandHandler extends SimpleEditCommandHandler {
|
||||
|
||||
@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,
|
||||
|
||||
@@ -17,7 +17,7 @@ class OrganizeImportsCommandHandler extends SimpleEditCommandHandler {
|
||||
|
||||
@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,
|
||||
|
||||
@@ -23,7 +23,7 @@ class SendWorkspaceEditCommandHandler extends SimpleEditCommandHandler {
|
||||
|
||||
@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?>) {
|
||||
|
||||
@@ -18,7 +18,7 @@ class SortMembersCommandHandler extends SimpleEditCommandHandler {
|
||||
|
||||
@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,
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:analysis_server/src/lsp/handlers/handlers.dart';
|
||||
class DiagnosticServerHandler
|
||||
extends MessageHandler<void, DartDiagnosticServer> {
|
||||
DiagnosticServerHandler(super.server);
|
||||
|
||||
@override
|
||||
Method get handlesMessage => CustomMethods.diagnosticServer;
|
||||
|
||||
@@ -17,7 +18,7 @@ class DiagnosticServerHandler
|
||||
|
||||
@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,
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:analysis_server/src/lsp/handlers/handlers.dart';
|
||||
|
||||
class ReanalyzeHandler extends MessageHandler<void, void> {
|
||||
ReanalyzeHandler(super.server);
|
||||
|
||||
@override
|
||||
Method get handlesMessage => CustomMethods.reanalyze;
|
||||
|
||||
@@ -16,7 +17,7 @@ class ReanalyzeHandler extends MessageHandler<void, void> {
|
||||
|
||||
@override
|
||||
Future<ErrorOr<void>> handle(
|
||||
void _, MessageInfo message, CancellationToken token) async {
|
||||
void params, MessageInfo message, CancellationToken token) async {
|
||||
server.reanalyze();
|
||||
return success(null);
|
||||
}
|
||||
|
||||
@@ -33,18 +33,18 @@ class CompletionResolveHandler
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import 'package:analysis_server/src/lsp/progress.dart';
|
||||
class ExecuteCommandHandler
|
||||
extends MessageHandler<ExecuteCommandParams, Object?> {
|
||||
final Map<String, CommandHandler> commandHandlers;
|
||||
|
||||
ExecuteCommandHandler(super.server)
|
||||
: commandHandlers = {
|
||||
Commands.sortMembers: SortMembersCommandHandler(server),
|
||||
@@ -37,7 +38,7 @@ class ExecuteCommandHandler
|
||||
|
||||
@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 @@ class ExecuteCommandHandler
|
||||
: server.clientCapabilities?.workDoneProgress ?? false
|
||||
? ProgressReporter.serverCreated(server)
|
||||
: ProgressReporter.noop;
|
||||
return handler.handle(params.arguments, progress, cancellationToken);
|
||||
return handler.handle(params.arguments, progress, token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class ExitMessageHandler extends MessageHandler<void, void> {
|
||||
|
||||
@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.
|
||||
|
||||
@@ -12,6 +12,7 @@ class RejectMessageHandler extends MessageHandler<Object?, void> {
|
||||
final Method handlesMessage;
|
||||
final ErrorCodes errorCode;
|
||||
final String errorMessage;
|
||||
|
||||
RejectMessageHandler(
|
||||
super.server, this.handlesMessage, this.errorCode, this.errorMessage);
|
||||
|
||||
@@ -20,7 +21,7 @@ class RejectMessageHandler extends MessageHandler<Object?, void> {
|
||||
|
||||
@override
|
||||
ErrorOr<void> handle(
|
||||
Object? _, MessageInfo message, CancellationToken token) {
|
||||
Object? params, MessageInfo message, CancellationToken token) {
|
||||
return error(errorCode, errorMessage, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:analysis_server/src/lsp/handlers/handlers.dart';
|
||||
|
||||
class ShutdownMessageHandler extends MessageHandler<void, void> {
|
||||
ShutdownMessageHandler(super.server);
|
||||
|
||||
@override
|
||||
Method get handlesMessage => Method.shutdown;
|
||||
|
||||
@@ -15,7 +16,8 @@ class ShutdownMessageHandler extends MessageHandler<void, void> {
|
||||
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);
|
||||
|
||||
@@ -936,34 +936,33 @@ class LspServerContextManagerCallbacks extends ContextManagerCallbacks {
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
@@ -1415,45 +1415,47 @@ class SignatureElementVisitor extends GeneralizingElementVisitor<StringBuffer> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -465,12 +465,13 @@ void _writeEnumClass(IndentableStringBuffer buffer, Namespace namespace) {
|
||||
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 @@ void _writeEnumClass(IndentableStringBuffer buffer, Namespace namespace) {
|
||||
}
|
||||
_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 @@ void _writeEnumClass(IndentableStringBuffer buffer, Namespace namespace) {
|
||||
..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 @@ class IndentableStringBuffer extends StringBuffer {
|
||||
final int _indentSpaces = 2;
|
||||
|
||||
int get totalIndent => _indentLevel * _indentSpaces;
|
||||
|
||||
String get _indentString => ' ' * totalIndent;
|
||||
|
||||
void indent() => _indentLevel++;
|
||||
|
||||
void outdent() => _indentLevel--;
|
||||
|
||||
void writeIndented(Object obj) {
|
||||
|
||||
@@ -417,7 +417,7 @@ Future<List<AstNode>> getSpecClasses(ArgResults args) async {
|
||||
// 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 @@ Future<String> _fetchIncludes(String spec, Uri baseUri) async {
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user