| 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 edit.domain; | 5 library edit.domain; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/analysis_server.dart'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
| 8 import 'package:analysis_server/src/computer/error.dart'; | 8 import 'package:analysis_server/src/computer/error.dart'; |
| 9 import 'package:analysis_server/src/constants.dart'; | 9 import 'package:analysis_server/src/constants.dart'; |
| 10 import 'package:analysis_server/src/edit/fix.dart'; | 10 import 'package:analysis_server/src/edit/fix.dart'; |
| 11 import 'package:analysis_server/src/protocol.dart'; | 11 import 'package:analysis_server/src/protocol.dart'; |
| 12 import 'package:analysis_server/src/protocol2.dart' show AnalysisError; |
| 12 import 'package:analysis_server/src/services/correction/assist.dart'; | 13 import 'package:analysis_server/src/services/correction/assist.dart'; |
| 13 import 'package:analysis_server/src/services/correction/change.dart'; | 14 import 'package:analysis_server/src/services/correction/change.dart'; |
| 14 import 'package:analysis_server/src/services/correction/fix.dart'; | 15 import 'package:analysis_server/src/services/correction/fix.dart'; |
| 15 import 'package:analysis_server/src/services/json.dart'; | 16 import 'package:analysis_server/src/services/json.dart'; |
| 16 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; | 17 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; |
| 17 import 'package:analysis_server/src/services/search/search_engine.dart'; | 18 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 18 import 'package:analyzer/src/generated/ast.dart'; | 19 import 'package:analyzer/src/generated/ast.dart'; |
| 19 import 'package:analyzer/src/generated/element.dart'; | 20 import 'package:analyzer/src/generated/element.dart'; |
| 20 import 'package:analyzer/src/generated/engine.dart' as engine; | 21 import 'package:analyzer/src/generated/engine.dart' as engine; |
| 21 import 'package:analyzer/src/generated/error.dart' as engine; | 22 import 'package:analyzer/src/generated/error.dart' as engine; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 int offset = request.getRequiredParameter(OFFSET).asInt(); | 86 int offset = request.getRequiredParameter(OFFSET).asInt(); |
| 86 List<ErrorFixes> errorFixesList = <ErrorFixes>[]; | 87 List<ErrorFixes> errorFixesList = <ErrorFixes>[]; |
| 87 List<CompilationUnit> units = server.getResolvedCompilationUnits(file); | 88 List<CompilationUnit> units = server.getResolvedCompilationUnits(file); |
| 88 for (CompilationUnit unit in units) { | 89 for (CompilationUnit unit in units) { |
| 89 engine.AnalysisErrorInfo errorInfo = server.getErrors(file); | 90 engine.AnalysisErrorInfo errorInfo = server.getErrors(file); |
| 90 if (errorInfo != null) { | 91 if (errorInfo != null) { |
| 91 for (engine.AnalysisError error in errorInfo.errors) { | 92 for (engine.AnalysisError error in errorInfo.errors) { |
| 92 List<Fix> fixes = computeFixes(searchEngine, unit, error); | 93 List<Fix> fixes = computeFixes(searchEngine, unit, error); |
| 93 if (fixes.isNotEmpty) { | 94 if (fixes.isNotEmpty) { |
| 94 AnalysisError serverError = | 95 AnalysisError serverError = |
| 95 new AnalysisError.fromEngine(errorInfo.lineInfo, error); | 96 analysisErrorFromEngine(errorInfo.lineInfo, error); |
| 96 ErrorFixes errorFixes = new ErrorFixes(serverError); | 97 ErrorFixes errorFixes = new ErrorFixes(serverError); |
| 97 errorFixesList.add(errorFixes); | 98 errorFixesList.add(errorFixes); |
| 98 fixes.forEach((fix) { | 99 fixes.forEach((fix) { |
| 99 errorFixes.addFix(fix); | 100 errorFixes.addFix(fix); |
| 100 }); | 101 }); |
| 101 } | 102 } |
| 102 } | 103 } |
| 103 } | 104 } |
| 104 } | 105 } |
| 105 // respond | 106 // respond |
| (...skipping 21 matching lines...) Expand all Loading... |
| 127 | 128 |
| 128 class RefactoringKind { | 129 class RefactoringKind { |
| 129 static const String CONVERT_GETTER_TO_METHOD = 'CONVERT_GETTER_TO_METHOD'; | 130 static const String CONVERT_GETTER_TO_METHOD = 'CONVERT_GETTER_TO_METHOD'; |
| 130 static const String CONVERT_METHOD_TO_GETTER = 'CONVERT_METHOD_TO_GETTER'; | 131 static const String CONVERT_METHOD_TO_GETTER = 'CONVERT_METHOD_TO_GETTER'; |
| 131 static const String EXTRACT_LOCAL_VARIABLE = 'EXTRACT_LOCAL_VARIABLE'; | 132 static const String EXTRACT_LOCAL_VARIABLE = 'EXTRACT_LOCAL_VARIABLE'; |
| 132 static const String EXTRACT_METHOD = 'EXTRACT_METHOD'; | 133 static const String EXTRACT_METHOD = 'EXTRACT_METHOD'; |
| 133 static const String INLINE_LOCAL_VARIABLE = 'INLINE_LOCAL_VARIABLE'; | 134 static const String INLINE_LOCAL_VARIABLE = 'INLINE_LOCAL_VARIABLE'; |
| 134 static const String INLINE_METHOD = 'INLINE_METHOD'; | 135 static const String INLINE_METHOD = 'INLINE_METHOD'; |
| 135 static const String RENAME = 'RENAME'; | 136 static const String RENAME = 'RENAME'; |
| 136 } | 137 } |
| OLD | NEW |