Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(898)

Side by Side Diff: pkg/analysis_server/lib/src/services/correction/fix.dart

Issue 1095143002: Initial version of completion plugin API (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/assist.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analysis_server.src.services.correction.fix; 5 library analysis_server.src.services.correction.fix;
6 6
7 import 'package:analysis_server/edit/fix/fix_core.dart'; 7 import 'package:analysis_server/edit/fix/fix_core.dart';
8 import 'package:analysis_server/src/plugin/server_plugin.dart'; 8 import 'package:analysis_server/src/plugin/server_plugin.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/error.dart'; 10 import 'package:analyzer/src/generated/error.dart';
11 import 'package:analyzer/src/generated/java_engine.dart'; 11 import 'package:analyzer/src/generated/java_engine.dart';
12 12
13 /** 13 /**
14 * Compute and return the fixes available for the given [error]. The error was 14 * Compute and return the fixes available for the given [error]. The error was
15 * reported after it's source was analyzed in the given [context]. The [plugin] 15 * reported after it's source was analyzed in the given [context]. The [plugin]
16 * is used to get the list of fix contributors. 16 * is used to get the list of fix contributors.
17 */ 17 */
18 List<Fix> computeFixes( 18 List<Fix> computeFixes(
19 ServerPlugin plugin, AnalysisContext context, AnalysisError error) { 19 ServerPlugin plugin, AnalysisContext context, AnalysisError error) {
20 List<Fix> fixes = <Fix>[]; 20 List<Fix> fixes = <Fix>[];
21 List<FixContributor> contributors = plugin.fixContributors(); 21 List<FixContributor> contributors = plugin.fixContributors;
22 for (FixContributor contributor in contributors) { 22 for (FixContributor contributor in contributors) {
23 try { 23 try {
24 List<Fix> contributedFixes = contributor.computeFixes(context, error); 24 List<Fix> contributedFixes = contributor.computeFixes(context, error);
25 if (contributedFixes != null) { 25 if (contributedFixes != null) {
26 fixes.addAll(contributedFixes); 26 fixes.addAll(contributedFixes);
27 } 27 }
28 } catch (exception, stackTrace) { 28 } catch (exception, stackTrace) {
29 AnalysisEngine.instance.logger.logError( 29 AnalysisEngine.instance.logger.logError(
30 'Exception from fix contributor: ${contributor.runtimeType}', 30 'Exception from fix contributor: ${contributor.runtimeType}',
31 new CaughtException(exception, stackTrace)); 31 new CaughtException(exception, stackTrace));
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 "Return 'Future' from 'async' function"); 113 "Return 'Future' from 'async' function");
114 static const USE_CONST = const FixKind('USE_CONST', 50, "Change to constant"); 114 static const USE_CONST = const FixKind('USE_CONST', 50, "Change to constant");
115 static const USE_EFFECTIVE_INTEGER_DIVISION = const FixKind( 115 static const USE_EFFECTIVE_INTEGER_DIVISION = const FixKind(
116 'USE_EFFECTIVE_INTEGER_DIVISION', 50, 116 'USE_EFFECTIVE_INTEGER_DIVISION', 50,
117 "Use effective integer division ~/"); 117 "Use effective integer division ~/");
118 static const USE_EQ_EQ_NULL = 118 static const USE_EQ_EQ_NULL =
119 const FixKind('USE_EQ_EQ_NULL', 50, "Use == null instead of 'is Null'"); 119 const FixKind('USE_EQ_EQ_NULL', 50, "Use == null instead of 'is Null'");
120 static const USE_NOT_EQ_NULL = 120 static const USE_NOT_EQ_NULL =
121 const FixKind('USE_NOT_EQ_NULL', 50, "Use != null instead of 'is! Null'"); 121 const FixKind('USE_NOT_EQ_NULL', 50, "Use != null instead of 'is! Null'");
122 } 122 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/assist.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698