enable flutter_style_todos in server
Change-Id: I4921d538e1498e66c8cab2d84dfcad21d1a7b555 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335952 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
@@ -29,6 +29,7 @@ analyzer:
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- flutter_style_todos
|
||||
- library_annotations
|
||||
- prefer_single_quotes
|
||||
- unawaited_futures
|
||||
|
||||
@@ -124,7 +124,7 @@ abstract class CommonInputConverter extends Converter<String, Operation?> {
|
||||
if (method == COMPLETION_REQUEST_GET_SUGGESTIONS) {
|
||||
return CompletionRequestOperation(this, json);
|
||||
}
|
||||
// TODO(danrubel) replace this with code
|
||||
// TODO(danrubel): replace this with code
|
||||
// that just forwards the translated request
|
||||
if (method == ANALYSIS_REQUEST_GET_HOVER ||
|
||||
method == ANALYSIS_REQUEST_SET_ANALYSIS_ROOTS ||
|
||||
|
||||
@@ -202,7 +202,7 @@ class WaitForAnalysisCompleteOperation extends Operation {
|
||||
});
|
||||
timer = Timer.periodic(Duration(milliseconds: 20), (_) {
|
||||
if (!isAnalyzing) {
|
||||
// TODO (danrubel) revisit this once source change requests are implemented
|
||||
// TODO(danrubel): revisit this once source change requests are implemented
|
||||
subscription.cancel();
|
||||
timer.cancel();
|
||||
driver.logger.log(Level.INFO, 'analysis never started');
|
||||
|
||||
@@ -144,7 +144,7 @@ String getElementDisplayName(engine.Element element) {
|
||||
|
||||
String? _getParametersString(engine.Element element,
|
||||
{required bool withNullability}) {
|
||||
// TODO(scheglov) expose the corresponding feature from ExecutableElement
|
||||
// TODO(scheglov): expose the corresponding feature from ExecutableElement
|
||||
List<engine.ParameterElement> parameters;
|
||||
if (element is engine.ExecutableElement) {
|
||||
// valid getters don't have parameters
|
||||
|
||||
@@ -578,7 +578,7 @@ class AnalyticsManager {
|
||||
));
|
||||
}
|
||||
}
|
||||
// TODO(brianwilkerson) We don't appear to have an event defined that we
|
||||
// TODO(brianwilkerson): We don't appear to have an event defined that we
|
||||
// can use to send analytics about how often old-style refactorings are
|
||||
// being invoked.
|
||||
// var refactoringMap = data.additionalEnumCounts[refactoringKindEnumKey];
|
||||
|
||||
@@ -169,8 +169,8 @@ class CiderCompletionComputer {
|
||||
|
||||
/// Return suggestions from libraries imported into the [target].
|
||||
///
|
||||
/// TODO(scheglov) Implement show / hide combinators.
|
||||
/// TODO(scheglov) Implement prefixes.
|
||||
// TODO(scheglov): Implement show / hide combinators.
|
||||
// TODO(scheglov): Implement prefixes.
|
||||
List<CompletionSuggestionBuilder> _importedLibrariesSuggestions({
|
||||
required LibraryElement target,
|
||||
required OperationPerformanceImpl performance,
|
||||
|
||||
@@ -374,7 +374,7 @@ class _DartUnitFoldingComputerVisitor extends RecursiveAstVisitor<void> {
|
||||
@override
|
||||
void visitMixinDeclaration(MixinDeclaration node) {
|
||||
_computer._addRegionForAnnotations(node.metadata);
|
||||
// TODO(brianwilkerson) Define `FoldingKind.MIXIN_BODY`?
|
||||
// TODO(brianwilkerson): Define `FoldingKind.MIXIN_BODY`?
|
||||
_computer._addRegion(node.name.end, node.end, FoldingKind.CLASS_BODY);
|
||||
super.visitMixinDeclaration(node);
|
||||
}
|
||||
|
||||
@@ -749,7 +749,7 @@ class _DartUnitHighlightsComputerVisitor extends RecursiveAstVisitor<void> {
|
||||
constructorName.type.accept(this);
|
||||
|
||||
// We have a `ConstructorReference` only when it is resolved.
|
||||
// TODO(scheglov) The `ConstructorName` in a tear-off always has a name,
|
||||
// TODO(scheglov): The `ConstructorName` in a tear-off always has a name,
|
||||
// but this is not expressed via types.
|
||||
computer._addRegion_node(
|
||||
constructorName.name!, HighlightRegionType.CONSTRUCTOR_TEAR_OFF);
|
||||
@@ -1345,7 +1345,7 @@ class _DartUnitHighlightsComputerVisitor extends RecursiveAstVisitor<void> {
|
||||
void visitSetOrMapLiteral(SetOrMapLiteral node) {
|
||||
if (node.isMap) {
|
||||
computer._addRegion_node(node, HighlightRegionType.LITERAL_MAP);
|
||||
// TODO(brianwilkerson) Add a highlight region for set literals. This
|
||||
// TODO(brianwilkerson): Add a highlight region for set literals. This
|
||||
// would be a breaking change, but would be consistent with list and map
|
||||
// literals.
|
||||
// } else if (node.isSet) {
|
||||
|
||||
@@ -257,7 +257,7 @@ class DartUnitHoverComputer {
|
||||
static Documentation? computeDocumentation(
|
||||
DartdocDirectiveInfo dartdocInfo, Element elementBeingDocumented,
|
||||
{bool includeSummary = false}) {
|
||||
// TODO(dantup) We're reusing this in parameter information - move it
|
||||
// TODO(dantup): We're reusing this in parameter information - move it
|
||||
// somewhere shared?
|
||||
Element? element = elementBeingDocumented;
|
||||
if (element is FieldFormalParameterElement) {
|
||||
|
||||
@@ -148,7 +148,7 @@ class ImportElementsComputer {
|
||||
}
|
||||
} else if (combinator is ShowCombinator &&
|
||||
namesToShow.isNotEmpty) {
|
||||
// TODO(brianwilkerson) Add the names in alphabetic order.
|
||||
// TODO(brianwilkerson): Add the names in alphabetic order.
|
||||
builder.addInsertion(combinator.shownNames.last.end, (builder) {
|
||||
for (var nameToShow in namesToShow) {
|
||||
builder.write(', ');
|
||||
@@ -294,14 +294,14 @@ class ImportElementsComputer {
|
||||
if (importDirectives.isEmpty) {
|
||||
if (libraryDirective == null) {
|
||||
if (otherDirectives.isEmpty) {
|
||||
// TODO(brianwilkerson) Insert after any non-doc comments.
|
||||
// TODO(brianwilkerson): Insert after any non-doc comments.
|
||||
return _InsertionDescription(0, after: 2);
|
||||
}
|
||||
return _InsertionDescription(otherDirectives[0].offset, after: 2);
|
||||
}
|
||||
return _InsertionDescription(libraryDirective.end, before: 2);
|
||||
}
|
||||
// TODO(brianwilkerson) Fix this to find the right location.
|
||||
// TODO(brianwilkerson): Fix this to find the right location.
|
||||
// See DartFileEditBuilderImpl._addLibraryImports for inspiration.
|
||||
return _InsertionDescription(importDirectives.last.end, before: 1);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import 'package:yaml/yaml.dart';
|
||||
|
||||
/// Enables watching of files generated by Blaze.
|
||||
///
|
||||
/// TODO(michalt): This is a temporary flag that we use to disable this
|
||||
// TODO(michalt): This is a temporary flag that we use to disable this
|
||||
/// functionality due its performance issues. We plan to benchmark and optimize
|
||||
/// it and re-enable it everywhere.
|
||||
/// Not private to enable testing.
|
||||
@@ -113,7 +113,7 @@ abstract class ContextManager {
|
||||
/// operations are in progress, and (c) determine which files should be
|
||||
/// analyzed.
|
||||
///
|
||||
/// TODO(paulberry): eliminate this interface, and instead have [ContextManager]
|
||||
// TODO(paulberry): eliminate this interface, and instead have [ContextManager]
|
||||
/// operations return data structures describing how context state should be
|
||||
/// modified.
|
||||
abstract class ContextManagerCallbacks {
|
||||
@@ -136,7 +136,7 @@ abstract class ContextManagerCallbacks {
|
||||
|
||||
/// Add listeners to the [driver]. This must be the only listener.
|
||||
///
|
||||
/// TODO(scheglov) Just pass results in here?
|
||||
// TODO(scheglov): Just pass results in here?
|
||||
void listenAnalysisDriver(AnalysisDriver driver);
|
||||
|
||||
/// The `pubspec.yaml` at [path] was added/modified.
|
||||
@@ -775,7 +775,7 @@ class ContextManagerImpl implements ContextManager {
|
||||
|
||||
void _handleWatchEventImpl(WatchEvent event) {
|
||||
// Figure out which context this event applies to.
|
||||
// TODO(brianwilkerson) If a file is explicitly included in one context
|
||||
// TODO(brianwilkerson): If a file is explicitly included in one context
|
||||
// but implicitly referenced in another context, we will only send a
|
||||
// changeSet to the context that explicitly includes the file (because
|
||||
// that's the only context that's watching the file).
|
||||
|
||||
@@ -131,7 +131,7 @@ protocol.Notification createExistingImportsNotification(
|
||||
).toNotification();
|
||||
}
|
||||
|
||||
/// TODO(dantup): We need to expose this because the Declarations code currently
|
||||
// TODO(dantup): We need to expose this because the Declarations code currently
|
||||
/// returns declarations with DeclarationKinds but the DartCompletionManager
|
||||
/// gives us a list of "included ElementKinds". Maybe it would be better to expose
|
||||
/// includedDeclarationKinds and then just map that list to ElementKinds once in
|
||||
|
||||
@@ -41,7 +41,7 @@ class RuntimeCompletionComputer {
|
||||
builder.addInsertion(contextOffset, (builder) {
|
||||
builder.writeln('{');
|
||||
|
||||
// TODO(scheglov) Use variables.
|
||||
// TODO(scheglov): Use variables.
|
||||
|
||||
builder.write(codeMarker);
|
||||
builder.writeln(';');
|
||||
@@ -86,7 +86,7 @@ class RuntimeCompletionComputer {
|
||||
// Remove completions with synthetic import prefixes.
|
||||
suggestions.removeWhere((s) => s.completion.startsWith('__prefix'));
|
||||
|
||||
// TODO(scheglov) Add support for expressions.
|
||||
// TODO(scheglov): Add support for expressions.
|
||||
var expressions = <RuntimeCompletionExpression>[];
|
||||
return RuntimeCompletionResult(expressions, suggestions);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ class CompletionGetSuggestions2Handler extends CompletionHandler
|
||||
),
|
||||
);
|
||||
});
|
||||
// TODO (danrubel) if request is obsolete (processAnalysisRequest returns
|
||||
// TODO(danrubel): if request is obsolete (processAnalysisRequest returns
|
||||
// false) then send empty results
|
||||
|
||||
//
|
||||
|
||||
@@ -57,7 +57,7 @@ class EditBulkFixes extends LegacyHandler {
|
||||
sendResult(EditBulkFixesResult('', result.edits, result.details));
|
||||
}
|
||||
} catch (exception, stackTrace) {
|
||||
// TODO(brianwilkerson) Move exception handling outside [handle].
|
||||
// TODO(brianwilkerson): Move exception handling outside [handle].
|
||||
server.sendServerErrorNotification('Exception while getting bulk fixes',
|
||||
CaughtException(exception, stackTrace), stackTrace);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class EditFormatHandler extends LegacyHandler {
|
||||
var edits = <SourceEdit>[];
|
||||
|
||||
if (formattedSource != unformattedCode) {
|
||||
//TODO: replace full replacements with smaller, more targeted edits
|
||||
// TODO(brianwilkerson): replace full replacements with smaller, more targeted edits
|
||||
var edit = SourceEdit(0, unformattedCode.length, formattedSource);
|
||||
edits.add(edit);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class EditFormatIfEnabledHandler extends LegacyHandler {
|
||||
/// Throws a [FileSystemException] if the file doesn't exist or can't be read.
|
||||
/// Throws a [FormatterException] if the code could not be formatted.
|
||||
List<SourceEdit> formatFile(String filePath) {
|
||||
// TODO(brianwilkerson) Move this to a superclass when `edit.format` is
|
||||
// TODO(brianwilkerson): Move this to a superclass when `edit.format` is
|
||||
// implemented by a handler class so the code can be shared.
|
||||
var resource = server.resourceProvider.getFile(filePath);
|
||||
var originalContent = resource.readAsStringSync();
|
||||
@@ -37,7 +37,7 @@ class EditFormatIfEnabledHandler extends LegacyHandler {
|
||||
|
||||
var edits = <SourceEdit>[];
|
||||
if (formattedContent != originalContent) {
|
||||
// TODO(brianwilkerson) Replace full replacements with smaller, more
|
||||
// TODO(brianwilkerson): Replace full replacements with smaller, more
|
||||
// targeted edits.
|
||||
var edit = SourceEdit(0, originalContent.length, formattedContent);
|
||||
edits.add(edit);
|
||||
@@ -55,7 +55,7 @@ class EditFormatIfEnabledHandler extends LegacyHandler {
|
||||
);
|
||||
var sourceFileEdits = <SourceFileEdit>[];
|
||||
for (var context in collection.contexts) {
|
||||
// TODO(pq) maybe experimental and could be unused (or maybe used by dart fix)
|
||||
// TODO(pq): maybe experimental and could be unused (or maybe used by dart fix)
|
||||
if (context.analysisOptions.codeStyleOptions.useFormatter) {
|
||||
_formatInContext(context, sourceFileEdits);
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ error.errorCode: ${error.errorCode}
|
||||
if (fixes.isNotEmpty) {
|
||||
fixes.sort(Fix.compareFixes);
|
||||
var lineInfo = LineInfo.fromContent(content);
|
||||
// TODO(pq) package:analyzer results are specific to *.dart files and we
|
||||
// TODO(pq): package:analyzer results are specific to *.dart files and we
|
||||
// shouldn't use them to represent errors in non-Dart files.
|
||||
// see: https://dart-review.googlesource.com/c/sdk/+/333588
|
||||
var result = engine.ErrorsResultImpl(
|
||||
|
||||
@@ -20,7 +20,7 @@ class EditOrganizeDirectivesHandler extends LegacyHandler {
|
||||
|
||||
@override
|
||||
Future<void> handle() async {
|
||||
// TODO(brianwilkerson) Move analytics tracking out of [handleRequest].
|
||||
// TODO(brianwilkerson): Move analytics tracking out of [handleRequest].
|
||||
unawaited(server.options.analytics?.sendEvent(
|
||||
'edit',
|
||||
'organizeDirectives',
|
||||
|
||||
@@ -34,7 +34,7 @@ class ExecutionGetSuggestionsHandler extends LegacyHandler {
|
||||
// var result = new ExecutionGetSuggestionsResult(
|
||||
// suggestions: completionResult.suggestions,
|
||||
// expressions: completionResult.expressions);
|
||||
// TODO(brianwilkerson) Re-enable this functionality after implementing a
|
||||
// TODO(brianwilkerson): Re-enable this functionality after implementing a
|
||||
// way of computing suggestions that is compatible with AnalysisSession.
|
||||
var result = ExecutionGetSuggestionsResult(
|
||||
suggestions: <CompletionSuggestion>[],
|
||||
|
||||
@@ -735,7 +735,7 @@ class LegacyAnalysisServer extends AnalysisServer {
|
||||
|
||||
/// Implementation for `analysis.setAnalysisRoots`.
|
||||
///
|
||||
/// TODO(scheglov) implement complete projects/contexts semantics.
|
||||
// TODO(scheglov): implement complete projects/contexts semantics.
|
||||
///
|
||||
/// The current implementation is intentionally simplified and expected
|
||||
/// that only folders are given each given folder corresponds to the exactly
|
||||
@@ -834,7 +834,7 @@ class LegacyAnalysisServer extends AnalysisServer {
|
||||
|
||||
pubApi.close();
|
||||
|
||||
// TODO(brianwilkerson) Remove the following 6 lines when the
|
||||
// TODO(brianwilkerson): Remove the following 6 lines when the
|
||||
// analyticsManager is being correctly initialized.
|
||||
var analytics = options.analytics;
|
||||
if (analytics != null) {
|
||||
@@ -914,14 +914,14 @@ class LegacyAnalysisServer extends AnalysisServer {
|
||||
notifyDeclarationsTracker(file);
|
||||
notifyFlutterWidgetDescriptions(file);
|
||||
|
||||
// TODO(scheglov) implement other cases
|
||||
// TODO(scheglov): implement other cases
|
||||
});
|
||||
}
|
||||
|
||||
/// Use the given updaters to update the values of the options in every
|
||||
/// existing analysis context.
|
||||
void updateOptions(List<OptionUpdater> optionUpdaters) {
|
||||
// TODO(scheglov) implement for the new analysis driver
|
||||
// TODO(scheglov): implement for the new analysis driver
|
||||
// //
|
||||
// // Update existing contexts.
|
||||
// //
|
||||
@@ -932,7 +932,7 @@ class LegacyAnalysisServer extends AnalysisServer {
|
||||
// optionUpdater(options);
|
||||
// });
|
||||
// context.analysisOptions = options;
|
||||
// // TODO(brianwilkerson) As far as I can tell, this doesn't cause analysis
|
||||
// // `TODO`(brianwilkerson) As far as I can tell, this doesn't cause analysis
|
||||
// // to be scheduled for this context.
|
||||
// }
|
||||
// //
|
||||
@@ -1048,7 +1048,7 @@ class ServerContextManagerCallbacks
|
||||
// if (analysisServer._hasAnalysisServiceSubscription(
|
||||
// AnalysisService.OUTLINE, path)) {
|
||||
// _runDelayed(() {
|
||||
// // TODO(brianwilkerson) Change NotificationManager to store params
|
||||
// // `TODO`(brianwilkerson) Change NotificationManager to store params
|
||||
// // so that fileKind and libraryName can be recorded / passed along.
|
||||
// notificationManager.recordOutlines(NotificationManager.serverId, path,
|
||||
// _computeOutlineParams(path, unit, result.lineInfo));
|
||||
@@ -1113,9 +1113,9 @@ class ServerContextManagerCallbacks
|
||||
/// important consumer of an analysis results, specifically a code completion
|
||||
/// computer, we want it to run before spending time of sending notifications.
|
||||
///
|
||||
/// TODO(scheglov) Consider replacing this with full priority based scheduler.
|
||||
// TODO(scheglov): Consider replacing this with full priority based scheduler.
|
||||
///
|
||||
/// TODO(scheglov) Alternatively, if code completion work in a way that does
|
||||
// TODO(scheglov): Alternatively, if code completion work in a way that does
|
||||
/// not produce (at first) fully resolved unit, but only part of it - a single
|
||||
/// method, or a top-level declaration, we would not have this problem - the
|
||||
/// completion computer would be the only consumer of the partial analysis
|
||||
|
||||
@@ -46,7 +46,7 @@ class LspClientConfiguration {
|
||||
/// Returns whether or not the provided new configuration changes any values
|
||||
/// that would affect analysis results.
|
||||
bool affectsAnalysisResults(LspGlobalClientConfiguration otherConfig) {
|
||||
// Check whether TODO settings have changed.
|
||||
// Check whether `TODO` settings have changed.
|
||||
final oldFlag = _globalSettings.showAllTodos;
|
||||
final newFlag = otherConfig.showAllTodos;
|
||||
final oldTypes = _globalSettings.showTodoTypes;
|
||||
@@ -178,11 +178,11 @@ class LspGlobalClientConfiguration extends LspResourceClientConfiguration {
|
||||
bool get previewCommitCharacters =>
|
||||
_settings['previewCommitCharacters'] as bool? ?? false;
|
||||
|
||||
/// Whether diagnostics should be generated for all TODO comments.
|
||||
// Whether diagnostics should be generated for all `TODO` comments.
|
||||
bool get showAllTodos =>
|
||||
_settings['showTodos'] is bool ? _settings['showTodos'] as bool : false;
|
||||
|
||||
/// A specific set of TODO comments that should generate diagnostics.
|
||||
// A specific set of `TODO` comments that should generate diagnostics.
|
||||
///
|
||||
/// Codes are all forced UPPERCASE regardless of what the client supplies.
|
||||
///
|
||||
|
||||
@@ -160,7 +160,7 @@ class CodeActionHandler
|
||||
if (isPubspec)
|
||||
PubspecCodeActionsProducer(
|
||||
server,
|
||||
// TODO(pq) can we do better?
|
||||
// TODO(pq): can we do better?
|
||||
server.resourceProvider.getFile(unitPath),
|
||||
lineInfo,
|
||||
offset: offset,
|
||||
@@ -171,7 +171,7 @@ class CodeActionHandler
|
||||
if (isAnalysisOptions)
|
||||
AnalysisOptionsCodeActionsProducer(
|
||||
server,
|
||||
// TODO(pq) can we do better?
|
||||
// TODO(pq): can we do better?
|
||||
server.resourceProvider.getFile(unitPath),
|
||||
lineInfo,
|
||||
offset: offset,
|
||||
@@ -181,7 +181,7 @@ class CodeActionHandler
|
||||
),
|
||||
PluginCodeActionsProducer(
|
||||
server,
|
||||
// TODO(pq) can we do better?
|
||||
// TODO(pq): can we do better?
|
||||
server.resourceProvider.getFile(unitPath),
|
||||
lineInfo,
|
||||
offset: offset,
|
||||
|
||||
@@ -62,7 +62,7 @@ class LspNotificationManager extends AbstractNotificationManager {
|
||||
@override
|
||||
void sendHighlightRegions(
|
||||
String filePath, List<protocol.HighlightRegion> mergedHighlights) {
|
||||
// TODO: implement sendHighlightRegions
|
||||
// TODO(dantup): implement sendHighlightRegions
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -92,6 +92,6 @@ class LspNotificationManager extends AbstractNotificationManager {
|
||||
|
||||
@override
|
||||
void sendPluginErrorNotification(Notification notification) {
|
||||
// TODO: implement sendPluginErrorNotification
|
||||
// TODO(dantup): implement sendPluginErrorNotification
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ abstract class AbstractNotificationManager {
|
||||
<server.AnalysisService, Set<String>>{};
|
||||
|
||||
/// The collector being used to collect the analysis errors from the plugins.
|
||||
// TODO(brianwilkerson) Consider the possibility of not passing the predicate
|
||||
// TODO(brianwilkerson): Consider the possibility of not passing the predicate
|
||||
// in to the collector, but instead to the testing in this class.
|
||||
late ResultCollector<List<AnalysisError>> errors =
|
||||
ResultCollector<List<AnalysisError>>(serverId, predicate: _isIncluded);
|
||||
@@ -295,7 +295,7 @@ abstract class AbstractNotificationManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO(brianwilkerson) Return false if error notifications are globally
|
||||
// TODO(brianwilkerson): Return false if error notifications are globally
|
||||
// disabled.
|
||||
return isIncluded() && !isExcluded();
|
||||
}
|
||||
@@ -360,7 +360,7 @@ class NotificationManager extends AbstractNotificationManager {
|
||||
@override
|
||||
void sendPluginErrorNotification(plugin.Notification notification) {
|
||||
var params = plugin.PluginErrorParams.fromNotification(notification);
|
||||
// TODO(brianwilkerson) There is no indication for the client as to the
|
||||
// TODO(brianwilkerson): There is no indication for the client as to the
|
||||
// fact that the error came from a plugin, let alone which plugin it
|
||||
// came from. We should consider whether we really want to send them to
|
||||
// the client.
|
||||
|
||||
@@ -50,7 +50,7 @@ class PluginLocator {
|
||||
/// The implementation of [findPlugin].
|
||||
String? _findPlugin(String packageRoot) {
|
||||
var packageFolder = resourceProvider.getFolder(packageRoot);
|
||||
// TODO(brianwilkerson) Re-enable this after deciding how we want to deal
|
||||
// TODO(brianwilkerson): Re-enable this after deciding how we want to deal
|
||||
// with discovery of plugins.
|
||||
// import 'package:yaml/yaml.dart';
|
||||
// File pubspecFile = packageFolder.getChildAssumingFile(pubspecFileName);
|
||||
|
||||
@@ -916,7 +916,7 @@ class PluginSession {
|
||||
/// Return `true` if there are any requests that have not been responded to
|
||||
/// within the maximum allowed amount of time.
|
||||
bool isNonResponsive() {
|
||||
// TODO(brianwilkerson) Figure out when to invoke this method in order to
|
||||
// TODO(brianwilkerson): Figure out when to invoke this method in order to
|
||||
// identify non-responsive plugins and kill them.
|
||||
var cutOffTime = DateTime.now().millisecondsSinceEpoch -
|
||||
MAXIMUM_RESPONSE_TIME.inMilliseconds;
|
||||
@@ -966,7 +966,7 @@ class PluginSession {
|
||||
return false;
|
||||
}
|
||||
channel = info._createChannel();
|
||||
// TODO(brianwilkerson) Determine if await is necessary, if so, change the
|
||||
// TODO(brianwilkerson): Determine if await is necessary, if so, change the
|
||||
// return type of `channel.listen` to `Future<void>`.
|
||||
await (channel!.listen(handleResponse, handleNotification,
|
||||
onDone: handleOnDone, onError: handleOnError) as dynamic);
|
||||
|
||||
@@ -62,7 +62,7 @@ class PluginWatcher implements DriverWatcher {
|
||||
//
|
||||
// Add the plugin to the context root.
|
||||
//
|
||||
// TODO(brianwilkerson) Do we need to wait for the plugin to be added?
|
||||
// TODO(brianwilkerson): Do we need to wait for the plugin to be added?
|
||||
// If we don't, then tests don't have any way to know when to expect
|
||||
// that the list of plugins has been updated.
|
||||
manager.addPluginToContextRoot(
|
||||
@@ -88,7 +88,7 @@ class PluginWatcher implements DriverWatcher {
|
||||
String _getSdkPath(AnalysisDriver driver) {
|
||||
var coreSource = driver.sourceFactory.forUri('dart:core');
|
||||
|
||||
// TODO(scheglov) Debug for https://github.com/dart-lang/sdk/issues/35226
|
||||
// TODO(scheglov): Debug for https://github.com/dart-lang/sdk/issues/35226
|
||||
if (coreSource == null) {
|
||||
var sdk = driver.sourceFactory.dartSdk;
|
||||
if (sdk is AbstractDartSdk) {
|
||||
|
||||
@@ -80,7 +80,7 @@ class ResultMerger {
|
||||
/// list will contain duplications.
|
||||
List<AnalysisError> mergeAnalysisErrors(
|
||||
List<List<AnalysisError>> partialResultList) {
|
||||
// TODO(brianwilkerson) Consider merging duplicate errors (same code,
|
||||
// TODO(brianwilkerson): Consider merging duplicate errors (same code,
|
||||
// location, and messages). If we do that, we should return the logical-or
|
||||
// of the hasFix fields from the merged errors.
|
||||
var count = partialResultList.length;
|
||||
@@ -401,7 +401,7 @@ class ResultMerger {
|
||||
void addToMap(Outline outline) {
|
||||
var key = computeKey(outline.element);
|
||||
if (outlineMap.containsKey(key)) {
|
||||
// TODO(brianwilkerson) Decide how to handle this more gracefully.
|
||||
// TODO(brianwilkerson): Decide how to handle this more gracefully.
|
||||
throw StateError('Inconsistent outlines');
|
||||
}
|
||||
outlineMap[key] = outline;
|
||||
@@ -544,7 +544,7 @@ class ResultMerger {
|
||||
var lengths = first.lengths.toList();
|
||||
for (var i = 1; i < count; i++) {
|
||||
var feedback = feedbacks[i] as ExtractLocalVariableFeedback;
|
||||
// TODO(brianwilkerson) This doesn't ensure that the covering data is in
|
||||
// TODO(brianwilkerson): This doesn't ensure that the covering data is in
|
||||
// the right order and consistent.
|
||||
var coveringOffsets = feedback.coveringExpressionOffsets;
|
||||
if (coveringOffsets != null) {
|
||||
@@ -589,8 +589,8 @@ class ResultMerger {
|
||||
}
|
||||
}
|
||||
canCreateGetter = canCreateGetter && feedback.canCreateGetter;
|
||||
// TODO(brianwilkerson) This doesn't allow plugins to add parameters.
|
||||
// TODO(brianwilkerson) This doesn't check for duplicate offsets.
|
||||
// TODO(brianwilkerson): This doesn't allow plugins to add parameters.
|
||||
// TODO(brianwilkerson): This doesn't check for duplicate offsets.
|
||||
offsets.addAll(feedback.offsets);
|
||||
lengths.addAll(feedback.lengths);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ mixin RequestHandlerMixin<T extends AnalysisServer> {
|
||||
plugin.RequestParams? requestParameters,
|
||||
Duration timeout = const Duration(milliseconds: 500),
|
||||
}) async {
|
||||
// TODO(brianwilkerson) requestParameters might need to be required.
|
||||
// TODO(brianwilkerson): requestParameters might need to be required.
|
||||
var timer = Stopwatch()..start();
|
||||
var responses = <plugin.Response>[];
|
||||
for (var entry in futures.entries) {
|
||||
@@ -36,7 +36,7 @@ mixin RequestHandlerMixin<T extends AnalysisServer> {
|
||||
var response = await future.timeout(timeout - timer.elapsed);
|
||||
var error = response.error;
|
||||
if (error != null) {
|
||||
// TODO(brianwilkerson) Report the error to the plugin manager.
|
||||
// TODO(brianwilkerson): Report the error to the plugin manager.
|
||||
server.instrumentationService.logPluginError(
|
||||
pluginInfo.data,
|
||||
error.code.name,
|
||||
@@ -46,13 +46,13 @@ mixin RequestHandlerMixin<T extends AnalysisServer> {
|
||||
responses.add(response);
|
||||
}
|
||||
} on TimeoutException {
|
||||
// TODO(brianwilkerson) Report the timeout to the plugin manager.
|
||||
// TODO(brianwilkerson): Report the timeout to the plugin manager.
|
||||
server.instrumentationService.logPluginTimeout(
|
||||
pluginInfo.data,
|
||||
JsonEncoder()
|
||||
.convert(requestParameters?.toRequest('-').toJson() ?? {}));
|
||||
} catch (exception, stackTrace) {
|
||||
// TODO(brianwilkerson) Report the exception to the plugin manager.
|
||||
// TODO(brianwilkerson): Report the exception to the plugin manager.
|
||||
server.instrumentationService
|
||||
.logPluginException(pluginInfo.data, exception, stackTrace);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ class Driver implements ServerStarter {
|
||||
final defaultSdkPath = _getSdkPath(results);
|
||||
final dartSdkManager = DartSdkManager(defaultSdkPath);
|
||||
|
||||
// TODO(brianwilkerson) It would be nice to avoid creating an SDK that
|
||||
// TODO(brianwilkerson): It would be nice to avoid creating an SDK that
|
||||
// can't be re-used, but the SDK is needed to create a package map provider
|
||||
// in the case where we need to run `pub` in order to get the package map.
|
||||
var defaultSdk = _createDefaultSdk(defaultSdkPath);
|
||||
@@ -559,7 +559,7 @@ class Driver implements ServerStarter {
|
||||
/// Create the `Analytics` instance to be used to report analytics.
|
||||
Analytics _createAnalytics(
|
||||
DartSdk dartSdk, String dartSdkPath, DashTool tool) {
|
||||
// TODO(brianwilkerson) Find out whether there's a way to get the channel
|
||||
// TODO(brianwilkerson): Find out whether there's a way to get the channel
|
||||
// without running `flutter channel`.
|
||||
var pathContext = PhysicalResourceProvider.INSTANCE.pathContext;
|
||||
var flutterSdkRoot = pathContext
|
||||
|
||||
@@ -84,7 +84,7 @@ class HttpAnalysisServer {
|
||||
/// Handle a GET request received by the HTTP server.
|
||||
Future<void> _handleGetRequest(HttpRequest request) async {
|
||||
getHandler ??= DiagnosticsSite(socketServer, _printBuffer);
|
||||
// TODO(brianwilkerson) Determine if await is necessary, if so, change the
|
||||
// TODO(brianwilkerson): Determine if await is necessary, if so, change the
|
||||
// return type of [AbstractGetHandler.handleGetRequest] to `Future<void>`.
|
||||
await (getHandler!.handleGetRequest(request) as dynamic);
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ final class PropertyAccessSuggestion extends CandidateSuggestion {
|
||||
}
|
||||
|
||||
extension SuggestionBuilderExtension on SuggestionBuilder {
|
||||
// TODO(brianwilkerson) Move these to `SuggestionBuilder`, possibly as part
|
||||
// TODO(brianwilkerson): Move these to `SuggestionBuilder`, possibly as part
|
||||
// of splitting it into a legacy builder and an LSP builder.
|
||||
|
||||
/// Add a suggestion based on the candidate [suggestion].
|
||||
@@ -245,11 +245,11 @@ extension SuggestionBuilderExtension on SuggestionBuilder {
|
||||
case LocalFunctionSuggestion():
|
||||
suggestTopLevelFunction(suggestion.element);
|
||||
case LocalVariableSuggestion():
|
||||
// TODO(brianwilkerson) Enhance `suggestLocalVariable` to allow the
|
||||
// TODO(brianwilkerson): Enhance `suggestLocalVariable` to allow the
|
||||
// distance to be passed in.
|
||||
suggestLocalVariable(suggestion.element);
|
||||
case MethodSuggestion():
|
||||
// TODO(brianwilkerson) Correctly set the kind of suggestion in cases
|
||||
// TODO(brianwilkerson): Correctly set the kind of suggestion in cases
|
||||
// where `isFunctionalArgument` would return `true` so we can stop
|
||||
// using the `request.target`.
|
||||
var kind = request.target.isFunctionalArgument()
|
||||
|
||||
@@ -289,7 +289,7 @@ class DartCompletionManager {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
// TODO(brianwilkerson) This was previously used to boost exact type
|
||||
// TODO(brianwilkerson): This was previously used to boost exact type
|
||||
// matches. For example, if the context type was `Foo`, then the class
|
||||
// `Foo` and it's constructors would be given this boost. Now this
|
||||
// boost will almost always be ignored because the element boost will
|
||||
@@ -308,7 +308,7 @@ class DartCompletionManager {
|
||||
// Run the first pass of the code completion algorithm.
|
||||
VisibilityTracker? _runFirstPass(
|
||||
DartCompletionRequest request, SuggestionBuilder builder) {
|
||||
// TODO(brianwilkerson) Stop returning the visibility tracker when the
|
||||
// TODO(brianwilkerson): Stop returning the visibility tracker when the
|
||||
// `LocalReferenceContributor` has been deleted.
|
||||
var collector = SuggestionCollector();
|
||||
var selection = request.unit.select(offset: request.offset, length: 0);
|
||||
@@ -536,7 +536,7 @@ class DartCompletionRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/// TODO(scheglov) Can we make it better?
|
||||
// TODO(scheglov): Can we make it better?
|
||||
String fromToken(Token token) {
|
||||
final lexeme = token.lexeme;
|
||||
if (offset >= token.offset && offset < token.end) {
|
||||
|
||||
@@ -70,7 +70,7 @@ class CompletionState {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(brianwilkerson) Move to 'package:analysis_server/src/utilities/extensions/ast.dart'
|
||||
// TODO(brianwilkerson): Move to 'package:analysis_server/src/utilities/extensions/ast.dart'
|
||||
extension on ClassMember {
|
||||
/// Return `true` if this member is a static member.
|
||||
bool get isStatic {
|
||||
|
||||
@@ -119,7 +119,7 @@ class DeclarationHelper {
|
||||
}
|
||||
|
||||
void addMembersOfType(DartType type) {
|
||||
// TODO(brianwilkerson) Implement this.
|
||||
// TODO(brianwilkerson): Implement this.
|
||||
}
|
||||
|
||||
/// Add suggestions for any local declarations that are visible at the
|
||||
@@ -270,7 +270,7 @@ class DeclarationHelper {
|
||||
/// Add suggestions for any top-level declarations that are visible within the
|
||||
/// [library].
|
||||
void _addTopLevelDeclarations(LibraryElement library) {
|
||||
// TODO(brianwilkerson) Implement this.
|
||||
// TODO(brianwilkerson): Implement this.
|
||||
// for (var unit in library.units) {
|
||||
// for (var element in unit.accessors) {}
|
||||
// for (var element in unit.classes) {}
|
||||
@@ -506,7 +506,7 @@ class DeclarationHelper {
|
||||
// visited it and don't want to suggest declared variables twice.
|
||||
continue;
|
||||
}
|
||||
// TODO(brianwilkerson) I think we need to compare to the end of the
|
||||
// TODO(brianwilkerson): I think we need to compare to the end of the
|
||||
// statement for variable declarations and the offset for functions.
|
||||
if (statement.offset < offset) {
|
||||
if (statement is VariableDeclarationStatement) {
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ class EnumConstantConstructorContributor extends DartCompletionContributor {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO(scheglov) It seems unfortunate that we have to re-discover
|
||||
// TODO(scheglov): It seems unfortunate that we have to re-discover
|
||||
// the location in contributors. This is the work of `OpType`, so why
|
||||
// doesn't it provide all these enclosing `EnumConstantDeclaration`,
|
||||
// `ConstructorSelector`, `EnumDeclaration`?
|
||||
|
||||
+2
-2
@@ -50,7 +50,7 @@ class ExtensionMemberContributor extends DartCompletionContributor {
|
||||
}
|
||||
_addExtensionMembers(extensions, defaultKind, thisExtendedType);
|
||||
}
|
||||
// TODO(scheglov) It seems that we don't support non-interface types.
|
||||
// TODO(scheglov): It seems that we don't support non-interface types.
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ class ExtensionMemberContributor extends DartCompletionContributor {
|
||||
inheritanceDistance = memberBuilder.request.featureComputer
|
||||
.inheritanceDistanceFeature(type.element, extendedType.element);
|
||||
}
|
||||
// TODO(brianwilkerson) We might want to apply the substitution to the
|
||||
// TODO(brianwilkerson): We might want to apply the substitution to the
|
||||
// members of the extension for display purposes.
|
||||
_addInstanceMembers(
|
||||
instantiatedExtension.extension, kind, inheritanceDistance);
|
||||
|
||||
@@ -698,7 +698,7 @@ class _ContextTypeVisitor extends SimpleAstVisitor<DartType> {
|
||||
var parent = node.parent;
|
||||
if (parent is MethodDeclaration) {
|
||||
var bodyContext = BodyInferenceContext.of(parent.body);
|
||||
// TODO(scheglov) https://github.com/dart-lang/sdk/issues/45429
|
||||
// TODO(scheglov): https://github.com/dart-lang/sdk/issues/45429
|
||||
if (bodyContext == null) {
|
||||
throw StateError('''
|
||||
Expected body context.
|
||||
@@ -857,7 +857,7 @@ Class: ${parent.parent}
|
||||
DartType? visitListLiteral(ListLiteral node) {
|
||||
if (range.endStart(node.leftBracket, node.rightBracket).contains(offset)) {
|
||||
final type = node.staticType;
|
||||
// TODO(scheglov) https://github.com/dart-lang/sdk/issues/48965
|
||||
// TODO(scheglov): https://github.com/dart-lang/sdk/issues/48965
|
||||
if (type == null) {
|
||||
throw '''
|
||||
No type.
|
||||
@@ -1219,7 +1219,7 @@ parent3: ${node.parent?.parent?.parent}
|
||||
/// `PatternAssignment` or a `PatternVariableDeclaration`, return the context
|
||||
/// type for the right-hand side.
|
||||
DartType? _requiredTypeOfPattern(DartPattern pattern) {
|
||||
// TODO(brianwilkerson) Replace with `patternTypeSchema` (on AST) where
|
||||
// TODO(brianwilkerson): Replace with `patternTypeSchema` (on AST) where
|
||||
// possible.
|
||||
pattern = pattern.unParenthesized;
|
||||
Element? element;
|
||||
|
||||
@@ -19,7 +19,7 @@ class FieldFormalContributor extends DartCompletionContributor {
|
||||
required OperationPerformanceImpl performance,
|
||||
}) async {
|
||||
var node = request.target.containingNode;
|
||||
// TODO(brianwilkerson) We should suggest field formal parameters even if
|
||||
// TODO(brianwilkerson): We should suggest field formal parameters even if
|
||||
// the user hasn't already typed the `this.` prefix, by including the
|
||||
// prefix in the completion.
|
||||
if (node is! FieldFormalParameter) {
|
||||
@@ -32,7 +32,7 @@ class FieldFormalContributor extends DartCompletionContributor {
|
||||
}
|
||||
|
||||
// Compute the list of fields already referenced in the constructor.
|
||||
// TODO(brianwilkerson) This doesn't include fields in initializers, which
|
||||
// TODO(brianwilkerson): This doesn't include fields in initializers, which
|
||||
// shouldn't be suggested.
|
||||
var referencedFields = <String>[];
|
||||
for (var param in constructor.parameters.parameters) {
|
||||
|
||||
+23
-23
@@ -166,12 +166,12 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
// parenthesized expression or a parameter list, the parser will recover
|
||||
// by parsing an `as` expression. This handles the case where the user is
|
||||
// actually trying to write a function expression.
|
||||
// TODO(brianwilkerson) Decide whether we should do more to ensure that
|
||||
// TODO(brianwilkerson): Decide whether we should do more to ensure that
|
||||
// the expression could be a parameter list.
|
||||
keywordHelper.addFunctionBodyModifiers(null);
|
||||
} else if (node.type.coversOffset(offset)) {
|
||||
collector.completionLocation = 'AsExpression_type';
|
||||
// TODO(brianwilkerson) Add a parameter to _forTypeAnnotation to prohibit
|
||||
// TODO(brianwilkerson): Add a parameter to _forTypeAnnotation to prohibit
|
||||
// producing `void`, then convert the call below.
|
||||
keywordHelper.addKeyword(Keyword.DYNAMIC);
|
||||
}
|
||||
@@ -223,7 +223,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
var previousStatement = node.statements.elementBefore(offset);
|
||||
if (previousStatement is TryStatement) {
|
||||
if (previousStatement.finallyBlock == null) {
|
||||
// TODO(brianwilkerson) Consider adding `on ^ {}`, `catch (e) {^}`, and
|
||||
// TODO(brianwilkerson): Consider adding `on ^ {}`, `catch (e) {^}`, and
|
||||
// `finally {^}`.
|
||||
keywordHelper.addKeyword(Keyword.ON);
|
||||
keywordHelper.addKeyword(Keyword.CATCH);
|
||||
@@ -300,7 +300,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
return;
|
||||
}
|
||||
if (offset <= node.name.end) {
|
||||
// TODO(brianwilkerson) Suggest a name for the class.
|
||||
// TODO(brianwilkerson): Suggest a name for the class.
|
||||
return;
|
||||
}
|
||||
if (offset <= node.leftBracket.offset) {
|
||||
@@ -340,7 +340,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
|
||||
@override
|
||||
void visitConditionalExpression(ConditionalExpression node) {
|
||||
// TODO(brianwilkerson) Consider adding a location for the condition.
|
||||
// TODO(brianwilkerson): Consider adding a location for the condition.
|
||||
if (offset >= node.question.end && offset <= node.colon.offset) {
|
||||
collector.completionLocation = 'ConditionalExpression_thenExpression';
|
||||
} else if (offset >= node.colon.end) {
|
||||
@@ -483,7 +483,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
return;
|
||||
}
|
||||
if (offset <= node.name.end) {
|
||||
// TODO(brianwilkerson) Suggest a name for the mixin.
|
||||
// TODO(brianwilkerson): Suggest a name for the mixin.
|
||||
return;
|
||||
}
|
||||
if (offset <= node.leftBracket.offset) {
|
||||
@@ -540,7 +540,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
if (featureSet.isEnabled(Feature.inline_class)) {
|
||||
keywordHelper.addPseudoKeyword('type');
|
||||
}
|
||||
// TODO(brianwilkerson) Suggest a name for the extension.
|
||||
// TODO(brianwilkerson): Suggest a name for the extension.
|
||||
return;
|
||||
}
|
||||
if (offset <= node.leftBracket.offset) {
|
||||
@@ -595,7 +595,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
} else {
|
||||
if (offset <= type.end) {
|
||||
keywordHelper.addFieldDeclarationKeywords(node);
|
||||
// TODO(brianwilkerson) `var` should only be suggested if neither
|
||||
// TODO(brianwilkerson): `var` should only be suggested if neither
|
||||
// `static` nor `final` are present.
|
||||
keywordHelper.addKeyword(Keyword.VAR);
|
||||
}
|
||||
@@ -784,7 +784,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
offset <= node.rightParenthesis.offset) {
|
||||
keywordHelper.addExpressionKeywords(node);
|
||||
} else if (offset >= node.rightParenthesis.end) {
|
||||
// TODO(brianwilkerson) Ensure that we are suggesting `else` after the
|
||||
// TODO(brianwilkerson): Ensure that we are suggesting `else` after the
|
||||
// then expression.
|
||||
var literal = node.thisOrAncestorOfType<TypedLiteral>();
|
||||
if (literal is ListLiteral) {
|
||||
@@ -839,7 +839,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
if (offset <= node.uri.offset) {
|
||||
return;
|
||||
} else if (offset <= node.uri.end) {
|
||||
// TODO(brianwilkerson) Complete the URI.
|
||||
// TODO(brianwilkerson): Complete the URI.
|
||||
} else {
|
||||
keywordHelper.addImportDirectiveKeywords(node);
|
||||
}
|
||||
@@ -879,7 +879,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
} else if (offset < isOperator.offset) {
|
||||
_forExpression(node);
|
||||
} else if (offset > isOperator.end) {
|
||||
// TODO(brianwilkerson) Suggest the types available in the current scope.
|
||||
// TODO(brianwilkerson): Suggest the types available in the current scope.
|
||||
// declarationHelper.addTypes();
|
||||
}
|
||||
}
|
||||
@@ -983,7 +983,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
return;
|
||||
}
|
||||
if (offset <= node.name.end) {
|
||||
// TODO(brianwilkerson) Suggest a name for the mixin.
|
||||
// TODO(brianwilkerson): Suggest a name for the mixin.
|
||||
return;
|
||||
}
|
||||
if (offset <= node.leftBracket.offset) {
|
||||
@@ -1052,18 +1052,18 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
void visitPatternField(PatternField node) {
|
||||
var name = node.name;
|
||||
if (name != null && offset <= name.colon.offset) {
|
||||
// TODO(brianwilkerson) Suggest the properties of the object or fields of
|
||||
// TODO(brianwilkerson): Suggest the properties of the object or fields of
|
||||
// the record.
|
||||
return;
|
||||
}
|
||||
if (name == null) {
|
||||
var parent = node.parent;
|
||||
if (parent is ObjectPattern) {
|
||||
// TODO(brianwilkerson) Suggest the properties of the object.
|
||||
// TODO(brianwilkerson): Suggest the properties of the object.
|
||||
// _addPropertiesOfType(parent.type.type);
|
||||
} else if (parent is RecordPattern) {
|
||||
_forPattern(node);
|
||||
// TODO(brianwilkerson) If we know the expected record type, add the
|
||||
// TODO(brianwilkerson): If we know the expected record type, add the
|
||||
// names of any named fields.
|
||||
}
|
||||
} else if (name.name == null) {
|
||||
@@ -1114,7 +1114,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
@override
|
||||
void visitRecordPattern(RecordPattern node) {
|
||||
_forExpression(node);
|
||||
// TODO(brianwilkerson) Is there a reason we aren't suggesting 'void'?
|
||||
// TODO(brianwilkerson): Is there a reason we aren't suggesting 'void'?
|
||||
keywordHelper.addKeyword(Keyword.DYNAMIC);
|
||||
}
|
||||
|
||||
@@ -1251,7 +1251,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
@override
|
||||
void visitSwitchExpressionCase(SwitchExpressionCase node) {
|
||||
if (node.arrow.isSynthetic) {
|
||||
// TODO(brianwilkerson) The user is completing the pattern.
|
||||
// TODO(brianwilkerson): The user is completing the pattern.
|
||||
return;
|
||||
}
|
||||
var expression = node.expression;
|
||||
@@ -1548,7 +1548,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
/// beginning of a class member.
|
||||
void _forClassMember() {
|
||||
keywordHelper.addClassMemberKeywords();
|
||||
// TODO(brianwilkerson) Suggest type names.
|
||||
// TODO(brianwilkerson): Suggest type names.
|
||||
}
|
||||
|
||||
/// Add the suggestions that are appropriate when the selection is at the
|
||||
@@ -1654,7 +1654,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
// code, but the offset will be past where the parser inserted sythetic
|
||||
// tokens, preventing that from working.
|
||||
switch (precedingMember) {
|
||||
// TODO(brianwilkerson) Add support for other kinds of declarations.
|
||||
// TODO(brianwilkerson): Add support for other kinds of declarations.
|
||||
case MethodDeclaration declaration:
|
||||
if (declaration.body.isFullySynthetic) {
|
||||
keywordHelper.addFunctionBodyModifiers(declaration.body);
|
||||
@@ -1684,7 +1684,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
// duplicating code, but the offset will be past where the parser
|
||||
// inserted sythetic tokens, preventing that from working.
|
||||
switch (precedingStatement) {
|
||||
// TODO(brianwilkerson) Add support for other kinds of declarations.
|
||||
// TODO(brianwilkerson): Add support for other kinds of declarations.
|
||||
case IfStatement declaration:
|
||||
if (declaration.elseKeyword == null) {
|
||||
keywordHelper.addKeyword(Keyword.ELSE);
|
||||
@@ -1729,7 +1729,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
void _forTypeAnnotation() {
|
||||
keywordHelper.addKeyword(Keyword.DYNAMIC);
|
||||
keywordHelper.addKeyword(Keyword.VOID);
|
||||
// TODO(brianwilkerson) Suggest the types available in the current scope.
|
||||
// TODO(brianwilkerson): Suggest the types available in the current scope.
|
||||
// _addTypesInScope();
|
||||
}
|
||||
|
||||
@@ -1737,7 +1737,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
/// beginning of a variable pattern.
|
||||
void _forVariablePattern() {
|
||||
keywordHelper.addVariablePatternKeywords();
|
||||
// TODO(brianwilkerson) Suggest the types available in the current scope.
|
||||
// TODO(brianwilkerson): Suggest the types available in the current scope.
|
||||
// _addTypesInScope();
|
||||
}
|
||||
|
||||
@@ -1751,7 +1751,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
// code, but in some cases the offset will be past where the parser inserted
|
||||
// sythetic tokens, preventing that from working.
|
||||
switch (precedingMember) {
|
||||
// TODO(brianwilkerson) Add support for other kinds of declarations.
|
||||
// TODO(brianwilkerson): Add support for other kinds of declarations.
|
||||
case ClassDeclaration declaration:
|
||||
if (declaration.hasNoBody) {
|
||||
keywordHelper.addClassDeclarationKeywords(declaration);
|
||||
|
||||
@@ -105,11 +105,11 @@ class KeywordHelper {
|
||||
/// beginning of an element in a collection [literal].
|
||||
void addCollectionElementKeywords(
|
||||
TypedLiteral literal, NodeList<CollectionElement> elements) {
|
||||
// TODO(brianwilkerson) Consider determining whether there is a comma before
|
||||
// TODO(brianwilkerson): Consider determining whether there is a comma before
|
||||
// the selection and inserting the comma if there isn't one.
|
||||
addKeyword(Keyword.FOR);
|
||||
addKeyword(Keyword.IF);
|
||||
// TODO(brianwilkerson) Consider replacing the lines above with the
|
||||
// TODO(brianwilkerson): Consider replacing the lines above with the
|
||||
// following lines:
|
||||
// addKeywordFromText(Keyword.FOR, ' (^)');
|
||||
// addKeywordFromText(Keyword.IF, ' (^)');
|
||||
@@ -163,7 +163,7 @@ class KeywordHelper {
|
||||
/// beginning of a constant expression. The flag [inConstantContext] should be
|
||||
/// `true` if the expression is inside a constant context.
|
||||
void addConstantExpressionKeywords({required bool inConstantContext}) {
|
||||
// TODO(brianwilkerson) Use this method in place of `addExpressionKeywords`
|
||||
// TODO(brianwilkerson): Use this method in place of `addExpressionKeywords`
|
||||
// when in a constant context in order to not suggest invalid keywords.
|
||||
addKeyword(Keyword.FALSE);
|
||||
addKeyword(Keyword.NULL);
|
||||
@@ -201,7 +201,7 @@ class KeywordHelper {
|
||||
/// beginning of a directive in a compilation unit. The [before] directive is
|
||||
/// the directive before the one being added.
|
||||
void addDirectiveKeywords(CompilationUnit unit, Directive? before) {
|
||||
// TODO(brianwilkerson) If we had both the members before and after the new
|
||||
// TODO(brianwilkerson): If we had both the members before and after the new
|
||||
// directive, we could limit the keywords based on surrounding members.
|
||||
if (before == null && !unit.directives.any((d) => d is LibraryDirective)) {
|
||||
addKeyword(Keyword.LIBRARY);
|
||||
@@ -364,7 +364,7 @@ class KeywordHelper {
|
||||
}
|
||||
var fields = node.fields;
|
||||
if (fields.type == null) {
|
||||
// TODO(brianwilkerson) We should probably not suggest types if `var` is
|
||||
// TODO(brianwilkerson): We should probably not suggest types if `var` is
|
||||
// being used.
|
||||
addKeyword(Keyword.DYNAMIC);
|
||||
addKeyword(Keyword.VOID);
|
||||
|
||||
@@ -191,7 +191,7 @@ class LibraryElementSuggestionBuilder extends GeneralizingElementVisitor<void> {
|
||||
final typeSystem = request.libraryElement.typeSystem;
|
||||
final contextType = request.contextType;
|
||||
if (contextType is InterfaceType) {
|
||||
// TODO(scheglov) This looks not ideal - we should suggest getters.
|
||||
// TODO(scheglov): This looks not ideal - we should suggest getters.
|
||||
for (final field in element.fields) {
|
||||
if (field.isStatic &&
|
||||
field.isAccessibleIn(request.libraryElement) &&
|
||||
|
||||
+1
-1
@@ -365,7 +365,7 @@ class _LocalVisitor extends LocalDeclarationVisitor {
|
||||
final typeSystem = request.libraryElement.typeSystem;
|
||||
final contextType = request.contextType;
|
||||
if (contextType is InterfaceType) {
|
||||
// TODO(scheglov) This looks not ideal - we should suggest getters.
|
||||
// TODO(scheglov): This looks not ideal - we should suggest getters.
|
||||
for (final field in element.fields) {
|
||||
if (field.isStatic &&
|
||||
typeSystem.isSubtypeOf(field.type, contextType)) {
|
||||
|
||||
@@ -112,7 +112,7 @@ class MemberSuggestionBuilder {
|
||||
|
||||
/// Return `true` if a suggestion for the given [element] should be created.
|
||||
bool _shouldAddSuggestion(Element element) {
|
||||
// TODO(brianwilkerson) Consider moving this into SuggestionBuilder.
|
||||
// TODO(brianwilkerson): Consider moving this into SuggestionBuilder.
|
||||
var identifier = element.displayName;
|
||||
|
||||
var alreadyGenerated = _completionTypesGenerated.putIfAbsent(
|
||||
@@ -194,7 +194,7 @@ class SuggestionBuilder {
|
||||
/// A flag indicating whether a suggestion should replace any earlier
|
||||
/// suggestions for the same completion (`true`) or whether earlier
|
||||
/// suggestions should take priority over more recent suggestions.
|
||||
// TODO(brianwilkerson) Attempt to convert the contributors so that a single
|
||||
// TODO(brianwilkerson): Attempt to convert the contributors so that a single
|
||||
// approach is followed.
|
||||
bool laterReplacesEarlier = true;
|
||||
|
||||
@@ -572,7 +572,7 @@ class SuggestionBuilder {
|
||||
|
||||
/// Add a suggestion to reference a [field] in a field formal parameter.
|
||||
void suggestFieldFormalParameter(FieldElement field) {
|
||||
// TODO(brianwilkerson) Add a parameter (`bool includePrefix`) indicating
|
||||
// TODO(brianwilkerson): Add a parameter (`bool includePrefix`) indicating
|
||||
// whether to include the `this.` prefix in the completion.
|
||||
_addBuilder(
|
||||
_createCompletionSuggestionBuilder(
|
||||
@@ -656,7 +656,7 @@ class SuggestionBuilder {
|
||||
/// Add a suggestion for a [label].
|
||||
void suggestLabel(Label label) {
|
||||
var completion = label.label.name;
|
||||
// TODO(brianwilkerson) Figure out why we're excluding labels consisting of
|
||||
// TODO(brianwilkerson): Figure out why we're excluding labels consisting of
|
||||
// a single underscore.
|
||||
if (completion.isNotEmpty && completion != '_') {
|
||||
var suggestion = CompletionSuggestion(CompletionSuggestionKind.IDENTIFIER,
|
||||
@@ -670,7 +670,7 @@ class SuggestionBuilder {
|
||||
/// Add a suggestion for the `loadLibrary` [function] associated with a
|
||||
/// prefix.
|
||||
void suggestLoadLibraryFunction(FunctionElement function) {
|
||||
// TODO(brianwilkerson) This might want to use the context type rather than
|
||||
// TODO(brianwilkerson): This might want to use the context type rather than
|
||||
// a fixed value.
|
||||
var relevance = Relevance.loadLibrary;
|
||||
_addBuilder(
|
||||
@@ -720,7 +720,7 @@ class SuggestionBuilder {
|
||||
void suggestMethod(MethodElement method,
|
||||
{required CompletionSuggestionKind kind,
|
||||
required double inheritanceDistance}) {
|
||||
// TODO(brianwilkerson) Refactor callers so that we're passing in the type
|
||||
// TODO(brianwilkerson): Refactor callers so that we're passing in the type
|
||||
// of the target (assuming we don't already have that type available via
|
||||
// the [request]) and compute the [inheritanceDistance] in this method.
|
||||
var featureComputer = request.featureComputer;
|
||||
@@ -753,7 +753,7 @@ class SuggestionBuilder {
|
||||
if (method.name == 'setState' &&
|
||||
enclosingElement is ClassElement &&
|
||||
flutter.isExactState(enclosingElement)) {
|
||||
// TODO(brianwilkerson) Make this more efficient by creating the correct
|
||||
// TODO(brianwilkerson): Make this more efficient by creating the correct
|
||||
// suggestion in the first place.
|
||||
// Find the line indentation.
|
||||
var indent = getRequestLineIndent(request);
|
||||
@@ -796,7 +796,7 @@ class SuggestionBuilder {
|
||||
|
||||
/// Add a suggestion to use the [name] at a declaration site.
|
||||
void suggestName(String name) {
|
||||
// TODO(brianwilkerson) Explore whether there are any features of the name
|
||||
// TODO(brianwilkerson): Explore whether there are any features of the name
|
||||
// that can be used to provide better relevance scores.
|
||||
_addSuggestion(CompletionSuggestion(CompletionSuggestionKind.IDENTIFIER,
|
||||
500, name, name.length, 0, false, false));
|
||||
@@ -821,7 +821,7 @@ class SuggestionBuilder {
|
||||
var selectionOffset = completion.length;
|
||||
|
||||
// Optionally add Flutter child widget details.
|
||||
// todo (pq): revisit this special casing; likely it can be generalized away
|
||||
// TODO(pq): revisit this special casing; likely it can be generalized away
|
||||
var element = parameter.enclosingElement;
|
||||
// If appendColon is false, default values should never be appended.
|
||||
if (element is ConstructorElement && appendColon) {
|
||||
@@ -989,7 +989,7 @@ class SuggestionBuilder {
|
||||
/// Add a suggestion for a [parameter].
|
||||
void suggestParameter(ParameterElement parameter) {
|
||||
var variableType = parameter.type;
|
||||
// TODO(brianwilkerson) Use the distance to the declaring function as
|
||||
// TODO(brianwilkerson): Use the distance to the declaring function as
|
||||
// another feature.
|
||||
var contextType = request.featureComputer
|
||||
.contextTypeFeature(request.contextType, variableType);
|
||||
@@ -1015,7 +1015,7 @@ class SuggestionBuilder {
|
||||
/// Add a suggestion for a [prefix] associated with a [library].
|
||||
void suggestPrefix(LibraryElement library, String prefix) {
|
||||
var elementKind = _computeElementKind(library);
|
||||
// TODO(brianwilkerson) If we are in a constant context it would be nice
|
||||
// TODO(brianwilkerson): If we are in a constant context it would be nice
|
||||
// to promote prefixes for libraries that define constants, but that
|
||||
// might be more work than it's worth.
|
||||
var relevance = _computeRelevance(
|
||||
@@ -1273,7 +1273,7 @@ class SuggestionBuilder {
|
||||
var key = suggestion.key;
|
||||
listener?.builtSuggestion(suggestion);
|
||||
if (laterReplacesEarlier || !_suggestionMap.containsKey(key)) {
|
||||
// TODO(brianwilkerson) Add some specific tests of shadowing behavior.
|
||||
// TODO(brianwilkerson): Add some specific tests of shadowing behavior.
|
||||
if (suggestion is _CompletionSuggestionBuilderImpl) {
|
||||
// We need to special-case constructors because the order in which
|
||||
// suggestions are added has been changed by the move to
|
||||
@@ -1384,7 +1384,7 @@ class SuggestionBuilder {
|
||||
/// Return the relevance score for a top-level [element].
|
||||
int _computeTopLevelRelevance(Element element,
|
||||
{required DartType elementType}) {
|
||||
// TODO(brianwilkerson) The old relevance computation used a signal based
|
||||
// TODO(brianwilkerson): The old relevance computation used a signal based
|
||||
// on whether the element being suggested was from the same library in
|
||||
// which completion is being performed. Explore whether that's a useful
|
||||
// signal.
|
||||
@@ -1729,7 +1729,7 @@ class _CompletionSuggestionBuilderImpl implements CompletionSuggestionBuilder {
|
||||
required this.isNotImported,
|
||||
});
|
||||
|
||||
/// TODO(scheglov) implement better key for not-yet-imported
|
||||
// TODO(scheglov): implement better key for not-yet-imported
|
||||
@override
|
||||
String get key {
|
||||
var key = completion;
|
||||
|
||||
@@ -18,7 +18,7 @@ class SuggestionCollector {
|
||||
|
||||
/// Add the candidate [suggestion] to the list of suggestions.
|
||||
void addSuggestion(CandidateSuggestion suggestion) {
|
||||
// TODO(brianwilkerson) This potentially needs to handle shadowed names.
|
||||
// TODO(brianwilkerson): This potentially needs to handle shadowed names.
|
||||
suggestions.add(suggestion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class TypeMemberContributor extends DartCompletionContributor {
|
||||
expression is ExtensionOverride) {
|
||||
var containingNode = request.target.containingNode;
|
||||
if (containingNode is ObjectPattern) {
|
||||
// TODO(brianwilkerson) This is really only intended to be reached when
|
||||
// TODO(brianwilkerson): This is really only intended to be reached when
|
||||
// `expression` is `null`. It's not ideal that we're using this
|
||||
// contributor this way, and we should look into better ways to
|
||||
// structure the code.
|
||||
|
||||
@@ -95,7 +95,7 @@ CompletionDefaultArgumentList computeCompletionDefaultArgumentList(
|
||||
var rangeStart = offset;
|
||||
int rangeLength;
|
||||
|
||||
// todo (pq): consider adding ranges for params
|
||||
// TODO(pq): consider adding ranges for params
|
||||
// pending: https://github.com/dart-lang/sdk/issues/40207
|
||||
// (types in closure param completions make this UX awkward)
|
||||
final parametersString = buildClosureParameters(parameterType);
|
||||
@@ -103,7 +103,7 @@ CompletionDefaultArgumentList computeCompletionDefaultArgumentList(
|
||||
|
||||
blockBuffer.write(' ');
|
||||
|
||||
// todo (pq): consider refactoring to share common logic w/
|
||||
// TODO(pq): consider refactoring to share common logic w/
|
||||
// ArgListContributor.buildClosureSuggestions
|
||||
final returnType = parameterType.returnType;
|
||||
if (returnType is VoidType) {
|
||||
@@ -156,7 +156,7 @@ protocol.Element createLocalElement(
|
||||
bool isAbstract = false,
|
||||
bool isDeprecated = false}) {
|
||||
var name = id.name;
|
||||
// TODO(danrubel) use lineInfo to determine startLine and startColumn
|
||||
// TODO(danrubel): use lineInfo to determine startLine and startColumn
|
||||
var location = Location(source.fullName, id.offset, id.length, 0, 0,
|
||||
endLine: 0, endColumn: 0);
|
||||
var flags = protocol.Element.makeFlags(
|
||||
|
||||
@@ -107,7 +107,7 @@ class StatementCompletionProcessor {
|
||||
final StatementCompletionContext statementContext;
|
||||
final CorrectionUtils utils;
|
||||
|
||||
/// TODO(brianwilkerson) Refactor the code so that the completion is returned
|
||||
// TODO(brianwilkerson): Refactor the code so that the completion is returned
|
||||
/// from the methods in which it's computed rather than being a field that we
|
||||
/// have to test.
|
||||
StatementCompletion? completion;
|
||||
@@ -206,7 +206,7 @@ class StatementCompletionProcessor {
|
||||
|
||||
void _addReplaceEdit(SourceRange range, String text) {
|
||||
var edit = SourceEdit(range.offset, range.length, text);
|
||||
// TODO(brianwilkerson) The commented out function call has been inlined in
|
||||
// TODO(brianwilkerson): The commented out function call has been inlined in
|
||||
// order to work around a situation in which _complete_doStatement creates
|
||||
// a conflicting edit that happens to work because of the order in which
|
||||
// the edits are applied. The implementation needs to be cleaned up in
|
||||
@@ -408,7 +408,7 @@ class StatementCompletionProcessor {
|
||||
} else {
|
||||
insertOffset = expr.end;
|
||||
}
|
||||
//TODO(messick) Uncomment the following line when error location is fixed.
|
||||
// TODO(messick): Uncomment the following line when error location is fixed.
|
||||
//insertOffset = error.offset + error.length;
|
||||
_addInsertEdit(insertOffset, ';');
|
||||
delta = 1;
|
||||
@@ -897,7 +897,7 @@ class StatementCompletionProcessor {
|
||||
var error = _findError(ParserErrorCode.EXPECTED_TOKEN, partialMatch: "';'");
|
||||
if (error != null) {
|
||||
var previousInsertions = _lengthOfInsertions();
|
||||
// TODO(messick) Fix this to find the correct place in all cases.
|
||||
// TODO(messick): Fix this to find the correct place in all cases.
|
||||
var insertOffset = error.offset + error.length;
|
||||
_addInsertEdit(insertOffset, ';');
|
||||
var offset = _appendNewlinePlusIndent() + 1 /*';'*/ + previousInsertions;
|
||||
|
||||
+4
-4
@@ -17,7 +17,7 @@ import 'package:analyzer/src/task/options.dart';
|
||||
class AnalysisOptionsGenerator extends YamlCompletionGenerator {
|
||||
/// The producer representing the known valid structure of an analysis options
|
||||
/// file.
|
||||
// TODO(brianwilkerson) We need to support multiple valid formats.
|
||||
// TODO(brianwilkerson): We need to support multiple valid formats.
|
||||
// For example, the lint rules can either be a list or a map, but we only
|
||||
// suggest list items.
|
||||
static MapProducer analysisOptionsProducer = MapProducer({
|
||||
@@ -39,9 +39,9 @@ class AnalysisOptionsGenerator extends YamlCompletionGenerator {
|
||||
AnalyzerOptions.codeStyle: MapProducer({
|
||||
AnalyzerOptions.format: BooleanProducer(),
|
||||
}),
|
||||
// TODO(brianwilkerson) Create a producer to produce `package:` URIs.
|
||||
// TODO(brianwilkerson): Create a producer to produce `package:` URIs.
|
||||
AnalyzerOptions.include: EmptyProducer(),
|
||||
// TODO(brianwilkerson) Create constants for 'linter' and 'rules'.
|
||||
// TODO(brianwilkerson): Create constants for 'linter' and 'rules'.
|
||||
'linter': MapProducer({
|
||||
'rules': ListProducer(_LintRuleProducer()),
|
||||
}),
|
||||
@@ -104,7 +104,7 @@ class _LintRuleProducer extends Producer {
|
||||
Iterable<CompletionSuggestion> suggestions(
|
||||
YamlCompletionRequest request) sync* {
|
||||
for (var rule in Registry.ruleRegistry.rules) {
|
||||
// todo(pq): consider suggesting internal lints if editing an SDK options file
|
||||
// TODO(pq): consider suggesting internal lints if editing an SDK options file
|
||||
if (!rule.state.isInternal) {
|
||||
yield identifier(rule.name);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class FixDataGenerator extends YamlCompletionGenerator {
|
||||
|
||||
/// The producer representing the known valid structure of a list of changes.
|
||||
static const ListProducer _changesProducer = ListProducer(MapProducer({
|
||||
// TODO(brianwilkerson) Create a way to tailor the list of additional
|
||||
// TODO(brianwilkerson): Create a way to tailor the list of additional
|
||||
// keys based on the kind when a kind has already been provided.
|
||||
'kind': EnumProducer([
|
||||
'addParameter',
|
||||
@@ -44,7 +44,7 @@ class FixDataGenerator extends YamlCompletionGenerator {
|
||||
'argumentValue': MapProducer({
|
||||
'expression': EmptyProducer(),
|
||||
'requiredIf': EmptyProducer(),
|
||||
// TODO(brianwilkerson) Figure out how to support 'variables'.
|
||||
// TODO(brianwilkerson): Figure out how to support 'variables'.
|
||||
'variables': EmptyProducer(),
|
||||
}),
|
||||
'extends': EmptyProducer(),
|
||||
@@ -55,7 +55,7 @@ class FixDataGenerator extends YamlCompletionGenerator {
|
||||
|
||||
/// The producer representing the known valid structure of an element.
|
||||
static const MapProducer _elementProducer = MapProducer({
|
||||
// TODO(brianwilkerson) Support suggesting uris.
|
||||
// TODO(brianwilkerson): Support suggesting uris.
|
||||
'uris': EmptyProducer(),
|
||||
'class': EmptyProducer(),
|
||||
'constant': EmptyProducer(),
|
||||
|
||||
@@ -132,7 +132,7 @@ class ListProducer extends Producer {
|
||||
Iterable<CompletionSuggestion> suggestions(
|
||||
YamlCompletionRequest request) sync* {
|
||||
for (var suggestion in element.suggestions(request)) {
|
||||
// TODO(brianwilkerson) Consider prepending the suggestion with a hyphen
|
||||
// TODO(brianwilkerson): Consider prepending the suggestion with a hyphen
|
||||
// when the current node isn't already preceded by a hyphen. The
|
||||
// cleanest way to do this is probably to access the [element] producer
|
||||
// in the place where we're choosing a producer in that situation.
|
||||
|
||||
@@ -79,7 +79,7 @@ class PubspecGenerator extends YamlCompletionGenerator {
|
||||
}),
|
||||
'dependencies': PubPackageNameProducer(),
|
||||
'dev_dependencies': PubPackageNameProducer(),
|
||||
// TODO(brianwilkerson) Suggest names already listed under 'dependencies'
|
||||
// TODO(brianwilkerson): Suggest names already listed under 'dependencies'
|
||||
// and 'dev_dependencies'.
|
||||
'dependency_overrides': EmptyProducer(),
|
||||
'flutter': MapProducer({
|
||||
|
||||
@@ -347,7 +347,7 @@ class DartAssistKind {
|
||||
'Join variable declaration',
|
||||
);
|
||||
static const REMOVE_TYPE_ANNOTATION = AssistKind(
|
||||
// todo (pq): unify w/ fix
|
||||
// TODO(pq): unify w/ fix
|
||||
'dart.assist.remove.typeAnnotation',
|
||||
DartAssistKindPriority.PRIORITY,
|
||||
'Remove type annotation',
|
||||
|
||||
@@ -93,12 +93,12 @@ class BulkFixProcessor {
|
||||
CompileTimeErrorCode.EXTENDS_NON_CLASS: [
|
||||
DataDriven.new,
|
||||
],
|
||||
// TODO(brianwilkerson) The following fix fails if an invocation of the
|
||||
// TODO(brianwilkerson): The following fix fails if an invocation of the
|
||||
// function is the argument that needs to be removed.
|
||||
// CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS: [
|
||||
// DataDriven.newInstance,
|
||||
// ],
|
||||
// TODO(brianwilkerson) The following fix fails if an invocation of the
|
||||
// TODO(brianwilkerson): The following fix fails if an invocation of the
|
||||
// function is the argument that needs to be updated.
|
||||
// CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED: [
|
||||
// DataDriven.newInstance,
|
||||
|
||||
@@ -136,7 +136,7 @@ class CorrectionProducerContext<UnitResult extends ParsedUnitResult> {
|
||||
final UnitResult unitResult;
|
||||
final ChangeWorkspace workspace;
|
||||
|
||||
/// TODO(migration) Make it non-nullable, specialize "fix" context?
|
||||
// TODO(migration): Make it non-nullable, specialize "fix" context?
|
||||
final DartFixContext? dartFixContext;
|
||||
|
||||
/// A flag indicating whether the correction producers will be run in the
|
||||
@@ -257,7 +257,7 @@ class CorrectionProducerContext<UnitResult extends ParsedUnitResult> {
|
||||
|
||||
abstract class CorrectionProducerWithDiagnostic
|
||||
extends ResolvedCorrectionProducer {
|
||||
/// TODO(migration) Consider providing it via constructor.
|
||||
// TODO(migration): Consider providing it via constructor.
|
||||
@override
|
||||
Diagnostic get diagnostic => super.diagnostic!;
|
||||
}
|
||||
@@ -514,7 +514,7 @@ abstract class ResolvedCorrectionProducer
|
||||
/// The behavior shared by [ResolvedCorrectionProducer] and [MultiCorrectionProducer].
|
||||
abstract class _AbstractCorrectionProducer<T extends ParsedUnitResult> {
|
||||
/// The context used to produce corrections.
|
||||
/// TODO(migration) Make it not `late`, require in constructor.
|
||||
// TODO(migration): Make it not `late`, require in constructor.
|
||||
late CorrectionProducerContext<T> _context;
|
||||
|
||||
/// The most deeply nested node that completely covers the highlight region of
|
||||
@@ -533,7 +533,7 @@ abstract class _AbstractCorrectionProducer<T extends ParsedUnitResult> {
|
||||
/// the diagnostic, or `null` if there is no diagnostic or if such a node does
|
||||
/// not exist.
|
||||
AstNode? get coveredNode {
|
||||
// TODO(brianwilkerson) Consider renaming this to `coveringNode`.
|
||||
// TODO(brianwilkerson): Consider renaming this to `coveringNode`.
|
||||
if (_coveredNode == null) {
|
||||
final diagnostic = this.diagnostic;
|
||||
if (diagnostic == null) {
|
||||
@@ -719,7 +719,7 @@ abstract class _AbstractCorrectionProducer<T extends ParsedUnitResult> {
|
||||
extension DartFileEditBuilderExtension on DartFileEditBuilder {
|
||||
/// Add edits to the [builder] to remove any parentheses enclosing the
|
||||
/// [expression].
|
||||
// TODO(brianwilkerson) Consider moving this to DartFileEditBuilder.
|
||||
// TODO(brianwilkerson): Consider moving this to DartFileEditBuilder.
|
||||
void removeEnclosingParentheses(Expression expression) {
|
||||
var precedence = getExpressionPrecedence(expression);
|
||||
while (expression.parent is ParenthesizedExpression) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar
|
||||
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
|
||||
|
||||
class AddAsync extends ResolvedCorrectionProducer {
|
||||
// todo(pq): consider adding a variation that adds an `await` as well
|
||||
// TODO(pq): consider adding a variation that adds an `await` as well
|
||||
|
||||
/// A flag indicating whether this producer is producing a fix in the case
|
||||
/// where a function is missing a return at the end.
|
||||
|
||||
@@ -183,7 +183,7 @@ class AddKeyToConstructors extends ResolvedCorrectionProducer {
|
||||
if (constructor.factoryKeyword != null ||
|
||||
constructor.redirectedConstructor != null) {
|
||||
// Can't have a super constructor invocation.
|
||||
// TODO(brianwilkerson) Consider extending the redirected constructor to
|
||||
// TODO(brianwilkerson): Consider extending the redirected constructor to
|
||||
// also take a key, or finding the constructor invocation in the body of
|
||||
// the factory and updating it.
|
||||
return;
|
||||
|
||||
@@ -31,7 +31,7 @@ class AddLate extends ResolvedCorrectionProducer {
|
||||
var keyword = variableList.keyword;
|
||||
if (keyword == null) {
|
||||
await _insertAt(builder, variableList.variables[0].offset);
|
||||
// TODO(brianwilkerson) Consider converting this into an assist and
|
||||
// TODO(brianwilkerson): Consider converting this into an assist and
|
||||
// expand it to support converting `var` to `late` as well as
|
||||
// working anywhere a non-late local variable or field is selected.
|
||||
// } else if (keyword.type == Keyword.VAR) {
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ class AddMissingEnumCaseClauses extends ResolvedCorrectionProducer {
|
||||
? statement.rightParenthesis.end
|
||||
: location.offset;
|
||||
await builder.addDartFileEdit(file, (builder) {
|
||||
// TODO(brianwilkerson) Consider inserting the names in order into the
|
||||
// TODO(brianwilkerson): Consider inserting the names in order into the
|
||||
// switch statement.
|
||||
builder.addInsertion(insertionOffset, (builder) {
|
||||
void addMissingCase(String expression) {
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ class AddMissingEnumLikeCaseClauses extends ResolvedCorrectionProducer {
|
||||
@override
|
||||
FixKind get fixKind => DartFixKind.ADD_MISSING_ENUM_CASE_CLAUSES;
|
||||
|
||||
// TODO: Consider enabling this lint for fix all in file.
|
||||
// TODO(brianwilkerson): Consider enabling this lint for fix all in file.
|
||||
// @override
|
||||
// FixKind? get multiFixKind => super.multiFixKind;
|
||||
|
||||
@@ -42,7 +42,7 @@ class AddMissingEnumLikeCaseClauses extends ResolvedCorrectionProducer {
|
||||
);
|
||||
|
||||
await builder.addDartFileEdit(file, (builder) {
|
||||
// TODO(brianwilkerson) Consider inserting the names in order into the
|
||||
// TODO(brianwilkerson): Consider inserting the names in order into the
|
||||
// switch statement.
|
||||
builder.addInsertion(location.offset, (builder) {
|
||||
builder.write(location.prefix);
|
||||
|
||||
@@ -31,7 +31,7 @@ class AddOverride extends ResolvedCorrectionProducer {
|
||||
return;
|
||||
}
|
||||
|
||||
//TODO(pq): migrate annotation edit building to change_builder
|
||||
// TODO(pq): migrate annotation edit building to change_builder
|
||||
|
||||
// Handle doc comments.
|
||||
var token = member.beginToken;
|
||||
|
||||
@@ -125,7 +125,7 @@ class AddReturnType extends ResolvedCorrectionProducer {
|
||||
|
||||
/// Copied from lib/src/services/refactoring/extract_method.dart", but
|
||||
/// [hasReturn] was added.
|
||||
// TODO(brianwilkerson) Decide whether to unify the two classes.
|
||||
// TODO(brianwilkerson): Decide whether to unify the two classes.
|
||||
class _ReturnTypeComputer extends RecursiveAstVisitor<void> {
|
||||
final TypeSystem typeSystem;
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ class AddTypeAnnotation extends ResolvedCorrectionProducer {
|
||||
}
|
||||
// Prepare the type.
|
||||
var type = parameter.declaredElement!.type;
|
||||
// TODO(scheglov) If the parameter is in a method declaration, and if the
|
||||
// TODO(scheglov): If the parameter is in a method declaration, and if the
|
||||
// method overrides a method that has a type for the corresponding
|
||||
// parameter, it would be nice to copy down the type from the overridden
|
||||
// method.
|
||||
|
||||
@@ -35,7 +35,7 @@ class ChangeArgumentName extends MultiCorrectionProducer {
|
||||
for (var proposedName in names) {
|
||||
var distance = _computeDistance(currentName, proposedName);
|
||||
if (distance <= _maxDistance) {
|
||||
// TODO(brianwilkerson) Create a way to use the distance as part of the
|
||||
// TODO(brianwilkerson): Create a way to use the distance as part of the
|
||||
// computation of the priority (so that closer names sort first).
|
||||
producers.add(_ChangeName(currentNameNode, proposedName));
|
||||
}
|
||||
|
||||
@@ -56,9 +56,9 @@ class ChangeTo extends ResolvedCorrectionProducer {
|
||||
|
||||
@override
|
||||
Future<void> compute(ChangeBuilder builder) async {
|
||||
// TODO(brianwilkerson) Unify these separate methods as much as is
|
||||
// TODO(brianwilkerson): Unify these separate methods as much as is
|
||||
// reasonably possible.
|
||||
// TODO(brianwilkerson) Consider proposing all of the names within a
|
||||
// TODO(brianwilkerson): Consider proposing all of the names within a
|
||||
// reasonable distance, rather than just the first near match we find.
|
||||
if (_kind == _ReplacementKind.annotation) {
|
||||
await _proposeAnnotation(builder);
|
||||
|
||||
@@ -74,7 +74,7 @@ class ConvertAddAllToSpread extends ResolvedCorrectionProducer {
|
||||
var sections = cascade.cascadeSections;
|
||||
var targetList = cascade.target;
|
||||
if (targetList is! ListLiteral || sections[0] != invocation) {
|
||||
// TODO(brianwilkerson) Consider extending this to handle set literals.
|
||||
// TODO(brianwilkerson): Consider extending this to handle set literals.
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ class ConvertAddAllToSpread extends ResolvedCorrectionProducer {
|
||||
// ..addAll([ ... ])
|
||||
var elements = argument.elements;
|
||||
if (elements.isEmpty) {
|
||||
// TODO(brianwilkerson) Consider adding a cleanup for the empty list
|
||||
// TODO(brianwilkerson): Consider adding a cleanup for the empty list
|
||||
// case. We can essentially remove the whole invocation because it does
|
||||
// nothing.
|
||||
return;
|
||||
|
||||
@@ -614,7 +614,7 @@ class _EnumDescription {
|
||||
if (list.length == 1) {
|
||||
fieldsToConvert.add(list[0]);
|
||||
} else {
|
||||
// TODO(brianwilkerson) We could potentially handle the case where
|
||||
// TODO(brianwilkerson): We could potentially handle the case where
|
||||
// there's only one non-deprecated field in the list. We'd need to
|
||||
// change the return type for this method so that we could return two
|
||||
// lists: the list of fields to convert and the list of fields whose
|
||||
|
||||
@@ -82,7 +82,7 @@ class ConvertIntoForIndex extends ResolvedCorrectionProducer {
|
||||
var firstBlockLine = utils.getLineContentEnd(body.leftBracket.end);
|
||||
// add change
|
||||
await builder.addDartFileEdit(file, (builder) {
|
||||
// TODO(brianwilkerson) Create linked positions for the loop variable.
|
||||
// TODO(brianwilkerson): Create linked positions for the loop variable.
|
||||
builder.addSimpleReplacement(
|
||||
range.startEnd(forStatement, forStatement.rightParenthesis),
|
||||
'for (int $indexName = 0; $indexName < $listName.length; $indexName++)');
|
||||
|
||||
+16
-14
@@ -37,8 +37,8 @@ class ConvertToExpressionFunctionBody extends ResolvedCorrectionProducer {
|
||||
if (body.keyword?.precedingComments != null ||
|
||||
body.block.leftBracket.precedingComments != null ||
|
||||
body.block.rightBracket.precedingComments != null) {
|
||||
// TODO(https://github.com/dart-lang/sdk/issues/29313): Include comments
|
||||
// in fixed output.
|
||||
// TODO(srawlins): Include comments in fixed output.
|
||||
// https://github.com/dart-lang/sdk/issues/29313
|
||||
return;
|
||||
}
|
||||
var parent = body.parent;
|
||||
@@ -56,28 +56,30 @@ class ConvertToExpressionFunctionBody extends ResolvedCorrectionProducer {
|
||||
if (onlyStatement is ReturnStatement) {
|
||||
returnExpression = onlyStatement.expression;
|
||||
if (onlyStatement.returnKeyword.precedingComments != null) {
|
||||
// TODO(https://github.com/dart-lang/sdk/issues/29313): Include comments
|
||||
// in fixed output.
|
||||
// TODO(srawlins): Include comments in fixed output.
|
||||
// https://github.com/dart-lang/sdk/issues/29313
|
||||
return;
|
||||
}
|
||||
// TODO(https://github.com/dart-lang/sdk/issues/29313): If there are
|
||||
// comments after `return` keyword, before the expression, either return
|
||||
// without offering a fix, or include the comments in the fixed output.
|
||||
// TODO(srawlins): If there are comments after `return` keyword, before
|
||||
// the expression, either return without offering a fix, or include the
|
||||
// comments in the fixed output.
|
||||
// https://github.com/dart-lang/sdk/issues/29313
|
||||
|
||||
if (onlyStatement.semicolon.precedingComments != null) {
|
||||
// TODO(https://github.com/dart-lang/sdk/issues/29313): Include
|
||||
// comments in fixed output.
|
||||
// TODO(srawlins): Include comments in fixed output.
|
||||
// https://github.com/dart-lang/sdk/issues/29313
|
||||
return;
|
||||
}
|
||||
} else if (onlyStatement is ExpressionStatement) {
|
||||
returnExpression = onlyStatement.expression;
|
||||
// TODO(https://github.com/dart-lang/sdk/issues/29313): If there are
|
||||
// comments before the expression, either return without offering a fix,
|
||||
// or include the comments in the fixed output.
|
||||
// TODO(srawlins): If there are comments before the expression,
|
||||
// either return without offering a fix, or include the comments in the
|
||||
// fixed output.
|
||||
// https://github.com/dart-lang/sdk/issues/29313
|
||||
|
||||
if (onlyStatement.semicolon?.precedingComments != null) {
|
||||
// TODO(https://github.com/dart-lang/sdk/issues/29313): Include comments
|
||||
// in fixed output.
|
||||
// TODO(srawlins): Include comments in fixed output.
|
||||
// https://github.com/dart-lang/sdk/issues/29313
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ class ConvertToSetLiteral extends ResolvedCorrectionProducer {
|
||||
elementsRange =
|
||||
range.endStart(elements.leftBracket, elements.rightBracket);
|
||||
} else {
|
||||
// TODO(brianwilkerson) Consider handling other iterables. Literal
|
||||
// TODO(brianwilkerson): Consider handling other iterables. Literal
|
||||
// sets could be treated like lists, and arbitrary iterables by using
|
||||
// a spread.
|
||||
return;
|
||||
@@ -144,7 +144,7 @@ class ConvertToSetLiteral extends ResolvedCorrectionProducer {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO(brianwilkerson) Consider also accepting uses of LinkedHashSet.
|
||||
// TODO(brianwilkerson): Consider also accepting uses of LinkedHashSet.
|
||||
if (type.element != typeProvider.setElement) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+3
-3
@@ -156,7 +156,7 @@ class ConvertToSwitchExpression extends ResolvedCorrectionProducer {
|
||||
|
||||
var memberCount = node.members.length;
|
||||
for (var i = 0; i < memberCount; ++i) {
|
||||
// todo(pq): extract shared replacement logic
|
||||
// TODO(pq): extract shared replacement logic
|
||||
var member = node.members[i];
|
||||
if (member is SwitchDefault) {
|
||||
convertSwitchDefault(builder, member);
|
||||
@@ -215,7 +215,7 @@ class ConvertToSwitchExpression extends ResolvedCorrectionProducer {
|
||||
|
||||
var memberCount = node.members.length;
|
||||
for (var i = 0; i < memberCount; ++i) {
|
||||
// todo(pq): extract shared replacement logic
|
||||
// TODO(pq): extract shared replacement logic
|
||||
var member = node.members[i];
|
||||
if (member is SwitchDefault) {
|
||||
convertSwitchDefault(builder, member);
|
||||
@@ -262,7 +262,7 @@ class ConvertToSwitchExpression extends ResolvedCorrectionProducer {
|
||||
return deletion;
|
||||
}
|
||||
|
||||
// todo(pq): refactor the `is` checks to a single `getSwitchKind`
|
||||
// TODO(pq): refactor the `is` checks to a single `getSwitchKind`
|
||||
// that only looks at members once
|
||||
// see: https://dart-review.googlesource.com/c/sdk/+/287904
|
||||
bool isArgumentSwitch(SwitchStatement node) {
|
||||
|
||||
@@ -32,7 +32,7 @@ class CreateClass extends ResolvedCorrectionProducer {
|
||||
var name = targetNode.name;
|
||||
arguments = targetNode.arguments;
|
||||
if (name.staticElement != null || arguments == null) {
|
||||
// TODO(brianwilkerson) Consider supporting creating a class when the
|
||||
// TODO(brianwilkerson): Consider supporting creating a class when the
|
||||
// arguments are missing by also adding an empty argument list.
|
||||
return;
|
||||
}
|
||||
@@ -138,7 +138,7 @@ class CreateClass extends ResolvedCorrectionProducer {
|
||||
|
||||
static bool _requiresConstConstructor(AstNode node) {
|
||||
final parent = node.parent;
|
||||
// TODO(scheglov) remove after NamedType refactoring.
|
||||
// TODO(scheglov): remove after NamedType refactoring.
|
||||
if (node is SimpleIdentifier && parent is NamedType) {
|
||||
return _requiresConstConstructor(parent);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart';
|
||||
|
||||
class CreateConstructor extends ResolvedCorrectionProducer {
|
||||
/// The name of the constructor being created.
|
||||
/// TODO(migration) We set this node when we have the change.
|
||||
// TODO(migration): We set this node when we have the change.
|
||||
late String _constructorName;
|
||||
|
||||
@override
|
||||
|
||||
@@ -21,11 +21,11 @@ class CreateFile extends ResolvedCorrectionProducer {
|
||||
|
||||
@override
|
||||
Future<void> compute(ChangeBuilder builder) async {
|
||||
// TODO(brianwilkerson) Generalize this to allow other valid string literals.
|
||||
// TODO(brianwilkerson): Generalize this to allow other valid string literals.
|
||||
if (node is SimpleStringLiteral) {
|
||||
var parent = node.parent;
|
||||
if (parent is NamespaceDirective) {
|
||||
// TODO(brianwilkerson) Support the case where the node's parent is a
|
||||
// TODO(brianwilkerson): Support the case where the node's parent is a
|
||||
// Configuration.
|
||||
var source = parent.referencedSource;
|
||||
if (source != null) {
|
||||
|
||||
@@ -26,7 +26,7 @@ class DataDriven extends MultiCorrectionProducer {
|
||||
var importedUris = <Uri>[];
|
||||
var library = unitResult.libraryElement;
|
||||
for (var importElement in library.libraryImports) {
|
||||
// TODO(brianwilkerson) Filter based on combinators to help avoid making
|
||||
// TODO(brianwilkerson): Filter based on combinators to help avoid making
|
||||
// invalid suggestions.
|
||||
var uri = importElement.uri;
|
||||
if (uri is DirectiveUriWithRelativeUri) {
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ class DestructureLocalVariableAssignment extends ResolvedCorrectionProducer {
|
||||
|
||||
Future<void> computeObjectPattern(InterfaceType type,
|
||||
VariableDeclaration node, ChangeBuilder builder) async {
|
||||
// todo(pq): share reference checking w/ record computation
|
||||
// TODO(pq): share reference checking w/ record computation
|
||||
|
||||
var variableElement = node.declaredElement;
|
||||
if (variableElement is! LocalVariableElement) return;
|
||||
|
||||
@@ -26,7 +26,7 @@ class ExtendClassForMixin extends ResolvedCorrectionProducer {
|
||||
|
||||
var declaration = node.thisOrAncestorOfType<ClassDeclaration>();
|
||||
if (declaration != null && declaration.extendsClause == null) {
|
||||
// TODO(brianwilkerson) Find a way to pass in the name of the class
|
||||
// TODO(brianwilkerson): Find a way to pass in the name of the class
|
||||
// without needing to parse the message.
|
||||
var message = diagnostic.problemMessage.messageText(includeUrl: false);
|
||||
var endIndex = message.lastIndexOf("'");
|
||||
|
||||
@@ -18,7 +18,7 @@ class FlutterRemoveWidget extends ResolvedCorrectionProducer {
|
||||
@override
|
||||
AssistKind get assistKind => DartAssistKind.FLUTTER_REMOVE_WIDGET;
|
||||
|
||||
/// todo(pq): find out why overlapping edits are not being applied (and enable)
|
||||
// TODO(pq): find out why overlapping edits are not being applied (and enable)
|
||||
@override
|
||||
bool get canBeAppliedInBulk => false;
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ class ImportLibrary extends MultiCorrectionProducer {
|
||||
if (combinators.length == 1) {
|
||||
var combinator = combinators[0];
|
||||
if (combinator is HideElementCombinator) {
|
||||
// TODO(brianwilkerson) Support removing the extension name from a
|
||||
// TODO(brianwilkerson): Support removing the extension name from a
|
||||
// hide combinator.
|
||||
} else if (combinator is ShowElementCombinator) {
|
||||
producers.add(_ImportLibraryShow(
|
||||
@@ -278,7 +278,7 @@ class ImportLibrary extends MultiCorrectionProducer {
|
||||
if (combinators.length == 1) {
|
||||
var combinator = combinators[0];
|
||||
if (combinator is HideElementCombinator) {
|
||||
// TODO(brianwilkerson) Support removing the element name from a
|
||||
// TODO(brianwilkerson): Support removing the element name from a
|
||||
// hide combinator.
|
||||
} else if (combinator is ShowElementCombinator) {
|
||||
// prepare library name - unit name or 'dart:name' for SDK library
|
||||
|
||||
@@ -59,7 +59,7 @@ class InlineInvocation extends ResolvedCorrectionProducer {
|
||||
var sections = cascade.cascadeSections;
|
||||
var target = cascade.target;
|
||||
if (target is! ListLiteral || sections[0] != invocation) {
|
||||
// TODO(brianwilkerson) Consider extending this to handle set literals.
|
||||
// TODO(brianwilkerson): Consider extending this to handle set literals.
|
||||
return;
|
||||
}
|
||||
var argument = invocation.argumentList.arguments[0];
|
||||
|
||||
@@ -59,7 +59,7 @@ class InlineTypedef extends ResolvedCorrectionProducer {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
// TODO(brianwilkerson) Handle parts.
|
||||
// TODO(brianwilkerson): Handle parts.
|
||||
var finder = _ReferenceFinder(_name);
|
||||
unit.accept(finder);
|
||||
var reference = finder.reference;
|
||||
|
||||
@@ -67,11 +67,11 @@ class MakeFieldPublic extends ResolvedCorrectionProducer {
|
||||
|
||||
extension on DartFileEditBuilder {
|
||||
void removeMember(NodeList<ClassMember> members, ClassMember member) {
|
||||
// TODO(brianwilkerson) Consider moving this to DartFileEditBuilder.
|
||||
// TODO(brianwilkerson): Consider moving this to DartFileEditBuilder.
|
||||
var index = members.indexOf(member);
|
||||
if (index == 0) {
|
||||
if (members.length == 1) {
|
||||
// TODO(brianwilkerson) Remove the whitespace before and after the
|
||||
// TODO(brianwilkerson): Remove the whitespace before and after the
|
||||
// member.
|
||||
addDeletion(range.node(member));
|
||||
} else {
|
||||
|
||||
@@ -27,7 +27,7 @@ class OrganizeImports extends ResolvedCorrectionProducer {
|
||||
Future<void> compute(ChangeBuilder builder) async {
|
||||
var organizer =
|
||||
ImportOrganizer(unitResult.content, unit, unitResult.errors);
|
||||
// todo (pq): consider restructuring organizer to allow a passed-in change
|
||||
// TODO(pq): consider restructuring organizer to allow a passed-in change
|
||||
// builder
|
||||
for (var edit in organizer.organize()) {
|
||||
await builder.addDartFileEdit(file, (builder) {
|
||||
|
||||
@@ -43,7 +43,7 @@ class QualifyReference extends ResolvedCorrectionProducer {
|
||||
var enclosingElement = memberElement.enclosingElement;
|
||||
if (enclosingElement == null ||
|
||||
enclosingElement.library != libraryElement) {
|
||||
// TODO(brianwilkerson) Support qualifying references to members defined
|
||||
// TODO(brianwilkerson): Support qualifying references to members defined
|
||||
// in other libraries. `DartEditBuilder` currently defines the method
|
||||
// `writeType`, which is close, but we also need to handle extensions,
|
||||
// which don't have a type.
|
||||
|
||||
@@ -115,7 +115,7 @@ class RemoveDeadCode extends ResolvedCorrectionProducer {
|
||||
Future<bool> _computeDoStatement(
|
||||
ChangeBuilder builder, DoStatement statement) async {
|
||||
if (statement.hasBreakStatement) {
|
||||
// TODO(asashour) consider modifying the do statement to a label
|
||||
// TODO(asashour): consider modifying the do statement to a label
|
||||
// https://github.com/dart-lang/sdk/issues/49091#issuecomment-1135489675
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class RemoveUnusedElement extends _RemoveUnused {
|
||||
? node.declaredElement!
|
||||
: (node as NamedCompilationUnitMember).declaredElement!;
|
||||
final references = _findAllReferences(unit, element);
|
||||
// todo (pq): consider filtering for references that are limited to within the class.
|
||||
// TODO(pq): consider filtering for references that are limited to within the class.
|
||||
if (references.isEmpty) {
|
||||
var parent = node.parent;
|
||||
var grandParent = parent?.parent;
|
||||
@@ -130,7 +130,7 @@ class RemoveUnusedField extends _RemoveUnused {
|
||||
..._findAllReferences(unit, element),
|
||||
];
|
||||
for (var reference in references) {
|
||||
// todo (pq): consider scoping this to parent or parent.parent.
|
||||
// TODO(pq): consider scoping this to parent or parent.parent.
|
||||
final referenceNode = reference.thisOrAncestorMatching((node) =>
|
||||
node is VariableDeclaration ||
|
||||
node is ExpressionStatement ||
|
||||
|
||||
+1
-1
@@ -272,7 +272,7 @@ class RemoveUnusedLocalVariable extends ResolvedCorrectionProducer {
|
||||
}
|
||||
|
||||
SourceRange _forAssignmentExpression(AssignmentExpression node) {
|
||||
// todo (pq): consider node.parent is! ExpressionStatement to handle
|
||||
// TODO(pq): consider node.parent is! ExpressionStatement to handle
|
||||
// assignments in parens, etc.
|
||||
var parent = node.parent!;
|
||||
if (parent is ArgumentList) {
|
||||
|
||||
@@ -35,7 +35,7 @@ class ReplaceWithVar extends ResolvedCorrectionProducer {
|
||||
if (type == null) {
|
||||
return;
|
||||
}
|
||||
// TODO(brianwilkerson) Optimize this by removing the duplication between
|
||||
// TODO(brianwilkerson): Optimize this by removing the duplication between
|
||||
// [_canReplaceWithVar] and the rest of this method.
|
||||
if (!_canReplaceWithVar()) {
|
||||
return;
|
||||
|
||||
@@ -29,7 +29,7 @@ class ShadowField extends ResolvedCorrectionProducer {
|
||||
}
|
||||
|
||||
if (!accessor.isGetter || accessor.enclosingElement is! InterfaceElement) {
|
||||
// TODO(brianwilkerson) Should we also require that the getter be synthetic?
|
||||
// TODO(brianwilkerson): Should we also require that the getter be synthetic?
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class ShadowField extends ResolvedCorrectionProducer {
|
||||
|
||||
var enclosingBlock = statement.parent;
|
||||
if (enclosingBlock is! Block) {
|
||||
// TODO(brianwilkerson) Support adding a block between the statement and
|
||||
// TODO(brianwilkerson): Support adding a block between the statement and
|
||||
// its parent (where the parent will be something like a while or if
|
||||
// statement). Also support the case where the parent is a case clause.
|
||||
return;
|
||||
@@ -65,9 +65,9 @@ class ShadowField extends ResolvedCorrectionProducer {
|
||||
//
|
||||
await builder.addDartFileEdit(file, (builder) {
|
||||
builder.addInsertion(offset, (builder) {
|
||||
// TODO(brianwilkerson) Conditionally write a type annotation instead of
|
||||
// TODO(brianwilkerson): Conditionally write a type annotation instead of
|
||||
// 'var' when we're able to discover user preferences.
|
||||
// TODO(brianwilkerson) Consider writing `final` rather than `var`.
|
||||
// TODO(brianwilkerson): Consider writing `final` rather than `var`.
|
||||
builder.write('var ');
|
||||
builder.write(fieldName);
|
||||
builder.write(' = this.');
|
||||
@@ -75,7 +75,7 @@ class ShadowField extends ResolvedCorrectionProducer {
|
||||
builder.writeln(';');
|
||||
builder.write(prefix);
|
||||
});
|
||||
// TODO(brianwilkerson) Consider removing unnecessary casts and null
|
||||
// TODO(brianwilkerson): Consider removing unnecessary casts and null
|
||||
// checks that are no longer needed because promotion works. This would
|
||||
// be dependent on whether enhanced promotion is supported in the library
|
||||
// being edited.
|
||||
|
||||
@@ -22,7 +22,7 @@ bool hasFix(ErrorCode errorCode) {
|
||||
return FixProcessor.lintProducerMap.containsKey(lintName) ||
|
||||
FixProcessor.lintMultiProducerMap.containsKey(lintName);
|
||||
}
|
||||
// TODO(brianwilkerson) Either deprecate the part of the protocol supported by
|
||||
// TODO(brianwilkerson): Either deprecate the part of the protocol supported by
|
||||
// this function, or handle error codes associated with non-dart files.
|
||||
return FixProcessor.nonLintProducerMap.containsKey(errorCode) ||
|
||||
FixProcessor.nonLintMultiProducerMap.containsKey(errorCode);
|
||||
@@ -759,7 +759,7 @@ class DartFixKind {
|
||||
"Create method '{0}'",
|
||||
);
|
||||
|
||||
// todo (pq): used by LintNames.hash_and_equals; consider removing.
|
||||
// TODO(pq): used by LintNames.hash_and_equals; consider removing.
|
||||
static const CREATE_METHOD_MULTI = FixKind(
|
||||
'dart.fix.create.method.multi',
|
||||
DartFixKindPriority.IN_FILE,
|
||||
@@ -891,7 +891,7 @@ class DartFixKind {
|
||||
'Make final',
|
||||
);
|
||||
|
||||
// todo (pq): consider parameterizing: 'Make {fields} final...'
|
||||
// TODO(pq): consider parameterizing: 'Make {fields} final...'
|
||||
static const MAKE_FINAL_MULTI = FixKind(
|
||||
'dart.fix.makeFinal.multi',
|
||||
DartFixKindPriority.IN_FILE,
|
||||
@@ -988,7 +988,8 @@ class DartFixKind {
|
||||
'Remove argument',
|
||||
);
|
||||
|
||||
// todo (pq): used by LintNames.avoid_redundant_argument_values; consider a parameterized message
|
||||
// TODO(pq): used by LintNames.avoid_redundant_argument_values;
|
||||
// consider a parameterized message
|
||||
static const REMOVE_ARGUMENT_MULTI = FixKind(
|
||||
'dart.fix.remove.argument.multi',
|
||||
DartFixKindPriority.IN_FILE,
|
||||
@@ -1090,7 +1091,7 @@ class DartFixKind {
|
||||
'Remove duplicate case statement',
|
||||
);
|
||||
|
||||
// todo (pq): is this dangerous to bulk apply? Consider removing.
|
||||
// TODO(pq): is this dangerous to bulk apply? Consider removing.
|
||||
static const REMOVE_DUPLICATE_CASE_MULTI = FixKind(
|
||||
'dart.fix.remove.duplicateCase.multi',
|
||||
DartFixKindPriority.IN_FILE,
|
||||
@@ -1202,7 +1203,7 @@ class DartFixKind {
|
||||
'Remove method declaration',
|
||||
);
|
||||
|
||||
// todo (pq): parameterize to make scope explicit
|
||||
// TODO(pq): parameterize to make scope explicit
|
||||
static const REMOVE_METHOD_DECLARATION_MULTI = FixKind(
|
||||
'dart.fix.remove.methodDeclaration.multi',
|
||||
DartFixKindPriority.IN_FILE,
|
||||
@@ -1734,7 +1735,7 @@ class DartFixKind {
|
||||
'Replace with identifier',
|
||||
);
|
||||
|
||||
// todo (pq): parameterize message (used by LintNames.avoid_types_on_closure_parameters)
|
||||
// TODO(pq): parameterize message (used by LintNames.avoid_types_on_closure_parameters)
|
||||
static const REPLACE_WITH_IDENTIFIER_MULTI = FixKind(
|
||||
'dart.fix.replace.withIdentifier.multi',
|
||||
DartFixKindPriority.IN_FILE,
|
||||
|
||||
+13
-13
@@ -43,41 +43,41 @@ class ElementDescriptor {
|
||||
/// Return `true` if the given [node] appears to be consistent with the
|
||||
/// element being described.
|
||||
bool matches(AstNode node) {
|
||||
// TODO(brianwilkerson) Check the resolved element, if one exists, for more
|
||||
// TODO(brianwilkerson): Check the resolved element, if one exists, for more
|
||||
// accurate results.
|
||||
return switch (kind) {
|
||||
ElementKind.classKind =>
|
||||
// TODO(brianwilkerson) Handle this case.
|
||||
// TODO(brianwilkerson): Handle this case.
|
||||
false,
|
||||
ElementKind.constantKind =>
|
||||
// TODO(brianwilkerson) Handle this case.
|
||||
// TODO(brianwilkerson): Handle this case.
|
||||
false,
|
||||
ElementKind.constructorKind => _matchesConstructor(node),
|
||||
ElementKind.enumKind =>
|
||||
// TODO(brianwilkerson) Handle this case.
|
||||
// TODO(brianwilkerson): Handle this case.
|
||||
false,
|
||||
ElementKind.extensionKind =>
|
||||
// TODO(brianwilkerson) Handle this case.
|
||||
// TODO(brianwilkerson): Handle this case.
|
||||
false,
|
||||
ElementKind.fieldKind =>
|
||||
// TODO(brianwilkerson) Handle this case.
|
||||
// TODO(brianwilkerson): Handle this case.
|
||||
false,
|
||||
ElementKind.functionKind => _matchesFunction(node),
|
||||
ElementKind.getterKind =>
|
||||
// TODO(brianwilkerson) Handle this case.
|
||||
// TODO(brianwilkerson): Handle this case.
|
||||
false,
|
||||
ElementKind.methodKind => _matchesMethod(node),
|
||||
ElementKind.mixinKind =>
|
||||
// TODO(brianwilkerson) Handle this case.
|
||||
// TODO(brianwilkerson): Handle this case.
|
||||
false,
|
||||
ElementKind.setterKind =>
|
||||
// TODO(brianwilkerson) Handle this case.
|
||||
// TODO(brianwilkerson): Handle this case.
|
||||
false,
|
||||
ElementKind.typedefKind =>
|
||||
// TODO(brianwilkerson) Handle this case.
|
||||
// TODO(brianwilkerson): Handle this case.
|
||||
false,
|
||||
ElementKind.variableKind =>
|
||||
// TODO(brianwilkerson) Handle this case.
|
||||
// TODO(brianwilkerson): Handle this case.
|
||||
false
|
||||
};
|
||||
}
|
||||
@@ -133,14 +133,14 @@ class ElementDescriptor {
|
||||
if (components[0] == node.methodName.name) {
|
||||
var target = node.realTarget;
|
||||
if (target == null) {
|
||||
// TODO(brianwilkerson) If `node.target == null` then the invocation
|
||||
// TODO(brianwilkerson): If `node.target == null` then the invocation
|
||||
// should be in a subclass of the element's class.
|
||||
return true;
|
||||
} else {
|
||||
var type = target.staticType;
|
||||
if (type == null && target is SimpleIdentifier) {
|
||||
var element = target.staticElement;
|
||||
// TODO(brianwilkerson) Handle more than `InterfaceElement`.
|
||||
// TODO(brianwilkerson): Handle more than `InterfaceElement`.
|
||||
if (element is InterfaceElement) {
|
||||
type = element.thisType;
|
||||
}
|
||||
|
||||
+14
-14
@@ -101,7 +101,7 @@ class ElementMatcher {
|
||||
} else {
|
||||
// The node has more components than the element, which can happen when a
|
||||
// constructor is implicitly renamed because the class was renamed.
|
||||
// TODO(brianwilkerson) Figure out whether we want to support this or
|
||||
// TODO(brianwilkerson): Figure out whether we want to support this or
|
||||
// whether we want to require fix data authors to explicitly include the
|
||||
// change to the constructor. On the one hand it's more work for the
|
||||
// author, on the other hand it give us more data so we're less likely to
|
||||
@@ -158,7 +158,7 @@ class ElementMatcher {
|
||||
return null;
|
||||
}
|
||||
for (var importElement in library.libraryImports) {
|
||||
// TODO(brianwilkerson) Filter based on combinators to help avoid making
|
||||
// TODO(brianwilkerson): Filter based on combinators to help avoid making
|
||||
// invalid suggestions.
|
||||
var uri = importElement.importedLibrary?.source.uri;
|
||||
if (uri != null) {
|
||||
@@ -232,7 +232,7 @@ class _MatcherBuilder {
|
||||
kinds: [ElementKind.constructorKind],
|
||||
);
|
||||
// } else if (parent is ExtensionOverride) {
|
||||
// // TODO(brianwilkerson) Determine whether this branch can be reached.
|
||||
// // `TODO`(brianwilkerson) Determine whether this branch can be reached.
|
||||
// _buildFromExtensionOverride(parent);
|
||||
} else if (parent is FunctionExpressionInvocation) {
|
||||
_buildFromFunctionExpressionInvocation(parent);
|
||||
@@ -264,15 +264,15 @@ class _MatcherBuilder {
|
||||
|
||||
/// Build a matcher for the operator being invoked.
|
||||
void _buildFromBinaryExpression(BinaryExpression node) {
|
||||
// TODO(brianwilkerson) Implement this method in order to support changes to
|
||||
// TODO(brianwilkerson): Implement this method in order to support changes to
|
||||
// operators.
|
||||
}
|
||||
|
||||
/// Build a matcher for the constructor being referenced.
|
||||
void _buildFromConstructorName(ConstructorName node) {
|
||||
// TODO(brianwilkerson) Use the static element, if there is one, in order to
|
||||
// TODO(brianwilkerson): Use the static element, if there is one, in order to
|
||||
// get a more exact matcher.
|
||||
// TODO(brianwilkerson) Use 'new' for the name of the unnamed constructor.
|
||||
// TODO(brianwilkerson): Use 'new' for the name of the unnamed constructor.
|
||||
var constructorName = node.name?.name ?? ''; // ?? 'new';
|
||||
var className = node.type.name2.lexeme;
|
||||
_addMatcher(
|
||||
@@ -296,7 +296,7 @@ class _MatcherBuilder {
|
||||
/// Build a matcher for the function being invoked.
|
||||
void _buildFromFunctionExpressionInvocation(
|
||||
FunctionExpressionInvocation node) {
|
||||
// TODO(brianwilkerson) This case was missed in the original implementation
|
||||
// TODO(brianwilkerson): This case was missed in the original implementation
|
||||
// and there are no tests for it at this point, but it ought to be supported.
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ class _MatcherBuilder {
|
||||
|
||||
/// Build a matcher for the method being invoked.
|
||||
void _buildFromMethodInvocation(MethodInvocation node) {
|
||||
// TODO(brianwilkerson) Use the static element, if there is one, in order to
|
||||
// TODO(brianwilkerson): Use the static element, if there is one, in order to
|
||||
// get a more exact matcher.
|
||||
// var element = node.methodName.staticElement;
|
||||
// if (element != null) {
|
||||
@@ -372,7 +372,7 @@ class _MatcherBuilder {
|
||||
if (parent is ConstructorName) {
|
||||
return _buildFromConstructorName(parent);
|
||||
}
|
||||
// TODO(brianwilkerson) Use the static element, if there is one, in order to
|
||||
// TODO(brianwilkerson): Use the static element, if there is one, in order to
|
||||
// get a more exact matcher.
|
||||
_addMatcher(
|
||||
components: [node.name2.lexeme],
|
||||
@@ -383,7 +383,7 @@ class _MatcherBuilder {
|
||||
ElementKind.typedefKind
|
||||
],
|
||||
);
|
||||
// TODO(brianwilkerson) Determine whether we can ever get here as a result
|
||||
// TODO(brianwilkerson): Determine whether we can ever get here as a result
|
||||
// of having a removed unnamed constructor.
|
||||
// _addMatcher(
|
||||
// components: ['', node.name.name],
|
||||
@@ -397,7 +397,7 @@ class _MatcherBuilder {
|
||||
if (parent is NamedType) {
|
||||
return _buildFromNamedType(parent);
|
||||
}
|
||||
// TODO(brianwilkerson) Use the static element, if there is one, in order to
|
||||
// TODO(brianwilkerson): Use the static element, if there is one, in order to
|
||||
// get a more exact matcher.
|
||||
var prefix = node.prefix;
|
||||
if (prefix.staticElement is PrefixElement) {
|
||||
@@ -474,7 +474,7 @@ class _MatcherBuilder {
|
||||
|
||||
/// Build a matcher for the property being accessed.
|
||||
void _buildFromPropertyAccess(PropertyAccess node) {
|
||||
// TODO(brianwilkerson) Use the static element, if there is one, in order to
|
||||
// TODO(brianwilkerson): Use the static element, if there is one, in order to
|
||||
// get a more exact matcher.
|
||||
var propertyName = node.propertyName;
|
||||
var targetName = _nameOfTarget(node.realTarget);
|
||||
@@ -499,7 +499,7 @@ class _MatcherBuilder {
|
||||
|
||||
/// Build a matcher for the element referenced by the identifier.
|
||||
void _buildFromSimpleIdentifier(SimpleIdentifier node, Token nameToken) {
|
||||
// TODO(brianwilkerson) Use the static element, if there is one, in order to
|
||||
// TODO(brianwilkerson): Use the static element, if there is one, in order to
|
||||
// get a more exact matcher.
|
||||
var parent = node.parent;
|
||||
if (parent is Label && parent.parent is NamedExpression) {
|
||||
@@ -522,7 +522,7 @@ class _MatcherBuilder {
|
||||
!_isPrefix(parent.target)) {
|
||||
_buildFromPropertyAccess(parent);
|
||||
} else {
|
||||
// TODO(brianwilkerson) See whether the list of kinds can be specified.
|
||||
// TODO(brianwilkerson): See whether the list of kinds can be specified.
|
||||
// If we cannot resolve the element. add the parent/target information,
|
||||
// where it should have been declared.
|
||||
if (node.staticType is InvalidType) {
|
||||
|
||||
@@ -143,7 +143,7 @@ class ReplacedBy extends Change<_Data> {
|
||||
var grandparent = parent.parent;
|
||||
if (grandparent is ConstructorName &&
|
||||
grandparent.name?.name == components[0]) {
|
||||
// TODO(brianwilkerson) This doesn't correctly handle constructor
|
||||
// TODO(brianwilkerson): This doesn't correctly handle constructor
|
||||
// invocations with type arguments. We really need to replace the
|
||||
// class and constructor names separately.
|
||||
return _Data(range.node(grandparent));
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ import 'package:yaml/yaml.dart';
|
||||
|
||||
/// A parser used to parse the content of a configuration file.
|
||||
class TransformOverrideSetParser {
|
||||
// TODO(brianwilkerson) Create a class or mixin that would allow this class
|
||||
// TODO(brianwilkerson): Create a class or mixin that would allow this class
|
||||
// and `TransformSetParser` to share code.
|
||||
static const String _bulkApplyKey = 'bulkApply';
|
||||
|
||||
@@ -208,7 +208,7 @@ class TransformOverrideSetParser {
|
||||
}
|
||||
return TransformOverrideSet(overrides);
|
||||
} else {
|
||||
// TODO(brianwilkerson) Consider having a different error code for the
|
||||
// TODO(brianwilkerson): Consider having a different error code for the
|
||||
// top-level node (instead of using 'file' as the "key").
|
||||
_reportError(TransformSetErrorCode.invalidValue, node,
|
||||
['file', 'Map', _nodeType(node)]);
|
||||
|
||||
+8
-8
@@ -183,7 +183,7 @@ class TransformSetParser {
|
||||
var variableStart = template.indexOf(_openComponent);
|
||||
while (variableStart >= 0) {
|
||||
if (textStart < variableStart) {
|
||||
// TODO(brianwilkerson) Check for an end brace without a start brace.
|
||||
// TODO(brianwilkerson): Check for an end brace without a start brace.
|
||||
components
|
||||
.add(TemplateText(template.substring(textStart, variableStart)));
|
||||
}
|
||||
@@ -214,10 +214,10 @@ class TransformSetParser {
|
||||
variableStart = template.indexOf(_openComponent, textStart);
|
||||
}
|
||||
if (textStart < template.length) {
|
||||
// TODO(brianwilkerson) Check for an end brace without a start brace.
|
||||
// TODO(brianwilkerson): Check for an end brace without a start brace.
|
||||
components.add(TemplateText(template.substring(textStart)));
|
||||
}
|
||||
// TODO(brianwilkerson) If there are no other errors, then report
|
||||
// TODO(brianwilkerson): If there are no other errors, then report
|
||||
// unreferenced variables.
|
||||
return components;
|
||||
}
|
||||
@@ -406,14 +406,14 @@ class TransformSetParser {
|
||||
var argumentValue = _translateCodeTemplate(argumentValueNode,
|
||||
ErrorContext(key: _argumentValueKey, parentNode: node),
|
||||
canBeConditionallyRequired: true);
|
||||
// TODO(brianwilkerson) We really ought to require an argument value for
|
||||
// TODO(brianwilkerson): We really ought to require an argument value for
|
||||
// optional positional parameters too for the case where the added
|
||||
// parameter is being added before the end of the list and call sites might
|
||||
// already be providing a value for subsequent parameters. Unfortunately we
|
||||
// can't know at this point whether there are subsequent parameters in
|
||||
// order to require it only when it's potentially necessary.
|
||||
if (isRequired && argumentValue == null) {
|
||||
// TODO(brianwilkerson) Report that required parameters must have an
|
||||
// TODO(brianwilkerson): Report that required parameters must have an
|
||||
// argument value.
|
||||
return;
|
||||
} else if (argumentValue != null &&
|
||||
@@ -1183,7 +1183,7 @@ class TransformSetParser {
|
||||
_reportError(TransformSetErrorCode.unsupportedVersion, versionNode);
|
||||
return null;
|
||||
}
|
||||
// TODO(brianwilkerson) Version information is currently being ignored,
|
||||
// TODO(brianwilkerson): Version information is currently being ignored,
|
||||
// but needs to be used to select a translator.
|
||||
var transforms = _translateList(
|
||||
node.valueAt(_transformsKey),
|
||||
@@ -1204,7 +1204,7 @@ class TransformSetParser {
|
||||
// any diagnostics.
|
||||
return null;
|
||||
} else {
|
||||
// TODO(brianwilkerson) Consider having a different error code for the
|
||||
// TODO(brianwilkerson): Consider having a different error code for the
|
||||
// top-level node (instead of using 'file' as the "key").
|
||||
_reportError(TransformSetErrorCode.invalidValue, node,
|
||||
['file', 'Map', _nodeType(node)]);
|
||||
@@ -1302,7 +1302,7 @@ class TransformSetParser {
|
||||
ElementKind.variableKind,
|
||||
});
|
||||
// Static setters and setter-inducing elements can replace each other.
|
||||
// TODO(brianwilkerson) We can't currently distinguish between final and
|
||||
// TODO(brianwilkerson): We can't currently distinguish between final and
|
||||
// non-final elements, but we don't support replacing setters with final
|
||||
// elements, nor vice versa. We need a way to distinguish these cases if we
|
||||
// want to be able to report an error.
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@ class CodeFragment extends ValueGenerator {
|
||||
if (target is AstNode) {
|
||||
return context.utils.getRangeText(range.node(target));
|
||||
} else if (target is DartType) {
|
||||
// TODO(brianwilkerson) If we end up needing it, figure out how to convert
|
||||
// TODO(brianwilkerson): If we end up needing it, figure out how to convert
|
||||
// a type into valid code.
|
||||
throw UnsupportedError('Unexpected result of ${target.runtimeType}');
|
||||
} else {
|
||||
@@ -89,7 +89,7 @@ class ImportedName extends ValueGenerator {
|
||||
|
||||
@override
|
||||
bool validate(TemplateContext context) {
|
||||
// TODO(brianwilkerson) Validate that the import can be added.
|
||||
// TODO(brianwilkerson): Validate that the import can be added.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class PubspecFixGenerator {
|
||||
|
||||
/// Returns the end-of-line marker to use for the `pubspec.yaml` file.
|
||||
String get endOfLine {
|
||||
// TODO(brianwilkerson) Share this with CorrectionUtils, probably by
|
||||
// TODO(brianwilkerson): Share this with CorrectionUtils, probably by
|
||||
// creating a subclass of CorrectionUtils containing utilities that are
|
||||
// only dependent on knowing the content of the file. Also consider moving
|
||||
// this kind of utility into the ChangeBuilder API directly.
|
||||
@@ -239,7 +239,7 @@ class PubspecFixGenerator {
|
||||
return;
|
||||
}
|
||||
await builder.addGenericFileEdit(file, (builder) {
|
||||
// TODO(brianwilkerson) Generalize this to add a key to any map by
|
||||
// TODO(brianwilkerson): Generalize this to add a key to any map by
|
||||
// inserting the indentation of the line containing `firstOffset` after
|
||||
// the end-of-line marker.
|
||||
builder.addSimpleInsertion(firstOffset, 'name: $packageName$endOfLine');
|
||||
|
||||
@@ -374,7 +374,7 @@ class FixInFileProcessor {
|
||||
return fixState;
|
||||
}
|
||||
|
||||
// todo (pq): consider discarding the change if the producer's fixKind
|
||||
// TODO(pq): consider discarding the change if the producer's fixKind
|
||||
// doesn't match a previously cached one.
|
||||
return _NotEmptyFixState(
|
||||
builder: localBuilder,
|
||||
@@ -392,7 +392,7 @@ class FixInFileProcessor {
|
||||
if (errorCode is LintCode) {
|
||||
return FixProcessor.lintProducerMap[errorCode.uniqueLintName] ?? [];
|
||||
} else {
|
||||
// todo (pq): consider support for multiGenerators
|
||||
// TODO(pq): consider support for multiGenerators
|
||||
return FixProcessor.nonLintProducerMap[errorCode] ?? [];
|
||||
}
|
||||
}
|
||||
@@ -492,7 +492,7 @@ class FixProcessor extends BaseProcessor {
|
||||
RemoveTypeAnnotation.other,
|
||||
],
|
||||
LintNames.avoid_returning_null_for_future: [
|
||||
// TODO(brianwilkerson) Consider applying in bulk.
|
||||
// TODO(brianwilkerson): Consider applying in bulk.
|
||||
AddAsync.new,
|
||||
WrapInFuture.new,
|
||||
],
|
||||
@@ -500,7 +500,7 @@ class FixProcessor extends BaseProcessor {
|
||||
RemoveReturnedValue.new,
|
||||
],
|
||||
LintNames.avoid_single_cascade_in_expression_statements: [
|
||||
// TODO(brianwilkerson) This fix should be applied to some non-lint
|
||||
// TODO(brianwilkerson): This fix should be applied to some non-lint
|
||||
// diagnostics and should also be available as an assist.
|
||||
ReplaceCascadeWithDot.new,
|
||||
],
|
||||
@@ -986,7 +986,7 @@ class FixProcessor extends BaseProcessor {
|
||||
],
|
||||
CompileTimeErrorCode.UNDEFINED_SETTER: [
|
||||
DataDriven.new,
|
||||
// TODO(brianwilkerson) Support ImportLibrary for non-extension members.
|
||||
// TODO(brianwilkerson): Support ImportLibrary for non-extension members.
|
||||
ImportLibrary.forExtensionMember,
|
||||
],
|
||||
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS: [
|
||||
@@ -1426,14 +1426,14 @@ class FixProcessor extends BaseProcessor {
|
||||
CreateSetter.new,
|
||||
],
|
||||
CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER: [
|
||||
// TODO(brianwilkerson) Consider adding fixes to create a field, getter,
|
||||
// TODO(brianwilkerson): Consider adding fixes to create a field, getter,
|
||||
// method or setter. The existing _addFix methods would need to be
|
||||
// updated so that only the appropriate subset is generated.
|
||||
QualifyReference.new,
|
||||
],
|
||||
CompileTimeErrorCode
|
||||
.UNQUALIFIED_REFERENCE_TO_STATIC_MEMBER_OF_EXTENDED_TYPE: [
|
||||
// TODO(brianwilkerson) Consider adding fixes to create a field, getter,
|
||||
// TODO(brianwilkerson): Consider adding fixes to create a field, getter,
|
||||
// method or setter. The existing producers would need to be updated so
|
||||
// that only the appropriate subset is generated.
|
||||
QualifyReference.new,
|
||||
@@ -1559,12 +1559,12 @@ class FixProcessor extends BaseProcessor {
|
||||
RemoveDeadCode.new,
|
||||
],
|
||||
WarningCode.DEAD_CODE_CATCH_FOLLOWING_CATCH: [
|
||||
// TODO(brianwilkerson) Add a fix to move the unreachable catch clause to
|
||||
// TODO(brianwilkerson): Add a fix to move the unreachable catch clause to
|
||||
// a place where it can be reached (when possible).
|
||||
RemoveDeadCode.new,
|
||||
],
|
||||
WarningCode.DEAD_CODE_ON_CATCH_SUBTYPE: [
|
||||
// TODO(brianwilkerson) Add a fix to move the unreachable catch clause to
|
||||
// TODO(brianwilkerson): Add a fix to move the unreachable catch clause to
|
||||
// a place where it can be reached (when possible).
|
||||
RemoveDeadCode.new,
|
||||
],
|
||||
|
||||
@@ -178,7 +178,7 @@ List<SimpleIdentifier> findPrefixElementReferences(
|
||||
return collector.references;
|
||||
}
|
||||
|
||||
/// TODO(scheglov) replace with nodes once there will be
|
||||
// TODO(scheglov): replace with nodes once there will be
|
||||
/// [CompilationUnit.getComments].
|
||||
///
|
||||
/// Returns [SourceRange]s of all comments in [unit].
|
||||
@@ -1778,7 +1778,7 @@ class _InvertedCondition {
|
||||
|
||||
static _InvertedCondition _binary2(
|
||||
_InvertedCondition left, String operation, _InvertedCondition right) {
|
||||
// TODO(scheglov) consider merging with "_binary()" after testing
|
||||
// TODO(scheglov): consider merging with "_binary()" after testing
|
||||
return _InvertedCondition(
|
||||
1 << 20, '${left._source}$operation${right._source}');
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user