OLD | NEW |
---|---|
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 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; | 9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; |
10 import 'package:analysis_server/src/plugin/server_plugin.dart'; | 10 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
(...skipping 28 matching lines...) Expand all Loading... | |
39 new CaughtException(exception, stackTrace)); | 39 new CaughtException(exception, stackTrace)); |
40 } | 40 } |
41 } | 41 } |
42 fixes.sort(Fix.SORT_BY_RELEVANCE); | 42 fixes.sort(Fix.SORT_BY_RELEVANCE); |
43 return fixes; | 43 return fixes; |
44 } | 44 } |
45 | 45 |
46 /** | 46 /** |
47 * Return true if this [errorCode] is likely to have a fix associated with it. | 47 * Return true if this [errorCode] is likely to have a fix associated with it. |
48 */ | 48 */ |
49 bool hasFix(ErrorCode errorCode) => errorCode == | 49 bool hasFix(ErrorCode errorCode) => |
Brian Wilkerson
2016/02/26 22:43:34
This method should be updated. It's how Atom knows
| |
50 StaticWarningCode.UNDEFINED_CLASS_BOOLEAN || | 50 errorCode == StaticWarningCode.UNDEFINED_CLASS_BOOLEAN || |
51 errorCode == StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER || | 51 errorCode == StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER || |
52 errorCode == StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS || | 52 errorCode == StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS || |
53 errorCode == StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR || | 53 errorCode == StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR || |
54 errorCode == | 54 errorCode == |
55 StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE || | 55 StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE || |
56 errorCode == | 56 errorCode == |
57 StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO || | 57 StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO || |
58 errorCode == | 58 errorCode == |
59 StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE || | 59 StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE || |
60 errorCode == | 60 errorCode == |
61 StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR || | 61 StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR || |
62 errorCode == | 62 errorCode == |
63 StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS || | 63 StaticWarningCode |
64 .NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS || | |
64 errorCode == StaticWarningCode.CAST_TO_NON_TYPE || | 65 errorCode == StaticWarningCode.CAST_TO_NON_TYPE || |
65 errorCode == StaticWarningCode.TYPE_TEST_WITH_UNDEFINED_NAME || | 66 errorCode == StaticWarningCode.TYPE_TEST_WITH_UNDEFINED_NAME || |
66 errorCode == StaticWarningCode.UNDEFINED_CLASS || | 67 errorCode == StaticWarningCode.UNDEFINED_CLASS || |
67 errorCode == StaticWarningCode.FINAL_NOT_INITIALIZED || | 68 errorCode == StaticWarningCode.FINAL_NOT_INITIALIZED || |
68 errorCode == StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_1 || | 69 errorCode == StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_1 || |
69 errorCode == StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_2 || | 70 errorCode == StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_2 || |
70 errorCode == StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS || | 71 errorCode == StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS || |
71 errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER || | 72 errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER || |
72 errorCode == | 73 errorCode == |
73 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE || | 74 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE || |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 static const IMPORT_LIBRARY_PREFIX = const FixKind('IMPORT_LIBRARY_PREFIX', | 159 static const IMPORT_LIBRARY_PREFIX = const FixKind('IMPORT_LIBRARY_PREFIX', |
159 51, "Use imported library '{0}' with prefix '{1}'"); | 160 51, "Use imported library '{0}' with prefix '{1}'"); |
160 static const IMPORT_LIBRARY_PROJECT = | 161 static const IMPORT_LIBRARY_PROJECT = |
161 const FixKind('IMPORT_LIBRARY_PROJECT', 49, "Import library '{0}'"); | 162 const FixKind('IMPORT_LIBRARY_PROJECT', 49, "Import library '{0}'"); |
162 static const IMPORT_LIBRARY_SDK = | 163 static const IMPORT_LIBRARY_SDK = |
163 const FixKind('IMPORT_LIBRARY_SDK', 49, "Import library '{0}'"); | 164 const FixKind('IMPORT_LIBRARY_SDK', 49, "Import library '{0}'"); |
164 static const IMPORT_LIBRARY_SHOW = | 165 static const IMPORT_LIBRARY_SHOW = |
165 const FixKind('IMPORT_LIBRARY_SHOW', 49, "Update library '{0}' import"); | 166 const FixKind('IMPORT_LIBRARY_SHOW', 49, "Update library '{0}' import"); |
166 static const INSERT_SEMICOLON = | 167 static const INSERT_SEMICOLON = |
167 const FixKind('INSERT_SEMICOLON', 50, "Insert ';'"); | 168 const FixKind('INSERT_SEMICOLON', 50, "Insert ';'"); |
169 static const LINT_ADD_OVERRIDE = | |
170 const FixKind('LINT_ADD_OVERRIDE', 50, "Add '@override' annotation"); | |
168 static const MAKE_CLASS_ABSTRACT = | 171 static const MAKE_CLASS_ABSTRACT = |
169 const FixKind('MAKE_CLASS_ABSTRACT', 50, "Make class '{0}' abstract"); | 172 const FixKind('MAKE_CLASS_ABSTRACT', 50, "Make class '{0}' abstract"); |
170 static const REMOVE_DEAD_CODE = | 173 static const REMOVE_DEAD_CODE = |
171 const FixKind('REMOVE_DEAD_CODE', 50, "Remove dead code"); | 174 const FixKind('REMOVE_DEAD_CODE', 50, "Remove dead code"); |
172 static const MAKE_FIELD_NOT_FINAL = | 175 static const MAKE_FIELD_NOT_FINAL = |
173 const FixKind('MAKE_FIELD_NOT_FINAL', 50, "Make field '{0}' not final"); | 176 const FixKind('MAKE_FIELD_NOT_FINAL', 50, "Make field '{0}' not final"); |
174 static const REMOVE_PARAMETERS_IN_GETTER_DECLARATION = const FixKind( | 177 static const REMOVE_PARAMETERS_IN_GETTER_DECLARATION = const FixKind( |
175 'REMOVE_PARAMETERS_IN_GETTER_DECLARATION', | 178 'REMOVE_PARAMETERS_IN_GETTER_DECLARATION', |
176 50, | 179 50, |
177 "Remove parameters in getter declaration"); | 180 "Remove parameters in getter declaration"); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 @override | 228 @override |
226 final AnalysisError error; | 229 final AnalysisError error; |
227 | 230 |
228 FixContextImpl(this.resourceProvider, this.analysisContext, this.error); | 231 FixContextImpl(this.resourceProvider, this.analysisContext, this.error); |
229 | 232 |
230 FixContextImpl.from(FixContext other) | 233 FixContextImpl.from(FixContext other) |
231 : resourceProvider = other.resourceProvider, | 234 : resourceProvider = other.resourceProvider, |
232 analysisContext = other.analysisContext, | 235 analysisContext = other.analysisContext, |
233 error = other.error; | 236 error = other.error; |
234 } | 237 } |
OLD | NEW |