CQ. Enable avoid_redundant_argument_values in analysis_server/
Change-Id: If9c09f81bdbac890553573a8491ca27cb4f22dd7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353805 Reviewed-by: Phil Quitslund <pquitslund@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
committed by
Commit Queue
parent
10306be9d8
commit
8968e5500a
@@ -29,6 +29,7 @@ analyzer:
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- avoid_redundant_argument_values
|
||||
- flutter_style_todos
|
||||
- library_annotations
|
||||
- prefer_single_quotes
|
||||
|
||||
@@ -273,12 +273,12 @@ extension on StringBuffer {
|
||||
}
|
||||
|
||||
void writePadLeft(String text, int keyLength) {
|
||||
write(text.padLeft(keyLength, ' '));
|
||||
write(text.padLeft(keyLength));
|
||||
write(' ');
|
||||
}
|
||||
|
||||
void writePadRight(String text, int keyLength) {
|
||||
write(text.padRight(keyLength, ' '));
|
||||
write(text.padRight(keyLength));
|
||||
write(' ');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ abstract class AbstractCmdLineBenchmark extends Benchmark {
|
||||
'$dartSdkPath/bin/dart',
|
||||
['analyze', '--suppress-analytics', ...analyzeThis],
|
||||
cwd: workingDir,
|
||||
failOnError: true,
|
||||
verbose: false,
|
||||
);
|
||||
stopwatchNoCache.stop();
|
||||
@@ -49,7 +48,6 @@ abstract class AbstractCmdLineBenchmark extends Benchmark {
|
||||
'$dartSdkPath/bin/dart',
|
||||
['analyze', '--suppress-analytics', ...analyzeThis],
|
||||
cwd: workingDir,
|
||||
failOnError: true,
|
||||
verbose: false,
|
||||
);
|
||||
stopwatchWithCache.stop();
|
||||
@@ -73,7 +71,6 @@ abstract class AbstractCmdLineBenchmark extends Benchmark {
|
||||
...analyzeThis
|
||||
],
|
||||
cwd: workingDir,
|
||||
failOnError: true,
|
||||
verbose: false,
|
||||
stdout: stdout,
|
||||
);
|
||||
@@ -91,7 +88,6 @@ abstract class AbstractCmdLineBenchmark extends Benchmark {
|
||||
...analyzeThis
|
||||
],
|
||||
cwd: workingDir,
|
||||
failOnError: true,
|
||||
verbose: false,
|
||||
stdout: stdout,
|
||||
);
|
||||
|
||||
@@ -930,7 +930,7 @@ class AnalysisGetLibraryDependenciesParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'analysis.getLibraryDependencies', null);
|
||||
return Request(id, 'analysis.getLibraryDependencies');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -2457,7 +2457,7 @@ class AnalysisReanalyzeParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'analysis.reanalyze', null);
|
||||
return Request(id, 'analysis.reanalyze');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -2476,7 +2476,7 @@ class AnalysisReanalyzeResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -2720,7 +2720,7 @@ class AnalysisSetAnalysisRootsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -2808,7 +2808,7 @@ class AnalysisSetGeneralSubscriptionsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -2895,7 +2895,7 @@ class AnalysisSetPriorityFilesResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -2996,7 +2996,7 @@ class AnalysisSetSubscriptionsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -3279,7 +3279,7 @@ class AnalysisUpdateOptionsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -3359,7 +3359,7 @@ class AnalyticsEnableResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -3378,7 +3378,7 @@ class AnalyticsIsEnabledParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'analytics.isEnabled', null);
|
||||
return Request(id, 'analytics.isEnabled');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -3521,7 +3521,7 @@ class AnalyticsSendEventResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -3615,7 +3615,7 @@ class AnalyticsSendTimingResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -4615,7 +4615,7 @@ class CompletionRegisterLibraryPathsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -4796,7 +4796,7 @@ class DiagnosticGetDiagnosticsParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'diagnostic.getDiagnostics', null);
|
||||
return Request(id, 'diagnostic.getDiagnostics');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -4885,7 +4885,7 @@ class DiagnosticGetServerPortParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'diagnostic.getServerPort', null);
|
||||
return Request(id, 'diagnostic.getServerPort');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -6978,7 +6978,7 @@ class EditListPostfixCompletionTemplatesParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'edit.listPostfixCompletionTemplates', null);
|
||||
return Request(id, 'edit.listPostfixCompletionTemplates');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -7852,7 +7852,7 @@ class ExecutionDeleteContextResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -8540,7 +8540,7 @@ class ExecutionSetSubscriptionsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -10210,7 +10210,7 @@ class FlutterSetSubscriptionsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -14920,7 +14920,7 @@ class ServerCancelRequestResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -15106,7 +15106,7 @@ class ServerGetVersionParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'server.getVersion', null);
|
||||
return Request(id, 'server.getVersion');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -15479,7 +15479,7 @@ class ServerOpenUrlRequestResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -15651,7 +15651,7 @@ class ServerSetClientCapabilitiesResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -15738,7 +15738,7 @@ class ServerSetSubscriptionsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -15922,7 +15922,7 @@ class ServerShutdownParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'server.shutdown', null);
|
||||
return Request(id, 'server.shutdown');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -15941,7 +15941,7 @@ class ServerShutdownResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -85,7 +85,6 @@ class CiderCompletionComputer {
|
||||
enclosingNode: enclosingNode,
|
||||
offset: offset,
|
||||
unit: resolvedUnit.parsedUnit,
|
||||
dartdocDirectiveInfo: null,
|
||||
);
|
||||
|
||||
var suggestions = await performance.runAsync(
|
||||
|
||||
@@ -22,7 +22,6 @@ class FlutterOutlineComputer {
|
||||
protocol.FlutterOutline compute() {
|
||||
var dartOutline = DartUnitOutlineComputer(
|
||||
resolvedUnit,
|
||||
withBasicFlutter: false,
|
||||
).compute();
|
||||
|
||||
// Convert Dart outlines into Flutter outlines.
|
||||
|
||||
@@ -20,7 +20,7 @@ import 'package:dart_style/dart_style.dart';
|
||||
/// Return a formatted string if successful, throws a [FormatterException] if
|
||||
/// unable to format. Takes a string as input.
|
||||
String format(String content) {
|
||||
final code = SourceCode(content, uri: null, isCompilationUnit: true);
|
||||
final code = SourceCode(content);
|
||||
var formatter = DartFormatter();
|
||||
SourceCode formattedResult;
|
||||
formattedResult = formatter.formatSource(code);
|
||||
|
||||
@@ -44,11 +44,11 @@ class EditFormatHandler extends LegacyHandler {
|
||||
length = null;
|
||||
}
|
||||
|
||||
var code = SourceCode(unformattedCode,
|
||||
uri: null,
|
||||
isCompilationUnit: true,
|
||||
selectionStart: start,
|
||||
selectionLength: length);
|
||||
var code = SourceCode(
|
||||
unformattedCode,
|
||||
selectionStart: start,
|
||||
selectionLength: length,
|
||||
);
|
||||
var formatter = DartFormatter(pageWidth: params.lineLength);
|
||||
SourceCode formattedResult;
|
||||
try {
|
||||
|
||||
@@ -29,7 +29,7 @@ class EditFormatIfEnabledHandler extends LegacyHandler {
|
||||
// TODO(brianwilkerson): Move this to a superclass when `edit.format` is
|
||||
// implemented by a handler class so the code can be shared.
|
||||
var originalContent = file.readAsStringSync();
|
||||
var code = SourceCode(originalContent, uri: null, isCompilationUnit: true);
|
||||
var code = SourceCode(originalContent);
|
||||
|
||||
var formatter = DartFormatter();
|
||||
var formatResult = formatter.formatSource(code);
|
||||
|
||||
@@ -608,8 +608,7 @@ class CompletionHandler
|
||||
// Perform fuzzy matching based on the identifier in front of the caret to
|
||||
// reduce the size of the payload.
|
||||
final fuzzyPattern = suggestions.targetPrefix;
|
||||
final fuzzyMatcher =
|
||||
FuzzyMatcher(fuzzyPattern, matchStyle: MatchStyle.TEXT);
|
||||
final fuzzyMatcher = FuzzyMatcher(fuzzyPattern);
|
||||
|
||||
final completionItems = suggestions.suggestions
|
||||
.where((item) =>
|
||||
@@ -945,8 +944,7 @@ class _FuzzyScoreHelper {
|
||||
|
||||
final FuzzyMatcher _matcher;
|
||||
|
||||
_FuzzyScoreHelper(this.prefix)
|
||||
: _matcher = FuzzyMatcher(prefix, matchStyle: MatchStyle.TEXT);
|
||||
_FuzzyScoreHelper(this.prefix) : _matcher = FuzzyMatcher(prefix);
|
||||
|
||||
bool completionItemMatches(CompletionItem item) =>
|
||||
stringMatches(item.filterText ?? item.label);
|
||||
|
||||
@@ -165,7 +165,6 @@ class TextDocumentRegistrations extends FeatureRegistration
|
||||
change: TextDocumentSyncKind.Incremental,
|
||||
willSave: false,
|
||||
willSaveWaitUntil: false,
|
||||
save: null,
|
||||
));
|
||||
|
||||
@override
|
||||
|
||||
@@ -111,11 +111,11 @@ class WorkspaceSymbolHandler extends SharedMessageHandler<WorkspaceSymbolParams,
|
||||
final nameSuffix = hasParameters ? (parameters == '()' ? '()' : '(…)') : '';
|
||||
|
||||
return SymbolInformation(
|
||||
name: '${declaration.name}$nameSuffix',
|
||||
kind: kind,
|
||||
deprecated: null, // We don't have easy access to isDeprecated here.
|
||||
location: location,
|
||||
containerName: declaration.className ?? declaration.mixinName);
|
||||
name: '${declaration.name}$nameSuffix',
|
||||
kind: kind,
|
||||
location: location,
|
||||
containerName: declaration.className ?? declaration.mixinName,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ mixin Handler<T> {
|
||||
// TODO(dantup): Merge this into HandlerHelperMixin by converting to methods
|
||||
// so T can be inferred.
|
||||
final fileModifiedError = error<T>(ErrorCodes.ContentModified,
|
||||
'Document was modified before operation completed', null);
|
||||
'Document was modified before operation completed');
|
||||
|
||||
final serverNotInitializedError = error<T>(ErrorCodes.ServerNotInitialized,
|
||||
'Request not valid before server is initialized');
|
||||
|
||||
@@ -81,8 +81,7 @@ ErrorOr<List<TextEdit>?> generateEditsForFormatting(
|
||||
}) {
|
||||
final unformattedSource = result.content;
|
||||
|
||||
final code =
|
||||
SourceCode(unformattedSource, uri: null, isCompilationUnit: true);
|
||||
final code = SourceCode(unformattedSource);
|
||||
SourceCode formattedResult;
|
||||
try {
|
||||
// Create a new formatter on every request because it may contain state that
|
||||
|
||||
@@ -230,7 +230,7 @@ abstract class PluginInfo {
|
||||
if (currentSession == null) {
|
||||
if (_exception != null) {
|
||||
// Plugin crashed, nothing to do.
|
||||
return Future<void>.value(null);
|
||||
return Future<void>.value();
|
||||
}
|
||||
throw StateError('Cannot stop a plugin that is not running.');
|
||||
}
|
||||
|
||||
@@ -687,8 +687,7 @@ class Driver implements ServerStarter {
|
||||
print(telemetry.analyticsNotice);
|
||||
}
|
||||
print('');
|
||||
print(telemetry.createAnalyticsStatusMessage(analytics.enabled,
|
||||
command: ANALYTICS_FLAG));
|
||||
print(telemetry.createAnalyticsStatusMessage(analytics.enabled));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -776,7 +775,6 @@ class Driver implements ServerStarter {
|
||||
// This option is hidden but still accepted; it's effectively translated to
|
||||
// the 'protocol' option above.
|
||||
parser.addFlag(USE_LSP,
|
||||
defaultsTo: false,
|
||||
negatable: false,
|
||||
help: 'Whether to use the Language Server Protocol (LSP).',
|
||||
hide: true);
|
||||
@@ -824,19 +822,17 @@ class Driver implements ServerStarter {
|
||||
// exception-nullifying runZoned() calls.
|
||||
help: 'disable analyzer exception capture for interactive debugging '
|
||||
'of the server',
|
||||
defaultsTo: false,
|
||||
hide: true);
|
||||
parser.addFlag(DISABLE_SERVER_FEATURE_COMPLETION,
|
||||
help: 'disable all completion features', defaultsTo: false, hide: true);
|
||||
help: 'disable all completion features', hide: true);
|
||||
parser.addFlag(DISABLE_SERVER_FEATURE_SEARCH,
|
||||
help: 'disable all search features', defaultsTo: false, hide: true);
|
||||
help: 'disable all search features', hide: true);
|
||||
parser.addFlag(DISABLE_STATUS_NOTIFICATION_DEBOUNCING,
|
||||
negatable: false,
|
||||
help: 'Suppress debouncing of status notifications.',
|
||||
hide: true);
|
||||
parser.addFlag(INTERNAL_PRINT_TO_CONSOLE,
|
||||
help: 'enable sending `print` output to the console',
|
||||
defaultsTo: false,
|
||||
negatable: false,
|
||||
hide: true);
|
||||
parser.addOption(
|
||||
|
||||
+3
-8
@@ -2,8 +2,6 @@
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analysis_server/src/protocol_server.dart'
|
||||
show CompletionSuggestionKind;
|
||||
import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
@@ -49,8 +47,7 @@ class LibraryMemberContributor extends DartCompletionContributor {
|
||||
for (var constructor in element.constructors) {
|
||||
if (!constructor.isPrivate) {
|
||||
if (!element.isAbstract || constructor.isFactory) {
|
||||
builder.suggestConstructor(constructor,
|
||||
kind: CompletionSuggestionKind.INVOCATION);
|
||||
builder.suggestConstructor(constructor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,13 +56,11 @@ class LibraryMemberContributor extends DartCompletionContributor {
|
||||
if (element is InterfaceElement ||
|
||||
element is ExtensionElement ||
|
||||
element is TypeAliasElement) {
|
||||
builder.suggestElement(element,
|
||||
kind: CompletionSuggestionKind.INVOCATION);
|
||||
builder.suggestElement(element);
|
||||
} else if (!typesOnly &&
|
||||
(element is FunctionElement ||
|
||||
element is PropertyAccessorElement)) {
|
||||
builder.suggestElement(element,
|
||||
kind: CompletionSuggestionKind.INVOCATION);
|
||||
builder.suggestElement(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -586,10 +586,7 @@ class SuggestionBuilder {
|
||||
void suggestFunctionCall() {
|
||||
final element = protocol.Element(protocol.ElementKind.METHOD,
|
||||
FunctionElement.CALL_METHOD_NAME, protocol.Element.makeFlags(),
|
||||
location: null,
|
||||
typeParameters: null,
|
||||
parameters: '()',
|
||||
returnType: 'void');
|
||||
parameters: '()', returnType: 'void');
|
||||
_addSuggestion(
|
||||
CompletionSuggestion(
|
||||
CompletionSuggestionKind.INVOCATION,
|
||||
|
||||
@@ -149,7 +149,7 @@ class DartPostfixCompletion {
|
||||
|
||||
static Future<PostfixCompletion?> expandTry(
|
||||
PostfixCompletionProcessor processor, PostfixCompletionKind kind) async {
|
||||
return processor.expandTry(kind, processor.findStatement, withOn: false);
|
||||
return processor.expandTry(kind, processor.findStatement);
|
||||
}
|
||||
|
||||
static Future<PostfixCompletion?> expandTryon(
|
||||
|
||||
-17
@@ -85,8 +85,6 @@ class CodeFragmentParser {
|
||||
length: token.length,
|
||||
errorCode: TransformSetErrorCode.wrongToken,
|
||||
arguments: ['.', token.kind.displayName],
|
||||
contextMessages: null,
|
||||
data: null,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
@@ -117,8 +115,6 @@ class CodeFragmentParser {
|
||||
length: token.length,
|
||||
errorCode: TransformSetErrorCode.unexpectedToken,
|
||||
arguments: [token.kind.displayName],
|
||||
contextMessages: null,
|
||||
data: null,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
@@ -157,8 +153,6 @@ class CodeFragmentParser {
|
||||
length: length,
|
||||
errorCode: TransformSetErrorCode.missingToken,
|
||||
arguments: [validKindsDisplayString()],
|
||||
contextMessages: null,
|
||||
data: null,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
@@ -168,8 +162,6 @@ class CodeFragmentParser {
|
||||
length: token.length,
|
||||
errorCode: TransformSetErrorCode.wrongToken,
|
||||
arguments: [validKindsDisplayString(), token.kind.displayName],
|
||||
contextMessages: null,
|
||||
data: null,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
@@ -243,8 +235,6 @@ class CodeFragmentParser {
|
||||
length: token.length,
|
||||
errorCode: TransformSetErrorCode.unknownAccessor,
|
||||
arguments: [identifier],
|
||||
contextMessages: null,
|
||||
data: null,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
@@ -325,8 +315,6 @@ class CodeFragmentParser {
|
||||
length: token.length,
|
||||
errorCode: TransformSetErrorCode.undefinedVariable,
|
||||
arguments: [variableName],
|
||||
contextMessages: null,
|
||||
data: null,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
@@ -357,9 +345,6 @@ class CodeFragmentParser {
|
||||
offset: offset,
|
||||
length: length,
|
||||
errorCode: TransformSetErrorCode.expectedPrimary,
|
||||
arguments: null,
|
||||
contextMessages: null,
|
||||
data: null,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
@@ -495,8 +480,6 @@ class _CodeFragmentScanner {
|
||||
length: 1,
|
||||
errorCode: TransformSetErrorCode.invalidCharacter,
|
||||
arguments: [content.substring(offset, offset + 1)],
|
||||
contextMessages: null,
|
||||
data: null,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-11
@@ -194,9 +194,6 @@ class TransformSetParser {
|
||||
offset: templateOffset + variableStart,
|
||||
length: 2,
|
||||
errorCode: TransformSetErrorCode.missingTemplateEnd,
|
||||
arguments: null,
|
||||
contextMessages: null,
|
||||
data: null,
|
||||
);
|
||||
// Ignore the invalid component, treating it as if it extended to the
|
||||
// end of the template.
|
||||
@@ -210,8 +207,6 @@ class TransformSetParser {
|
||||
length: name.length,
|
||||
errorCode: TransformSetErrorCode.undefinedVariable,
|
||||
arguments: [name],
|
||||
contextMessages: null,
|
||||
data: null,
|
||||
);
|
||||
// Ignore the invalid component.
|
||||
} else {
|
||||
@@ -266,8 +261,6 @@ class TransformSetParser {
|
||||
length: length,
|
||||
errorCode: TransformSetErrorCode.yamlSyntaxError,
|
||||
arguments: [e.message],
|
||||
contextMessages: null,
|
||||
data: null,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
@@ -284,8 +277,6 @@ class TransformSetParser {
|
||||
length: span.length,
|
||||
errorCode: code,
|
||||
arguments: arguments,
|
||||
contextMessages: null,
|
||||
data: null,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -596,8 +587,7 @@ class TransformSetParser {
|
||||
}
|
||||
var argumentValueNode = node.valueAt(_argumentValueKey);
|
||||
var argumentValue = _translateCodeTemplate(argumentValueNode,
|
||||
ErrorContext(key: _argumentValueKey, parentNode: node),
|
||||
canBeConditionallyRequired: false);
|
||||
ErrorContext(key: _argumentValueKey, parentNode: node));
|
||||
(_parameterModifications ??= []).add(
|
||||
ChangeParameterType(
|
||||
reference: reference,
|
||||
|
||||
@@ -473,8 +473,7 @@ class CollectReportPage extends DiagnosticPage {
|
||||
}
|
||||
|
||||
if (startedServiceProtocol) {
|
||||
await developer.Service.controlWebServer(
|
||||
enable: false, silenceOutput: true);
|
||||
await developer.Service.controlWebServer(silenceOutput: true);
|
||||
}
|
||||
|
||||
const JsonEncoder encoder = JsonEncoder.withIndent(' ');
|
||||
|
||||
@@ -63,7 +63,7 @@ class _PosixProcessProfiler extends ProcessProfiler {
|
||||
Process.run('ps', ['-o', '%cpu=,rss=', processId.toString()]);
|
||||
return future.then((ProcessResult result) {
|
||||
if (result.exitCode != 0) {
|
||||
return Future.value(null);
|
||||
return Future.value();
|
||||
}
|
||||
|
||||
return Future.value(_parse(result.stdout as String));
|
||||
@@ -95,7 +95,7 @@ class _WindowsProcessProfiler extends ProcessProfiler {
|
||||
'tasklist', ['/FI', 'PID eq $processId', '/NH', '/FO', 'csv']);
|
||||
|
||||
if (result.exitCode != 0) {
|
||||
return Future.value(null);
|
||||
return Future.value();
|
||||
}
|
||||
|
||||
return Future.value(_parse(result.stdout as String));
|
||||
|
||||
@@ -74,7 +74,7 @@ class SourceChangeMerger {
|
||||
for (final edit in edits) {
|
||||
debugBuffer.writeln(' $edit');
|
||||
}
|
||||
debugBuffer.writeln('');
|
||||
debugBuffer.writeln();
|
||||
}
|
||||
|
||||
/// Merges (in-place) any sequential edits that are overlapping or touching.
|
||||
|
||||
@@ -10,7 +10,6 @@ void configureMemoryUsageTracking(
|
||||
UsageCallback callback,
|
||||
) {
|
||||
final config = UsageTrackingConfig(
|
||||
interval: const Duration(seconds: 1),
|
||||
usageEventsConfig: UsageEventsConfig(
|
||||
callback,
|
||||
deltaMb: 512,
|
||||
@@ -36,7 +35,7 @@ AutoSnapshottingConfig? parseAutoSnapshottingConfig(List<String> args) {
|
||||
arg = arg.replaceAll('-', '=');
|
||||
arg = '--$arg';
|
||||
|
||||
var parser = ArgParser()..addMultiOption(argName, splitCommas: true);
|
||||
var parser = ArgParser()..addMultiOption(argName);
|
||||
final parsedArgs = parser.parse([arg]);
|
||||
assert(parsedArgs.options.contains(argName));
|
||||
final values = parsedArgs[argName] as List<String>;
|
||||
|
||||
@@ -347,7 +347,7 @@ part of 'test.dart';
|
||||
part 'a.dart';
|
||||
''');
|
||||
await waitForTasksFinished();
|
||||
await _getNavigation(offset: 8, length: 0);
|
||||
await _getNavigation(offset: 8);
|
||||
expect(regions, hasLength(1));
|
||||
assertHasRegionString("'a.dart'");
|
||||
expect(testTargets, hasLength(1));
|
||||
@@ -367,7 +367,7 @@ part 'test.dart';
|
||||
part of foo;
|
||||
''');
|
||||
await waitForTasksFinished();
|
||||
await _getNavigation(offset: 10, length: 0);
|
||||
await _getNavigation(offset: 10);
|
||||
expect(regions, hasLength(1));
|
||||
assertHasRegionString('foo');
|
||||
expect(testTargets, hasLength(1));
|
||||
@@ -386,7 +386,7 @@ part 'test.dart';
|
||||
part of 'a.dart';
|
||||
''');
|
||||
await waitForTasksFinished();
|
||||
await _getNavigation(offset: 11, length: 0);
|
||||
await _getNavigation(offset: 11);
|
||||
expect(regions, hasLength(1));
|
||||
assertHasRegionString("'a.dart'");
|
||||
expect(testTargets, hasLength(1));
|
||||
|
||||
@@ -446,7 +446,7 @@ suggestions
|
||||
await _configureWithWorkspaceRoot();
|
||||
|
||||
// Empty budget, so no not yet imported libraries.
|
||||
server.completionState.budgetDuration = const Duration(milliseconds: 0);
|
||||
server.completionState.budgetDuration = const Duration();
|
||||
|
||||
var response = await _getTestCodeSuggestions('''
|
||||
void f() {
|
||||
|
||||
@@ -243,7 +243,7 @@ class ExtractLocalVariableTest extends _AbstractGetRefactoring_Test {
|
||||
var kind = RefactoringKind.EXTRACT_LOCAL_VARIABLE;
|
||||
var options =
|
||||
name != null ? ExtractLocalVariableOptions(name, extractAll) : null;
|
||||
return sendRequest(kind, offset, length, options, false);
|
||||
return sendRequest(kind, offset, length, options);
|
||||
}
|
||||
|
||||
Future<Response> sendStringRequest(
|
||||
@@ -826,7 +826,7 @@ int? res(int b) {
|
||||
|
||||
Future<Response> _sendExtractRequest() {
|
||||
var kind = RefactoringKind.EXTRACT_METHOD;
|
||||
return sendRequest(kind, offset, length, options, false);
|
||||
return sendRequest(kind, offset, length, options);
|
||||
}
|
||||
|
||||
void _setOffsetLengthForStartEnd() {
|
||||
|
||||
@@ -112,7 +112,6 @@ final x = foo();
|
||||
// Container of the call
|
||||
from: CallHierarchyItem(
|
||||
name: 'other.dart',
|
||||
detail: null,
|
||||
kind: SymbolKind.File,
|
||||
uri: otherFileUri,
|
||||
range: entireRange(otherCode.code),
|
||||
|
||||
@@ -57,8 +57,6 @@ class FoldingTest extends AbstractLspAnalysisServerTest {
|
||||
startCharacter: lineFoldingOnly ? null : range.start.character,
|
||||
endLine: range.end.line,
|
||||
endCharacter: lineFoldingOnly ? null : range.end.character,
|
||||
// We (and VS Code) don't currently support this.
|
||||
collapsedText: null,
|
||||
kind: entry.value,
|
||||
);
|
||||
}).toSet();
|
||||
|
||||
@@ -460,7 +460,7 @@ class PubPackageServiceTest extends AbstractLspAnalysisServerTest {
|
||||
final maxHours = PackageDetailsCache.maxCacheAge.inHours;
|
||||
|
||||
// Very old cache should have no time remaining.
|
||||
expectHoursRemaining(DateTime(2020, 12, 1), 0);
|
||||
expectHoursRemaining(DateTime(2020, 12), 0);
|
||||
|
||||
// Cache from 1 hour ago should max-1 hours remaining.
|
||||
expectHoursRemaining(DateTime.now().add(Duration(hours: -1)), maxHours - 1);
|
||||
|
||||
@@ -72,7 +72,6 @@ void f() {
|
||||
await _checkRanges(
|
||||
mainContent,
|
||||
otherContent: otherContent,
|
||||
includeDeclarations: false,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -227,7 +226,7 @@ int f(Object o) {
|
||||
}
|
||||
''';
|
||||
|
||||
await _checkRanges(content, includeDeclarations: false);
|
||||
await _checkRanges(content);
|
||||
}
|
||||
|
||||
Future<void> test_singleFile_withoutDeclaration() async {
|
||||
@@ -237,7 +236,7 @@ f^oo() {
|
||||
}
|
||||
''';
|
||||
|
||||
await _checkRanges(content, includeDeclarations: false);
|
||||
await _checkRanges(content);
|
||||
}
|
||||
|
||||
Future<void> test_type() async {
|
||||
|
||||
@@ -287,7 +287,6 @@ foo(String s, int i) {
|
||||
ParameterInformation(label: 'String s'),
|
||||
ParameterInformation(label: 'int i'),
|
||||
],
|
||||
expectedFormat: MarkupKind.Markdown,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -363,7 +362,6 @@ foo(String s, int i) {
|
||||
ParameterInformation(label: 'String s'),
|
||||
ParameterInformation(label: 'int i'),
|
||||
],
|
||||
expectedFormat: MarkupKind.Markdown,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -387,7 +385,6 @@ foo(String s, int i) {
|
||||
ParameterInformation(label: 'String s'),
|
||||
ParameterInformation(label: 'int i'),
|
||||
],
|
||||
expectedFormat: MarkupKind.Markdown,
|
||||
context: SignatureHelpContext(
|
||||
triggerKind: SignatureHelpTriggerKind.Invoked,
|
||||
isRetrigger: false,
|
||||
@@ -631,7 +628,6 @@ foo(String s, int i) {
|
||||
ParameterInformation(label: 'String s'),
|
||||
ParameterInformation(label: 'int i'),
|
||||
],
|
||||
expectedFormat: MarkupKind.Markdown,
|
||||
context: SignatureHelpContext(
|
||||
triggerKind: SignatureHelpTriggerKind.Invoked,
|
||||
isRetrigger: false,
|
||||
|
||||
@@ -108,9 +108,7 @@ class A {
|
||||
''');
|
||||
var excluded = <String>{};
|
||||
var expr = findNode.instanceCreation('Map(');
|
||||
expect(
|
||||
getVariableNameSuggestionsForExpression(null, expr, excluded,
|
||||
isMethod: false),
|
||||
expect(getVariableNameSuggestionsForExpression(null, expr, excluded),
|
||||
unorderedEquals(['map']));
|
||||
expect(
|
||||
getVariableNameSuggestionsForExpression(null, expr, excluded,
|
||||
|
||||
@@ -50,9 +50,7 @@ abstract class PubspecFixTest with ResourceProviderMixin {
|
||||
final errors = pubspec_validator.validatePubspec(
|
||||
source: pubspecFile.createSource(),
|
||||
contents: node,
|
||||
provider: resourceProvider,
|
||||
// TODO(sigurdm): Can/should we pass analysis-options here?
|
||||
analysisOptions: null);
|
||||
provider: resourceProvider);
|
||||
expect(errors.length, 1);
|
||||
error = errors[0];
|
||||
}
|
||||
|
||||
@@ -136,10 +136,7 @@ class Driver {
|
||||
ArgParser _createArgParser() {
|
||||
var parser = ArgParser();
|
||||
parser.addFlag(HELP_FLAG_NAME,
|
||||
abbr: 'h',
|
||||
help: 'Print usage information',
|
||||
defaultsTo: false,
|
||||
negatable: false);
|
||||
abbr: 'h', help: 'Print usage information', negatable: false);
|
||||
parser.addOption(OVERLAY_STYLE_OPTION_NAME,
|
||||
help:
|
||||
'The style of interaction to use for analysis.updateContent requests',
|
||||
@@ -152,7 +149,6 @@ class Driver {
|
||||
parser.addFlag(VERBOSE_FLAG_NAME,
|
||||
abbr: 'v',
|
||||
help: 'Produce verbose output for debugging',
|
||||
defaultsTo: false,
|
||||
negatable: false);
|
||||
return parser;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ void main() {
|
||||
|
||||
test('clear', () {
|
||||
var counter = Counter('name');
|
||||
counter.count('bucket-1', 1);
|
||||
counter.count('bucket-1');
|
||||
expect(counter.map, isNotEmpty);
|
||||
expect(counter.totalCount, equals(1));
|
||||
|
||||
@@ -62,9 +62,9 @@ void main() {
|
||||
|
||||
test('getCountOf', () {
|
||||
var counter = Counter('name');
|
||||
counter.count('bucket-1', 1);
|
||||
counter.count('bucket-2', 1);
|
||||
counter.count('bucket-2', 1);
|
||||
counter.count('bucket-1');
|
||||
counter.count('bucket-2');
|
||||
counter.count('bucket-2');
|
||||
counter.count('bucket-3', 3);
|
||||
expect(counter.name, equals('name'));
|
||||
expect(counter.map, isNotEmpty);
|
||||
|
||||
@@ -1456,7 +1456,7 @@ class CodeShapeMetricsComputer {
|
||||
|
||||
/// Write the child data to the [sink].
|
||||
void _writeChildData(StringSink sink) {
|
||||
sink.writeln('');
|
||||
sink.writeln();
|
||||
sink.writeln('Child data');
|
||||
|
||||
// TODO(brianwilkerson): This misses all node kinds for which zero instances
|
||||
|
||||
@@ -172,25 +172,21 @@ ArgParser createArgParser() {
|
||||
'completion will be requested this many characters in from the '
|
||||
'start of the token being completed.')
|
||||
..addFlag(CompletionMetricsQualityOptions.PRINT_MISSED_COMPLETION_DETAILS,
|
||||
defaultsTo: false,
|
||||
help:
|
||||
'Print detailed information every time a completion request fails '
|
||||
'to produce a suggestions matching the expected suggestion.',
|
||||
negatable: false)
|
||||
..addFlag(CompletionMetricsQualityOptions.PRINT_MISSED_COMPLETION_SUMMARY,
|
||||
defaultsTo: false,
|
||||
help: 'Print summary information about the times that a completion '
|
||||
'request failed to produce a suggestions matching the expected '
|
||||
'suggestion.',
|
||||
negatable: false)
|
||||
..addFlag(CompletionMetricsQualityOptions.PRINT_MISSING_INFORMATION,
|
||||
defaultsTo: false,
|
||||
help: 'Print information about places where no completion location was '
|
||||
'computed and about information that is missing in the completion '
|
||||
'tables.',
|
||||
negatable: false)
|
||||
..addFlag(CompletionMetricsQualityOptions.PRINT_MRR_BY_LOCATION,
|
||||
defaultsTo: false,
|
||||
help:
|
||||
'Print information about the mrr score achieved at each completion '
|
||||
'location. This can help focus efforts to improve the overall '
|
||||
@@ -198,18 +194,15 @@ ArgParser createArgParser() {
|
||||
'impact.',
|
||||
negatable: false)
|
||||
..addFlag(CompletionMetricsQualityOptions.PRINT_SHADOWED_COMPLETION_DETAILS,
|
||||
defaultsTo: false,
|
||||
help: 'Print detailed information every time a completion request '
|
||||
'produces a suggestion whose name matches the expected suggestion '
|
||||
'but that is referencing a different element',
|
||||
negatable: false)
|
||||
..addFlag(CompletionMetricsOptions.PRINT_SLOWEST_RESULTS,
|
||||
defaultsTo: false,
|
||||
help: 'Print information about the completion requests that were the '
|
||||
'slowest to return suggestions.',
|
||||
negatable: false)
|
||||
..addFlag(CompletionMetricsQualityOptions.PRINT_WORST_RESULTS,
|
||||
defaultsTo: false,
|
||||
help: 'Print information about the completion requests that had the '
|
||||
'worst mrr scores.',
|
||||
negatable: false)
|
||||
@@ -791,8 +784,7 @@ class CompletionQualityMetricsComputer extends CompletionMetricsComputer {
|
||||
Future<void> computeMetrics() async {
|
||||
// To compare two or more changes to completions, add a `CompletionMetrics`
|
||||
// object with enable and disable functions to the list of `targetMetrics`.
|
||||
targetMetrics.add(CompletionMetrics('shipping',
|
||||
enableFunction: null, disableFunction: null));
|
||||
targetMetrics.add(CompletionMetrics('shipping'));
|
||||
|
||||
// To compare two or more relevance tables, uncomment the line below and
|
||||
// add the `RelevanceTables` to the list. The default relevance tables
|
||||
|
||||
@@ -88,7 +88,6 @@ ArgParser _createArgParser() {
|
||||
)
|
||||
..addFlag(
|
||||
CompletionMetricsOptions.PRINT_SLOWEST_RESULTS,
|
||||
defaultsTo: false,
|
||||
help: 'Print information about the completion requests that were the '
|
||||
'slowest to return suggestions.',
|
||||
negatable: false,
|
||||
|
||||
@@ -30,7 +30,7 @@ Future<void> main(List<String> args) async {
|
||||
await computer.compute(rootPath);
|
||||
stopwatch.stop();
|
||||
var duration = Duration(milliseconds: stopwatch.elapsedMilliseconds);
|
||||
out.writeln('');
|
||||
out.writeln();
|
||||
out.writeln('Analysis performed in $duration');
|
||||
computer.writeResults(out);
|
||||
await out.flush();
|
||||
@@ -241,14 +241,14 @@ class FlutterMetricsComputer {
|
||||
|
||||
/// Write the child data to the [sink].
|
||||
void _writeChildData(StringSink sink) {
|
||||
sink.writeln('');
|
||||
sink.writeln();
|
||||
sink.writeln('The number of times a widget had a given child.');
|
||||
_writeStructureData(sink, data.childData);
|
||||
}
|
||||
|
||||
/// Write the parent data to the [sink].
|
||||
void _writeParentData(StringSink sink) {
|
||||
sink.writeln('');
|
||||
sink.writeln();
|
||||
sink.writeln('The number of times a widget had a given parent.');
|
||||
_writeStructureData(sink, data.parentData);
|
||||
}
|
||||
@@ -275,7 +275,7 @@ class FlutterMetricsComputer {
|
||||
|
||||
/// Write the widget count data to the [sink].
|
||||
void _writeWidgetCounts(StringSink sink) {
|
||||
sink.writeln('');
|
||||
sink.writeln();
|
||||
sink.writeln('Widget classes by frequency of instantiation');
|
||||
|
||||
var total = data.totalWidgetCount;
|
||||
|
||||
@@ -39,10 +39,8 @@ void main(List<String> args) async {
|
||||
defaultsTo: '1',
|
||||
help: 'the number of parameters per method',
|
||||
)
|
||||
..addFlag('use-barrel-file',
|
||||
defaultsTo: false, help: 'Whether to add a barrel import')
|
||||
..addFlag('use-barrel-file', help: 'Whether to add a barrel import')
|
||||
..addFlag('use-json-serializable',
|
||||
defaultsTo: false,
|
||||
help: 'Whether to declare @JsonSerializable classes');
|
||||
var argResults = argParser.parse(args);
|
||||
var libraryCount = int.parse(argResults['library-count'] as String);
|
||||
@@ -102,12 +100,12 @@ void main(List<String> args) async {
|
||||
content.writeln(import(testPackageLibUri('lib$importIndex.dart')));
|
||||
}
|
||||
}
|
||||
content.writeln('');
|
||||
content.writeln();
|
||||
}
|
||||
|
||||
if (useJsonSerializable) {
|
||||
content.writeln("part '$libraryName.g.dart';");
|
||||
content.writeln('');
|
||||
content.writeln();
|
||||
}
|
||||
|
||||
// Add top-level variables above tier 0.
|
||||
@@ -121,7 +119,7 @@ void main(List<String> args) async {
|
||||
.writeln('var x$topLevelVariableIndex = C$classReferenceIndex();');
|
||||
topLevelVariableIndex++;
|
||||
}
|
||||
content.writeln('');
|
||||
content.writeln();
|
||||
}
|
||||
|
||||
for (var cIndex = 1; cIndex <= classCount; cIndex++) {
|
||||
|
||||
@@ -909,8 +909,11 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
|
||||
indent(() {
|
||||
var methodString =
|
||||
literalString((impliedType.apiNode as Request).longMethod);
|
||||
var jsonPart = impliedType.type != null ? 'toJson()' : 'null';
|
||||
writeln('return Request(id, $methodString, $jsonPart);');
|
||||
if (impliedType.type != null) {
|
||||
writeln('return Request(id, $methodString, toJson());');
|
||||
} else {
|
||||
writeln('return Request(id, $methodString);');
|
||||
}
|
||||
});
|
||||
writeln('}');
|
||||
return true;
|
||||
@@ -929,11 +932,18 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
|
||||
writeln('Response toResponse(String id) {');
|
||||
}
|
||||
indent(() {
|
||||
var jsonPart = impliedType.type != null ? 'toJson()' : 'null';
|
||||
if (responseRequiresRequestTime) {
|
||||
writeln('return Response(id, requestTime, result: $jsonPart);');
|
||||
if (impliedType.type != null) {
|
||||
if (responseRequiresRequestTime) {
|
||||
writeln('return Response(id, requestTime, result: toJson());');
|
||||
} else {
|
||||
writeln('return Response(id, result: toJson());');
|
||||
}
|
||||
} else {
|
||||
writeln('return Response(id, result: $jsonPart);');
|
||||
if (responseRequiresRequestTime) {
|
||||
writeln('return Response(id, requestTime);');
|
||||
} else {
|
||||
writeln('return Response(id);');
|
||||
}
|
||||
}
|
||||
});
|
||||
writeln('}');
|
||||
|
||||
@@ -912,7 +912,7 @@ class AnalysisGetLibraryDependenciesParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'analysis.getLibraryDependencies', null);
|
||||
return Request(id, 'analysis.getLibraryDependencies');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -2403,7 +2403,7 @@ class AnalysisReanalyzeParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'analysis.reanalyze', null);
|
||||
return Request(id, 'analysis.reanalyze');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -2422,7 +2422,7 @@ class AnalysisReanalyzeResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -2649,7 +2649,7 @@ class AnalysisSetAnalysisRootsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -2737,7 +2737,7 @@ class AnalysisSetGeneralSubscriptionsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -2819,7 +2819,7 @@ class AnalysisSetPriorityFilesResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -2912,7 +2912,7 @@ class AnalysisSetSubscriptionsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -3191,7 +3191,7 @@ class AnalysisUpdateOptionsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -3271,7 +3271,7 @@ class AnalyticsEnableResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -3290,7 +3290,7 @@ class AnalyticsIsEnabledParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'analytics.isEnabled', null);
|
||||
return Request(id, 'analytics.isEnabled');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -3433,7 +3433,7 @@ class AnalyticsSendEventResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -3527,7 +3527,7 @@ class AnalyticsSendTimingResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -4523,7 +4523,7 @@ class CompletionRegisterLibraryPathsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -4704,7 +4704,7 @@ class DiagnosticGetDiagnosticsParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'diagnostic.getDiagnostics', null);
|
||||
return Request(id, 'diagnostic.getDiagnostics');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -4793,7 +4793,7 @@ class DiagnosticGetServerPortParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'diagnostic.getServerPort', null);
|
||||
return Request(id, 'diagnostic.getServerPort');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -6867,7 +6867,7 @@ class EditListPostfixCompletionTemplatesParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'edit.listPostfixCompletionTemplates', null);
|
||||
return Request(id, 'edit.listPostfixCompletionTemplates');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -7738,7 +7738,7 @@ class ExecutionDeleteContextResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -8418,7 +8418,7 @@ class ExecutionSetSubscriptionsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -10078,7 +10078,7 @@ class FlutterSetSubscriptionsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -14773,7 +14773,7 @@ class ServerCancelRequestResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -14959,7 +14959,7 @@ class ServerGetVersionParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'server.getVersion', null);
|
||||
return Request(id, 'server.getVersion');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -15332,7 +15332,7 @@ class ServerOpenUrlRequestResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -15504,7 +15504,7 @@ class ServerSetClientCapabilitiesResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -15591,7 +15591,7 @@ class ServerSetSubscriptionsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -15775,7 +15775,7 @@ class ServerShutdownParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'server.shutdown', null);
|
||||
return Request(id, 'server.shutdown');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -15794,7 +15794,7 @@ class ServerShutdownResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id) {
|
||||
return Response(id, result: null);
|
||||
return Response(id);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -524,7 +524,7 @@ class AnalysisHandleWatchEventsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id, int requestTime) {
|
||||
return Response(id, requestTime, result: null);
|
||||
return Response(id, requestTime);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -1038,7 +1038,7 @@ class AnalysisSetContextRootsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id, int requestTime) {
|
||||
return Response(id, requestTime, result: null);
|
||||
return Response(id, requestTime);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -1120,7 +1120,7 @@ class AnalysisSetPriorityFilesResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id, int requestTime) {
|
||||
return Response(id, requestTime, result: null);
|
||||
return Response(id, requestTime);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -1213,7 +1213,7 @@ class AnalysisSetSubscriptionsResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id, int requestTime) {
|
||||
return Response(id, requestTime, result: null);
|
||||
return Response(id, requestTime);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -1306,7 +1306,7 @@ class AnalysisUpdateContentResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id, int requestTime) {
|
||||
return Response(id, requestTime, result: null);
|
||||
return Response(id, requestTime);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -3349,7 +3349,7 @@ class PluginShutdownParams implements RequestParams {
|
||||
|
||||
@override
|
||||
Request toRequest(String id) {
|
||||
return Request(id, 'plugin.shutdown', null);
|
||||
return Request(id, 'plugin.shutdown');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -3368,7 +3368,7 @@ class PluginShutdownResult implements ResponseResult {
|
||||
|
||||
@override
|
||||
Response toResponse(String id, int requestTime) {
|
||||
return Response(id, requestTime, result: null);
|
||||
return Response(id, requestTime);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -915,8 +915,11 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
|
||||
indent(() {
|
||||
var methodString =
|
||||
literalString((impliedType.apiNode as Request).longMethod);
|
||||
var jsonPart = impliedType.type != null ? 'toJson()' : 'null';
|
||||
writeln('return Request(id, $methodString, $jsonPart);');
|
||||
if (impliedType.type != null) {
|
||||
writeln('return Request(id, $methodString, toJson());');
|
||||
} else {
|
||||
writeln('return Request(id, $methodString);');
|
||||
}
|
||||
});
|
||||
writeln('}');
|
||||
return true;
|
||||
@@ -935,11 +938,18 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
|
||||
writeln('Response toResponse(String id) {');
|
||||
}
|
||||
indent(() {
|
||||
var jsonPart = impliedType.type != null ? 'toJson()' : 'null';
|
||||
if (responseRequiresRequestTime) {
|
||||
writeln('return Response(id, requestTime, result: $jsonPart);');
|
||||
if (impliedType.type != null) {
|
||||
if (responseRequiresRequestTime) {
|
||||
writeln('return Response(id, requestTime, result: toJson());');
|
||||
} else {
|
||||
writeln('return Response(id, result: toJson());');
|
||||
}
|
||||
} else {
|
||||
writeln('return Response(id, result: $jsonPart);');
|
||||
if (responseRequiresRequestTime) {
|
||||
writeln('return Response(id, requestTime);');
|
||||
} else {
|
||||
writeln('return Response(id);');
|
||||
}
|
||||
}
|
||||
});
|
||||
writeln('}');
|
||||
|
||||
Reference in New Issue
Block a user